]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix space in filename bug -- see kes11Jun02
authorKern Sibbald <kern@sibbald.com>
Tue, 11 Jun 2002 13:20:39 +0000 (13:20 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 11 Jun 2002 13:20:39 +0000 (13:20 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@38 91ce42f0-d328-0410-95d8-f526ca767f89

14 files changed:
bacula/src/cats/bdb_list.c
bacula/src/cats/protos.h
bacula/src/cats/sql_list.c
bacula/src/dird/Makefile.in
bacula/src/dird/fd_cmds.c
bacula/src/dird/query.sql
bacula/src/dird/verify.c
bacula/src/filed/Makefile.in
bacula/src/filed/restore.c
bacula/src/lib/message.c
bacula/src/lib/signal.c
bacula/src/stored/Makefile.in
bacula/src/stored/bextract.c
bacula/src/version.h

index 99a00b214a70cd91f62c4963428ce5625bfd93d6..06d92923e0aaf6c087cd2d9d6b2f5a976f2c57c2 100644 (file)
@@ -57,7 +57,8 @@
 /* 
  * Submit general SQL query
  */
-int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx)
+int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx,
+                     int verbose)
 {
    sendit(ctx, "SQL Queries not implemented with internal database.\n");
    return 0;
index cea777bd3475af791d653c24972ccb2d2fcbb501..fbaf15b8affb7135b94cfed41dbe48fdf08dc7fa 100644 (file)
@@ -81,14 +81,14 @@ void db_list_job_totals(B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx
 void db_list_files_for_job(B_DB *db, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx);
 void db_list_media_records(B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx);
 void db_list_jobmedia_records(B_DB *mdb, uint32_t JobId, DB_LIST_HANDLER *sendit, void *ctx);
-int  db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx);
+int  db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose);
 
 /* update.c */
 int  db_update_job_start_record(B_DB *db, JOB_DBR *jr);
 int  db_update_job_end_record(B_DB *db, JOB_DBR *jr);
 int  db_update_pool_record(B_DB *db, POOL_DBR *pr);
 int  db_update_media_record(B_DB *db, MEDIA_DBR *mr);
-int  db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5); 
+int  db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5);  
 int  db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId);
 
 #endif /* __SQL_PROTOS_H */
index 305fc92aabc6f665d0174da0a65d126a95ac0bfe..8d88817695f20c40a4616ca1b941b223265245e0 100644 (file)
@@ -51,12 +51,15 @@ extern int QueryDB(char *file, int line, B_DB *db, char *select_cmd);
 /* 
  * Submit general SQL query
  */
-int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx)
+int db_list_sql_query(B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx,
+                     int verbose)
 {
    db_lock(mdb);
    if (sql_query(mdb, query) != 0) {
       Mmsg(&mdb->errmsg, _("Query failed: %s\n"), sql_strerror(mdb));
-      sendit(ctx, mdb->errmsg);
+      if (verbose) {
+        sendit(ctx, mdb->errmsg);
+      }
       db_unlock(mdb);
       return 0;
    }
index 0bbf313a1d1e8254c568d7a9f0f0d21485e0839a..f0551221bec422ad97d8dfa8adaf61d260e92dc8 100644 (file)
@@ -66,7 +66,7 @@ all: Makefile bacula-dir
 
 bacula-dir:  $(SVROBJS) ../lib/libbac.a ../cats/libsql.a
        $(CXX) $(LDFLAGS) -L../lib -L../cats -o $@ $(SVROBJS) \
-             -lsql $(LIBS) $(DLIB) -lbac -lm
+             -lsql -lbac -lm $(LIBS) $(DLIB)
 
 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
        cd $(topdir) \
index 304fb776122282aa4620f786413d4259004367b0..08e4f1147b41c5153d780b11b6e86d21700b7fff 100644 (file)
@@ -197,59 +197,71 @@ int get_attributes_and_put_in_catalog(JCR *jcr)
     * really fatal problems, or the number of errors is too
     * large.
     */
-       long file_index;
-       int stream, len;
-       char *attr, buf[MAXSTRING];
-       char Opts[MAXSTRING];         /* either Verify opts or MD5 signature */
-
-       /* ***FIXME*** check fname length */
-       if ((len = sscanf(fd->msg, "%ld %d %s %s", &file_index, &stream, 
-            Opts, jcr->fname)) != 4) {
-          Jmsg(jcr, M_FATAL, 0, _("<filed: bad attributes, expected 4 fields got %d\n\
+      long file_index;
+      int stream, len;
+      char *attr, *p, *fn;
+      char Opts_MD5[MAXSTRING];      /* either Verify opts or MD5 signature */
+      char MD5[MAXSTRING];
+
+      jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
+      if ((len = sscanf(fd->msg, "%ld %d %s", &file_index, &stream, Opts_MD5)) != 3) {
+         Jmsg(jcr, M_FATAL, 0, _("<filed: bad attributes, expected 3 fields got %d\n\
 msglen=%d msg=%s\n"), len, fd->msglen, fd->msg);
-         jcr->JobStatus = JS_ErrorTerminated;
-         return 0;
-       }
-
-       if (stream == STREAM_UNIX_ATTRIBUTES) {
-         jcr->JobFiles++;
-         len = strlen(fd->msg);      /* length before attributes */
-         ar.attr = &fd->msg[len+1];
-         ar.fname = jcr->fname;
-         ar.FileIndex = 0;           /* used as mark field during compare */
-         ar.Stream = stream;
-         ar.link = NULL;
-         ar.JobId = jcr->JobId;
-         ar.ClientId = jcr->ClientId;
-         ar.PathId = 0;
-         ar.FilenameId = 0;
-
-          Dmsg2(11, "dird<filed: stream=%d %s\n", stream, jcr->fname);
-          Dmsg1(20, "dird<filed: attr=%s\n", attr);
-
-         /* ***FIXME*** fix link field */
-         if (!db_create_file_attributes_record(jcr->db, &ar)) {
-             Jmsg1(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
-            jcr->JobStatus = JS_ErrorTerminated;
-            /* This probably should not really be fatal *****FIXME****** */
-            return 0;
-         }
-         jcr->FileIndex = file_index;
-         jcr->FileId = ar.FileId;
-       } else if (stream == STREAM_MD5_SIGNATURE) {
-         if (jcr->FileIndex != (uint32_t)file_index) {
-             Jmsg0(jcr, M_FATAL, 0, _("Got MD5 but not same block as attributes\n"));
-            jcr->JobStatus = JS_ErrorTerminated;
-            return 0;
-         }
-         db_escape_string(buf, Opts, strlen(Opts));
-          Dmsg2(20, "MD5len=%d MD5=%s\n", strlen(buf), buf);
-         if (!db_add_MD5_to_file_record(jcr->db, jcr->FileId, buf)) {
-             Jmsg1(jcr, M_WARNING, 0, "%s", db_strerror(jcr->db));
-         }
-       }
-       jcr->jr.JobFiles = jcr->JobFiles = file_index;
-       jcr->jr.LastIndex = file_index;
+        jcr->JobStatus = JS_ErrorTerminated;
+        return 0;
+      }
+      p = fd->msg;
+      skip_nonspaces(&p);            /* skip FileIndex */
+      skip_spaces(&p);
+      skip_nonspaces(&p);            /* skip Stream */
+      skip_spaces(&p);
+      skip_nonspaces(&p);            /* skip Opts_MD5 */   
+      p++;                           /* skip space */
+      fn = jcr->fname;
+      while (*p != 0) {
+        *fn++ = *p++;                /* copy filename */
+      }
+      *fn = *p++;                    /* term filename and point to attribs */
+      attr = p;
+
+      if (stream == STREAM_UNIX_ATTRIBUTES) {
+        jcr->JobFiles++;
+        ar.attr = attr;
+        ar.fname = jcr->fname;
+        ar.FileIndex = 0;           /* used as mark field during compare */
+        ar.Stream = stream;
+        ar.link = NULL;
+        ar.JobId = jcr->JobId;
+        ar.ClientId = jcr->ClientId;
+        ar.PathId = 0;
+        ar.FilenameId = 0;
+
+         Dmsg2(11, "dird<filed: stream=%d %s\n", stream, jcr->fname);
+         Dmsg1(20, "dird<filed: attr=%s\n", attr);
+
+        /* ***FIXME*** fix link field */
+        if (!db_create_file_attributes_record(jcr->db, &ar)) {
+            Jmsg1(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
+           jcr->JobStatus = JS_Error;
+           continue;
+        }
+        jcr->FileIndex = file_index;
+        jcr->FileId = ar.FileId;
+      } else if (stream == STREAM_MD5_SIGNATURE) {
+        if (jcr->FileIndex != (uint32_t)file_index) {
+            Jmsg0(jcr, M_ERROR, 0, _("Got MD5 but not same block as attributes\n"));
+           jcr->JobStatus = JS_Error;
+           continue;
+        }
+        db_escape_string(MD5, Opts_MD5, strlen(Opts_MD5));
+         Dmsg2(20, "MD5len=%d MD5=%s\n", strlen(MD5), MD5);
+        if (!db_add_MD5_to_file_record(jcr->db, jcr->FileId, MD5)) {
+            Jmsg1(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
+           jcr->JobStatus = JS_Error;
+        }
+      }
+      jcr->jr.JobFiles = jcr->JobFiles = file_index;
+      jcr->jr.LastIndex = file_index;
    } 
    if (n < 0) {
       Jmsg1(jcr, M_FATAL, 0, _("<filed: Network error getting attributes. ERR=%s\n"),
index 46ef7fc089f7037f167a2fe5cec794ad15933dd8..ae522887ba4ae97643d47d3d2f649969d4ee33c1 100644 (file)
@@ -50,3 +50,61 @@ SELECT count(*) AS Jobs, sum(JobFiles) AS Files,
  WHERE JobMedia.JobId=Job.JobId
  AND JobMedia.MediaId=Media.MediaId
  GROUP by VolumeName;  
+#
+:List last 10 Full Backups for a Client:
+*Enter Client name:
+Select JobId,Client.Name as Client,StartTime,JobFiles,JobBytes
+ FROM Client,Job
+ WHERE Client.Name="%1"
+ AND Client.ClientId=Job.ClientId
+ AND Level='F' AND JobStatus='T'
+ LIMIT 10;
+#
+:List Volumes used by selected JobId:
+*Enter JobId:
+SELECT Job.JobId,VolumeName 
+ FROM Job,JobMedia,Media 
+ WHERE Job.JobId=%1 
+ AND Job.JobId=JobMedia.JobId 
+ AND JobMedia.MediaId=Media.MediaId;
+:List Volumes to Restore All Files:
+*Enter Client Name:
+!DROP TABLE temp;
+!DROP TABLE temp2;
+CREATE TABLE temp (JobId INTEGER UNSIGNED NOT NULL,
+ JobTDate BIGINT UNSIGNED,
+ ClientId INTEGER UNSIGNED,
+ StartTime TEXT,
+ VolumeName TEXT,
+ StartFile INTEGER UNSIGNED, 
+ VolSessionId INTEGER UNSIGNED,
+ VolSessionTime INTEGER UNSIGNED);
+CREATE TABLE temp2 (JobId INTEGER UNSIGNED NOT NULL,
+ StartTime TEXT,
+ VolumeName TEXT,
+ StartFile INTEGER UNSIGNED, 
+ VolSessionId INTEGER UNSIGNED,
+ VolSessionTime INTEGER UNSIGNED);
+INSERT INTO temp SELECT Job.JobId,JobTDate,Job.ClientId,StartTime,VolumeName,
+   JobMedia.StartFile,VolSessionId,VolSessionTime
+ FROM Client,Job,JobMedia,Media WHERE Client.Name="%1"
+ AND Client.ClientId=Job.ClientId
+ AND Level='F' AND JobStatus='T'
+ AND JobMedia.JobId=Job.JobId 
+ AND JobMedia.MediaId=Media.MediaId
+ ORDER BY Job.JobTDate DESC LIMIT 1;
+INSERT INTO temp2 SELECT JobId,StartTime,VolumeName,StartFile, 
+   VolSessionId,VolSessionTime
+ FROM temp;
+INSERT INTO temp2 SELECT Job.JobId,Job.StartTime,Media.VolumeName,
+   JobMedia.StartFile,Job.VolSessionId,Job.VolSessionTime
+ FROM Job,temp,JobMedia,Media
+ WHERE Job.JobTDate>temp.JobTDate 
+ AND Job.ClientId=temp.ClientId
+ AND Level='I' AND JobStatus='T'
+ AND JobMedia.JobId=Job.JobId 
+ AND JobMedia.MediaId=Media.MediaId;
+SELECT * from temp2;
+!DROP TABLE temp;
+!DROP TABLE temp2;
+#
index b296611974b5356ac7a43a230e2a8743e6fd1ddf..475c9800048c7f70b453da437fcfcae4db2c41cb 100644 (file)
@@ -299,26 +299,37 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id)
    while ((n=bget_msg(fd, 0)) > 0) {
       long file_index, attr_file_index;
       int stream;
-      char *attr, *p;
+      char *attr, *p, *fn;
       char Opts_MD5[MAXSTRING];        /* Verify Opts or MD5 signature */
 
       fname = check_pool_memory_size(fname, fd->msglen);
       jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
       Dmsg1(50, "Atts+MD5=%s\n", fd->msg);
-      if ((len = sscanf(fd->msg, "%ld %d %100s %s", &file_index, &stream, 
-           Opts_MD5, fname)) != 4) {
-         Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 4 fields got %d\n\
+      if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream, 
+           Opts_MD5)) != 3) {
+         Jmsg3(jcr, M_FATAL, 0, _("bird<filed: bad attributes, expected 3 fields got %d\n\
  mslen=%d msg=%s\n"), len, fd->msglen, fd->msg);
         goto bail_out;
       }
+      p = fd->msg;
+      skip_nonspaces(&p);            /* skip FileIndex */
+      skip_spaces(&p);
+      skip_nonspaces(&p);            /* skip Stream */
+      skip_spaces(&p);
+      skip_nonspaces(&p);            /* skip Opts_MD5 */   
+      p++;                           /* skip space */
+      fn = fname;
+      while (*p != 0) {
+        *fn++ = *p++;                /* copy filename */
+      }
+      *fn = *p++;                    /* term filename and point to attribs */
+      attr = p;
       /*
        * Got attributes stream, decode it
        */
       if (stream == STREAM_UNIX_ATTRIBUTES) {
         jcr->JobFiles++;
         attr_file_index = file_index;    /* remember attribute file_index */
-        len = strlen(fd->msg);
-        attr = &fd->msg[len+1];
         decode_stat(attr, &statf);  /* decode file stat packet */
         do_MD5 = FALSE;
         jcr->fn_printed = FALSE;
index dcc7032603d4348e19d4c6eab026511dde041fd1..c6f0eea85a1875cce7c91ccaf1fe21a167bcac23 100755 (executable)
@@ -66,7 +66,7 @@ win32:        $(WIN32OBJS)
 
 bacula-fd:  $(SVROBJS) ../findlib/libfind.a ../lib/libbac.a @WIN32@
        $(CXX) $(LDFLAGS) -L../lib -L../findlib -o $@ $(SVROBJS) \
-         $(WIN32LIBS) $(FDLIBS) $(LIBS) $(DLIB) -lfind -lbac -lm
+         $(WIN32LIBS) $(FDLIBS) -lfind -lbac -lm $(LIBS) $(DLIB)
 
 Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
        cd $(topdir) \
index 43ef5e9c837f6259b3bccc084b151872566d0ba2..3c53741cf6ccd8d51e579e542e16695e10d56c4c 100644 (file)
@@ -105,7 +105,7 @@ void do_restore(JCR *jcr)
 
       /* File Attributes stream */
       if (stream == STREAM_UNIX_ATTRIBUTES) {
-        char *ap, *lp;
+        char *ap, *lp, *fp;
 
          Dmsg1(30, "Stream=Unix Attributes. extract=%d\n", extract);
         /* If extracting, it was from previous stream, so
@@ -143,13 +143,12 @@ void do_restore(JCR *jcr)
          *    Link name (if file linked i.e. FT_LNK)
          *
          */
-         if (sscanf(sd->msg, "%d %d %s", &record_file_index, &type, fname) != 3) {
+         if (sscanf(sd->msg, "%d %d", &record_file_index, &type) != 2) {
             Jmsg(jcr, M_FATAL, 0, _("Error scanning record header: %s\n"), sd->msg);
             Dmsg0(0, "\nError scanning header\n");
            goto bail_out;
         }
-         Dmsg3(30, "Got Attr: FilInx=%d type=%d fname=%s\n", record_file_index,
-           type, fname);
+         Dmsg2(30, "Got Attr: FilInx=%d type=%d\n", record_file_index, type);
         if (record_file_index != file_index) {
             Jmsg(jcr, M_FATAL, 0, _("Record header file index %ld not equal record index %ld\n"),
               file_index, record_file_index);
@@ -157,10 +156,17 @@ void do_restore(JCR *jcr)
            goto bail_out;
         }
         ap = sd->msg;
-        /* Skip to attributes */
-        while (*ap++ != 0) {
+         while (*ap++ != ' ')         /* skip record file index */
            ;
+         while (*ap++ != ' ')         /* skip type */
+           ;
+        /* Save filename and position to attributes */
+        fp = fname;
+        while (*ap != 0) {
+           *fp++  = *ap++;
         }
+        *fp = *ap++;                 /* terminate filename & point to attribs */
+
         /* Skip to Link name */
         if (type == FT_LNK) {
            lp = ap;
index d70adadeae2b6d01ed2f146af169d43c748b4b75..42953586c7a50da07a8208104cefece9685c9603 100755 (executable)
@@ -196,7 +196,7 @@ void init_console_msg(char *wd)
    sprintf(con_fname, "%s/%s.conmsg", wd, my_name);
    fd = open(con_fname, O_CREAT|O_RDWR|O_BINARY, 0600);
    if (fd == -1) {
-       Emsg2(M_ABORT, 0, "Could not open console message file %s: ERR=%s\n",
+       Emsg2(M_TERM, 0, "Could not open console message file %s: ERR=%s\n",
          con_fname, strerror(errno));
    }
    if (lseek(fd, 0, SEEK_END) > 0) {
@@ -645,7 +645,7 @@ void dispatch_message(void *vjcr, int type, int level, char *msg)
 
     Dmsg2(200, "Enter dispatch_msg type=%d msg=%s\n", type, msg);
 
-    if (type == M_ABORT) {
+    if (type == M_ABORT || type == M_TERM) {
        fprintf(stdout, msg);         /* print this here to INSURE that it is printed */
     }
 
@@ -755,7 +755,7 @@ void dispatch_message(void *vjcr, int type, int level, char *msg)
                break;
             case MD_STDOUT:
                 Dmsg1(200, "STDOUT for following err: %s\n", msg);
-               if (type != M_ABORT && type != M_FATAL)  /* already printed */
+               if (type != M_ABORT && type != M_TERM)  /* already printed */
                   fprintf(stdout, msg);
                break;
             case MD_STDERR:
@@ -829,9 +829,9 @@ e_msg(char *file, int line, int type, int level, char *fmt,...)
 
     /* 
      * Check if we have a message destination defined. 
-     * We always report M_ABORT 
+     * We always report M_ABORT and M_TERM 
      */
-    if (!daemon_msgs || (type != M_ABORT && 
+    if (!daemon_msgs || ((type != M_ABORT && type != M_TERM) && 
                         !bit_is_set(type, daemon_msgs->send_msg)))
        return;                       /* no destination */
     switch (type) {
@@ -839,6 +839,10 @@ e_msg(char *file, int line, int type, int level, char *fmt,...)
           sprintf(buf, "%s ABORTING due to ERROR in %s:%d\n", 
                  my_name, file, line);
          break;
+       case M_TERM:
+          sprintf(buf, "%s TERMINATING due to ERROR in %s:%d\n", 
+                 my_name, file, line);
+         break;
        case M_FATAL:
          if (level == -1)            /* skip details */
              sprintf(buf, "%s: Fatal Error because: ", my_name);
@@ -870,6 +874,9 @@ e_msg(char *file, int line, int type, int level, char *fmt,...)
        char *p = 0;
        p[0] = 0;                     /* generate segmentation violation */
     }
+    if (type == M_TERM) {
+       _exit(1);
+    }
 }
 
 /* *********************************************************
@@ -908,9 +915,9 @@ Jmsg(void *vjcr, int type, int level, char *fmt,...)
     buf = rbuf;                   /* we are the Director */
     /* 
      * Check if we have a message destination defined. 
-     * We always report M_ABORT 
+     * We always report M_ABORT and M_TERM 
      */
-    if (type != M_ABORT && msgs && !bit_is_set(type, msgs->send_msg)) {
+    if ((type != M_ABORT && type != M_TERM) && msgs && !bit_is_set(type, msgs->send_msg)) {
        Dmsg1(200, "No bit set for type %d\n", type);
        return;                       /* no destination */
     }
@@ -918,6 +925,9 @@ Jmsg(void *vjcr, int type, int level, char *fmt,...)
        case M_ABORT:
           sprintf(buf, "%s ABORTING due to ERROR\n", my_name);
          break;
+       case M_TERM:
+          sprintf(buf, "%s TERMINATING due to ERROR\n", my_name);
+         break;
        case M_FATAL:
           sprintf(buf, "%s: Job %s Fatal error: ", my_name, job);
          if (jcr) {
@@ -952,6 +962,9 @@ Jmsg(void *vjcr, int type, int level, char *fmt,...)
        char *p = 0;
        p[0] = 0;                     /* generate segmentation violation */
     }
+    if (type == M_TERM) {
+       _exit(1);
+    }
 }
 
 /*
index 0b9fe5bc792cf2d232474782e611483619403c1a..deefdb0401efdec4851016fd3e7eee074f313656 100644 (file)
@@ -68,7 +68,7 @@ static void signal_handler(int sig)
    }
    already_dead = sig;
    if (sig == SIGTERM) {
-      Emsg1(M_TERM, -1, "Shutting down Bacula service: %s ...\n", my_name);
+      Emsg1(M_INFO, -1, "Shutting down Bacula service: %s ...\n", my_name);
    } else {
       Emsg2(M_FATAL, -1, "Interrupted by signal %d: %s\n", sig, sig_names[sig]);
    }
index 0500e1e6b656cef4f79a84eaeaff4558c10507e2..8e479dd01b44f64550bb32707d753fd137bf39f7 100644 (file)
@@ -66,7 +66,7 @@ all: Makefile bacula-sd bls bextract bscan btape
        @echo " "
 
 bacula-sd: $(SVROBJS) ../lib/libbac.a
-       $(CXX) $(LDFLAGS) -L../lib -o $@ $(SVROBJS) $(LIBS) $(DLIB) $(FDLIBS) -lbac -lm
+       $(CXX) $(LDFLAGS) -L../lib -o $@ $(SVROBJS) $(FDLIBS) -lbac -lm $(LIBS) $(DLIB)
 
 #bpool:  $(POOLOBJS) ../lib/libbac.a ../cats/libsql.a
 #       $(CXX) $(LDFLAGS) -L../lib -L../cats  -o $@ $(POOLOBJS) -lsql $(LIBS) $(DLIB) -lbac -lm
index 17e6dd570a74585f5ce6ed3d0fd33b4516582c1b..66834f6f12f5f76566452fe269cee233dc928870 100644 (file)
@@ -63,6 +63,7 @@ int main (int argc, char *argv[])
    int ch;   
    FILE *fd;
    char line[1000];
+   int got_inc = FALSE;
 
    my_name_is(argc, argv, "bextract");
    init_msg(NULL, NULL);             /* setup message handler */
@@ -104,6 +105,7 @@ int main (int argc, char *argv[])
               add_fname_to_include_list(ff, 0, line);
            }
            fclose(fd);
+           got_inc = TRUE;
            break;
 
          case '?':
@@ -119,6 +121,9 @@ int main (int argc, char *argv[])
       Dmsg0(0, "Wrong number of arguments: \n");
       usage();
    }
+   if (!got_inc) {                           /* If no include file, */
+      add_fname_to_include_list(ff, 0, "/");  /*   include everything */
+   }
 
    jcr = new_jcr(sizeof(JCR), my_free_jcr);
    jcr->VolSessionId = 1;
@@ -264,7 +269,7 @@ static void do_extract(char *devname, char *where)
 
       /* File Attributes stream */
       if (rec.Stream == STREAM_UNIX_ATTRIBUTES) {
-        char *ap, *lp;
+        char *ap, *lp, *fp;
 
         /* If extracting, it was from previous stream, so
          * close the output file.
@@ -300,14 +305,22 @@ static void do_extract(char *devname, char *where)
          *    Link name (if file linked i.e. FT_LNK)
          *
          */
-         sscanf(rec.data, "%ld %d %s", &record_file_index, &type, fname);
+         sscanf(rec.data, "%ld %d", &record_file_index, &type);
         if (record_file_index != rec.FileIndex)
             Emsg2(M_ABORT, 0, "Record header file index %ld not equal record index %ld\n",
               rec.FileIndex, record_file_index);
         ap = rec.data;
-        /* Skip to attributes */
-        while (*ap++ != 0)
+         while (*ap++ != ' ')         /* skip record file index */
+           ;
+         while (*ap++ != ' ')         /* skip type */
            ;
+        /* Save filename and position to attributes */
+        fp = fname;
+        while (*ap != 0) {
+           *fp++  = *ap++;
+        }
+        *fp = *ap++;                 /* terminate filename & point to attribs */
+
         /* Skip to Link name */
         if (type == FT_LNK) {
            lp = ap;
index 8100d79869f0446f16391bb7e0f18a1121dc7a06..05eef0520cb56662827752a10d3c88859407b57c 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.21"
 #define VSTRING "1"
-#define DATE    "3 June 2002"
-#define LSMDATE "03Jun02"
+#define DATE    "11 June 2002"
+#define LSMDATE "11Jun02"
 
 /* Debug flags */
 #define DEBUG 1