]> git.sur5r.net Git - bacula/bacula/commitdiff
A few changes for Win32
authorKern Sibbald <kern@sibbald.com>
Fri, 6 Aug 2004 21:57:03 +0000 (21:57 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 6 Aug 2004 21:57:03 +0000 (21:57 +0000)
Implement reader in Dir and FD
Rework SQL for pruning
Add Admin pruner
No commas in JobIds printed in restore command

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1514 91ce42f0-d328-0410-95d8-f526ca767f89

23 files changed:
bacula/kernstodo
bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/fd_cmds.c
bacula/src/dird/inc_conf.c
bacula/src/dird/sql_cmds.c
bacula/src/dird/ua_prune.c
bacula/src/dird/ua_restore.c
bacula/src/filed/backup.c
bacula/src/filed/filed.c
bacula/src/filed/job.c
bacula/src/findlib/bfile.c
bacula/src/findlib/bfile.h
bacula/src/findlib/find.c
bacula/src/findlib/find.h
bacula/src/lib/bnet.c
bacula/src/lib/bnet_server.c
bacula/src/lib/bpipe.h
bacula/src/win32/baculafd/baculafd.mak
bacula/src/win32/console/console.mak
bacula/src/win32/lib/address_conf.cpp [new file with mode: 0755]
bacula/src/win32/wx-console/filelist
bacula/src/win32/wx-console/wx-console.mak

index f8e30d4a67cee1d370c4225471a060b9e076b9c9..e16b57ea2cb49726bf03512b3fc3cf762a708bac 100644 (file)
@@ -1,5 +1,5 @@
                  Kern's ToDo List
-                   05 August 2004
+                   06 August 2004
 
 Major development:      
 Project                     Developer
@@ -71,6 +71,7 @@ For 1.37 Testing/Documentation:
   non-existent directories will not be restored properly.
 
 Wish list:  
+- Allow the user to select JobType for manual pruning/purging.
 - Look at adding Client run command that will use the
   port opened by the client.
 - bscan does not put first of two volumes back with all info in
index 36a31ae4d7e544ef608ac7a96b5ebafb51bd0826..4e5e06e5baa994101c440b999b6c8341f016d0c7 100644 (file)
@@ -581,6 +581,12 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
            for (k=0; k<fo->base.size(); k++) {
                sendit(sock, "      B %s\n", fo->base.get(k));
            }
+           if (fo->reader) {
+               sendit(sock, "      D %s\n", fo->reader);
+           }
+           if (fo->writer) {
+               sendit(sock, "      T %s\n", fo->writer);
+           }
             sendit(sock, "      N\n");
         }
         for (j=0; j<incexe->name_list.size(); j++) {
@@ -735,6 +741,12 @@ static void free_incexe(INCEXE *incexe)
       fopt->regex.destroy();
       fopt->wild.destroy();
       fopt->base.destroy();
+      if (fopt->reader) {
+        free(fopt->reader);
+      }
+      if (fopt->writer) {
+        free(fopt->writer);
+      }
       free(fopt);
    }
    if (incexe->opts_list) {
index a91f48b07b36fadc85b1776eed2a1532acfa2a54..ca70954f35eba7fa62144f1798dc57c1afcfbd41 100644 (file)
@@ -247,6 +247,8 @@ struct FOPTS {
    alist regex;                       /* regex string(s) */
    alist wild;                        /* wild card strings */
    alist base;                        /* list of base names */
+   char *reader;                      /* reader program */
+   char *writer;                      /* writer program */
 };
 
 
index fdc8617cf49f14f345ba6b1c0ed8d45e326fae3b..5d05c051e2ea538c3526e6888391d4dfca5b29a9 100644 (file)
@@ -391,6 +391,12 @@ static int send_fileset(JCR *jcr)
            for (k=0; k<fo->base.size(); k++) {
                bnet_fsend(fd, "B %s\n", fo->base.get(k));
            }
+           if (fo->reader) {
+               bnet_fsend(fd, "D %s\n", fo->reader);
+           }
+           if (fo->writer) {
+               bnet_fsend(fd, "T %s\n", fo->writer);
+           }
             bnet_fsend(fd, "N\n");
         }
 
index d3df0b8fd4f5b15a6c023c6eee4df49203c0f30b..815b82483262978b7496508825b7a6b9fca5e2c6 100644 (file)
@@ -43,6 +43,8 @@ static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass);
 static void options_res(LEX *lc, RES_ITEM *item, int index, int pass);
 static void store_base(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_reader(LEX *lc, RES_ITEM *item, int index, int pass);
+static void store_writer(LEX *lc, RES_ITEM *item, int index, int pass);
 static void setup_current_opts(void);
 
 
@@ -87,6 +89,8 @@ static RES_ITEM options_items[] = {
    {"wild",            store_wild,    NULL,     0, 0, 0},
    {"exclude",         store_opts,    NULL,     0, 0, 0},
    {"aclsupport",      store_opts,    NULL,     0, 0, 0},
+   {"reader",          store_reader,  NULL,     0, 0, 0},
+   {"writer",          store_writer,  NULL,     0, 0, 0},
    {NULL, NULL, NULL, 0, 0, 0} 
 };
 
@@ -495,6 +499,41 @@ static void store_base(LEX *lc, RES_ITEM *item, int index, int pass)
    scan_to_eol(lc);
 }
 
+/* Store reader info */
+static void store_reader(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   int token;
+
+   if (pass == 1) {
+      /*
+       * Pickup reader command
+       */
+      token = lex_get_token(lc, T_NAME);          
+      res_incexe.current_opts->reader = bstrdup(lc->str); 
+   } else { /* pass 2 */
+      lex_get_token(lc, T_ALL);         
+   }
+   scan_to_eol(lc);
+}
+
+/* Store writer innfo */
+static void store_writer(LEX *lc, RES_ITEM *item, int index, int pass)
+{
+   int token;
+
+   if (pass == 1) {
+      /*
+       * Pickup writer command
+       */
+      token = lex_get_token(lc, T_NAME);          
+      res_incexe.current_opts->writer = bstrdup(lc->str);
+   } else { /* pass 2 */
+      lex_get_token(lc, T_ALL);         
+   }
+   scan_to_eol(lc);
+}
+
+
 
 /* Store Wild-card info */
 static void store_wild(LEX *lc, RES_ITEM *item, int index, int pass)
index 8c79737cd5f2e2dc6b928baa0aec8ce63a5c3325..0058374b5044115bf68d919d90d26cd08bc7d06c 100644 (file)
@@ -114,45 +114,54 @@ const char *insert_delcand =
  * (i.e. no files, ...) for deletion.
  */
 const char *select_backup_del =
-   "SELECT DelCandidates.JobId "
+   "SELECT DISTINCT DelCandidates.JobId "
    "FROM Job,DelCandidates "
-   "WHERE (JobTDate<%s AND ((DelCandidates.JobFiles=0) OR "
+   "WHERE (Job.JobTDate<%s AND ((DelCandidates.JobFiles=0) OR "
    "(DelCandidates.JobStatus!='T'))) OR "
    "(Job.JobTDate>%s "
    "AND Job.ClientId=%u "
    "AND Job.Type='B' "
    "AND Job.Level='F' "
    "AND Job.JobStatus='T' "
-   "AND Job.FileSetId=DelCandidates.FileSetId) "
-   "GROUP BY DelCandidates.JobId";
+   "AND Job.FileSetId=DelCandidates.FileSetId)";
 
 /* Select Jobs from the DelCandidates table that have a
  * more recent InitCatalog -- i.e. are not the only InitCatalog
  * This is the list of Jobs to delete for a Verify Job.
  */
 const char *select_verify_del =
-   "SELECT DelCandidates.JobId "
+   "SELECT DISTINCT DelCandidates.JobId "
    "FROM Job,DelCandidates "
-   "WHERE Job.JobTDate>%s "
+   "WHERE (Job.JobTdate<%s AND DelCandidates.JobStatus!='T') OR "
+   "(Job.JobTDate>%s "
    "AND Job.ClientId=%u "
    "AND Job.Type='V' "
    "AND Job.Level='V' "
    "AND Job.JobStatus='T' "
-   "AND Job.FileSetId=DelCandidates.FileSetId "
-   "GROUP BY DelCandidates.JobId";
+   "AND Job.FileSetId=DelCandidates.FileSetId)";
 
 
 /* Select Jobs from the DelCandidates table.
  * This is the list of Jobs to delete for a Restore Job.
  */
 const char *select_restore_del =
-   "SELECT DelCandidates.JobId "
+   "SELECT DISTINCT DelCandidates.JobId "
    "FROM Job,DelCandidates "
-   "WHERE Job.JobTDate>%s "
+   "WHERE (Job.JobTdate<%s AND delCandidates.JobStatus!='T') OR "
+   "(Job.JobTDate>%s "
    "AND Job.ClientId=%u "   
-   "AND Job.Type='R' "
-   "GROUP BY DelCandidates.JobId";
+   "AND Job.Type='R')";
 
+/* Select Jobs from the DelCandidates table.
+ * This is the list of Jobs to delete for an Admin Job.
+ */
+const char *select_admin_del =
+   "SELECT DISTINCT DelCandidates.JobId "
+   "FROM Job,DelCandidates "
+   "WHERE (Job.JobTdate<%s AND delCandidates.JobStatus!='T') OR "
+   "(Job.JobTDate>%s "
+   "AND Job.ClientId=%u "   
+   "AND Job.Type='D')";
 
 
 /* ======= ua_restore.c */
index 5e9f93652a879632424d4d2af43aad18ad8fa442..4fb5e4be100c58b4b569ba09a34c876a9dd82855 100644 (file)
@@ -47,6 +47,7 @@ extern char *insert_delcand;
 extern char *select_backup_del;
 extern char *select_verify_del;
 extern char *select_restore_del;
+extern char *select_admin_del;
 extern char *cnt_File;
 extern char *del_File;
 extern char *upd_Purged;
@@ -413,15 +414,17 @@ int prune_jobs(UAContext *ua, CLIENT *client, int JobType)
    del.PurgedFiles = (char *)malloc(del.max_ids);
 
    switch (JobType) {
-   case JT_ADMIN:
    case JT_BACKUP:
       Mmsg(&query, select_backup_del, ed1, ed1, cr.ClientId);
       break;
    case JT_RESTORE:
-      Mmsg(&query, select_restore_del, ed1, cr.ClientId);
+      Mmsg(&query, select_restore_del, ed1, ed1, cr.ClientId);
       break;
    case JT_VERIFY:
-      Mmsg(&query, select_verify_del, ed1, cr.ClientId);
+      Mmsg(&query, select_verify_del, ed1, ed1, cr.ClientId);
+      break;
+   case JT_ADMIN:
+      Mmsg(&query, select_admin_del, ed1, ed1, cr.ClientId);
       break;
    }
    if (!db_sql_query(ua->db, query, job_delete_handler, (void *)&del)) {
index 9c9faec58e6240fd36480cad993a1956398a82dc..2b1cf9cd0a909950d4a31ef9fc1b5792577c66bf 100644 (file)
@@ -415,6 +415,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
    for ( ; !done; ) {
       char *fname;
       int len;
+      bool gui_save;
 
       start_prompt(ua, _("To select the JobIds, you have the following choices:\n"));
       for (int i=0; list[i]; i++) {
@@ -425,7 +426,10 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
       case -1:                       /* error */
         return 0;
       case 0:                        /* list last 20 Jobs run */
+        gui_save = ua->jcr->gui;
+        ua->jcr->gui = true;
         db_list_sql_query(ua->jcr, ua->db, uar_list_jobs, prtit, ua, 1, HORZ_LIST);
+        ua->jcr->gui = gui_save;
         done = false;
         break;
       case 1:                        /* list where a file is saved */
@@ -437,7 +441,10 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
         db_escape_string(fname, ua->cmd, len);
         Mmsg(&rx->query, uar_file, fname);
         free(fname);
+        gui_save = ua->jcr->gui;
+        ua->jcr->gui = true;
         db_list_sql_query(ua->jcr, ua->db, rx->query, prtit, ua, 1, HORZ_LIST);
+        ua->jcr->gui = gui_save;
         done = false;
         break;
       case 2:                        /* enter a list of JobIds */
@@ -450,7 +457,10 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
          if (!get_cmd(ua, _("Enter SQL list command: "))) {
            return 0;
         }
+        gui_save = ua->jcr->gui;
+        ua->jcr->gui = true;
         db_list_sql_query(ua->jcr, ua->db, ua->cmd, prtit, ua, 1, HORZ_LIST);
+        ua->jcr->gui = gui_save;
         done = false;
         break;
       case 4:                        /* Select the most recent backups */
index b558480f29c57d9b07f2f9b69a42f7c53f91c112..84df57311cfd62a5f4bb74ba60993f681de5d17b 100644 (file)
@@ -230,6 +230,9 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr)
    if (ff_pkt->flags & FO_PORTABLE) {
       set_portable_backup(&ff_pkt->bfd); /* disable Win32 BackupRead() */
    }
+   if (ff_pkt->reader) {
+      set_prog(&ff_pkt->bfd, ff_pkt->reader, jcr);
+   }
 
    /* 
     * Open any file with data that we intend to save.  
index eea48245daa0370aefb4ee1cfa1e8579a75e5d9a..08131cc8251662783583b7ce5afacd4bffad14df 100644 (file)
@@ -240,25 +240,25 @@ Without that I don't know who I am :-(\n"), configfile);
    if (inetd_request) {
       /* Socket is on fd 0 */         
       struct sockaddr client_addr;
-        int port = -1;
-        size_t client_addr_len = sizeof(client_addr);
-        if (getsockname(0, &client_addr, &client_addr_len) == 0) {
-           if (client_addr.sa_family == AF_INET) {
-              port = ((struct sockaddr_in*)&client_addr)->sin_port;
-           }
+      int port = -1;
+      socklen_t client_addr_len = sizeof(client_addr);
+      if (getsockname(0, &client_addr, &client_addr_len) == 0) {
+        if (client_addr.sa_family == AF_INET) {
+           port = ((struct sockaddr_in*)&client_addr)->sin_port;
+        }
 #ifdef HAVE_IPV6
-           else if (client_addr.sa_family == AF_INET6) {
-              port = ((struct sockaddr_in6*)&client_addr)->sin6_port;
-           }
+        else if (client_addr.sa_family == AF_INET6) {
+           port = ((struct sockaddr_in6*)&client_addr)->sin6_port;
+        }
 #endif
-         }
+      }
       BSOCK *bs = init_bsock(NULL, 0, "client", "unknown client", port, &client_addr);
       handle_client_request((void *)bs);
    } else {
       /* Become server, and handle requests */
       IPADDR *p;
       foreach_dlist(p, me->FDaddrs) {
-        Dmsg1(10, "filed: listening on port %d\n", ntohs(p->get_port()));
+         Dmsg1(10, "filed: listening on port %d\n", ntohs(p->get_port()));
       }
       bnet_thread_server(me->FDaddrs, me->MaxConcurrentJobs, &dir_workq, handle_client_request);
    }
index f75a4c32265e9f23355c4e4ab1d70ddbaf4327d2..3806a4b13b6d58a228fdece308f1027e8a8a3ddd 100644 (file)
@@ -238,6 +238,12 @@ void *handle_client_request(void *dirp)
            fo->regex.destroy();
            fo->wild.destroy();
            fo->base.destroy();
+           if (fo->reader) {
+              free(fo->reader);
+           }
+           if (fo->writer) {
+              free(fo->writer);
+           }
         }
         incexe->opts_list.destroy();
         incexe->name_list.destroy();
@@ -747,6 +753,16 @@ static void add_fileset(JCR *jcr, const char *item)
       set_options(current_opts, item);
       state = state_options;
       break;
+   case 'D':
+      current_opts = start_options(ff);
+      current_opts->reader = bstrdup(item);
+      state = state_options;
+      break;
+   case 'T':
+      current_opts = start_options(ff);
+      current_opts->writer = bstrdup(item);
+      state = state_options;
+      break;
    default:
       Jmsg(jcr, M_FATAL, 0, "Invalid FileSet command: %s\n", item);
       state = state_error;
@@ -775,6 +791,12 @@ static bool term_fileset(JCR *jcr)
         for (k=0; k<fo->base.size(); k++) {
             Dmsg1(400, "B %s\n", (char *)fo->base.get(k));
         }
+        if (fo->reader) {
+            Dmsg1(400, "D %s\n", fo->reader);
+        }
+        if (fo->writer) {
+            Dmsg1(400, "T %s\n", fo->writer);
+        }
       }
       for (j=0; j<incexe->name_list.size(); j++) {
          Dmsg1(400, "F %s\n", (char *)incexe->name_list.get(j));
index 0197bd3c40b10a1b9db2cbb528907a6b140f3084..c47afde496a15525c417d578ee292d25e259f275 100644 (file)
@@ -105,10 +105,6 @@ void binit(BFILE *bfd)
    bfd->fid = -1;
    bfd->mode = BF_CLOSED;
    bfd->use_backup_api = have_win32_api();
-   bfd->errmsg = NULL;
-   bfd->lpContext = NULL;
-   bfd->lerror = 0;
-   bfd->berrno = 0;
 }
 
 /*
@@ -130,6 +126,12 @@ int set_portable_backup(BFILE *bfd)
    return 1;
 }
 
+void set_prog(BFILE *bfd, char *prog, JCR *jcr)
+{
+   bfd->prog = prog;
+   bfd->jcr = jcr;
+}
+
 /*
  * Return 1 if we are NOT using Win32 BackupWrite() 
  * return 0 if are
@@ -462,6 +464,13 @@ int is_portable_backup(BFILE *bfd)
    return 1;                         /* portable by definition */
 }
 
+void set_prog(BFILE *bfd, char *prog, JCR *jcr)
+{
+   bfd->prog = prog;
+   bfd->jcr = jcr;
+}
+
+
 int is_stream_supported(int stream)
 {
    /* No Win32 backup on this machine */
@@ -496,6 +505,34 @@ int is_stream_supported(int stream)
 
 int bopen(BFILE *bfd, const char *fname, int flags, mode_t mode)
 {
+   /* Open reader/writer program */
+   if (bfd->prog) {
+      POOLMEM *ecmd = get_pool_memory(PM_FNAME);
+      ecmd = edit_job_codes(bfd->jcr, ecmd, bfd->prog, fname);
+      char *pmode;
+      if (flags & O_RDONLY) {
+         pmode = "r";
+      } else {
+         pmode = "w";
+      }
+      bfd->bpipe = open_bpipe(ecmd, 0, pmode);
+      if (bfd->bpipe == NULL) {
+        bfd->berrno = errno;
+        bfd->fid = -1;
+        free_pool_memory(ecmd);
+        return -1;
+      }
+      free_pool_memory(ecmd);
+      if (flags & O_RDONLY) {
+        bfd->fid = fileno(bfd->bpipe->rfd);
+      } else {
+        bfd->fid = fileno(bfd->bpipe->wfd);
+      }
+      errno = 0;
+      return bfd->fid;
+   }
+
+   /* Normal file open */
    bfd->fid = open(fname, flags, mode);
    bfd->berrno = errno;
    Dmsg1(400, "Open file %d\n", bfd->fid);
@@ -510,10 +547,19 @@ int bclose(BFILE *bfd)
    if (bfd->fid == -1) {
       return 0;
    }
+   /* Close reader/writer program */
+   if (bfd->prog && bfd->bpipe) {
+      stat = close_bpipe(bfd->bpipe);
+      bfd->berrno = errno;
+      bfd->fid = -1;
+      bfd->bpipe = NULL;
+      return stat;
+   }
+   
+   /* Close normal file */
    stat = close(bfd->fid);
    bfd->berrno = errno;
    bfd->fid = -1;
-
    return stat;
 }
 
index d65e5867b568d6fd42891d98937df9f261754ad0..91beed66a7b4c3a90d389b76c8c0b58fc6cb880d 100644 (file)
@@ -58,6 +58,9 @@ struct BFILE {
    DWORD rw_bytes;                    /* Bytes read or written */
    DWORD lerror;                      /* Last error code */
    int berrno;                        /* errno */
+   char *prog;                        /* reader/writer program if any */
+   BPIPE *bpipe;                      /* pipe for reader */
+   JCR *jcr;                          /* jcr for editing job codes */
 };      
 
 HANDLE bget_handle(BFILE *bfd);
@@ -75,6 +78,9 @@ HANDLE bget_handle(BFILE *bfd);
 struct BFILE {
    int fid;                           /* file id on Unix */
    int berrno;
+   char *prog;                        /* reader/writer program if any */
+   BPIPE *bpipe;                      /* pipe for reader */
+   JCR *jcr;                          /* jcr for editing job codes */
 };      
 
 #endif
@@ -83,6 +89,7 @@ void    binit(BFILE *bfd);
 int     is_bopen(BFILE *bfd);
 int     set_win32_backup(BFILE *bfd);
 int     set_portable_backup(BFILE *bfd);
+void    set_prog(BFILE *bfd, char *prog, JCR *jcr);
 int     have_win32_api();
 int     is_portable_backup(BFILE *bfd);
 int     is_stream_supported(int stream);
index 5efc6696558d0686504758bceb0231cf50970ad1..d676f9690862fe4dd07e9db9d281b0164b198615 100644 (file)
@@ -159,10 +159,12 @@ static bool accept_file(FF_PKT *ff)
 
    for (j=0; j<incexe->opts_list.size(); j++) {
       findFOPTS *fo = (findFOPTS *)incexe->opts_list.get(j);
+      ff->flags = fo->flags;
+      ff->GZIP_level = fo->GZIP_level;
+      ff->reader = fo->reader;
+      ff->writer = fo->writer;
       for (k=0; k<fo->wild.size(); k++) {
         if (fnmatch((char *)fo->wild.get(k), ff->fname, 0) == 0) {
-           ff->flags = fo->flags;
-           ff->GZIP_level = fo->GZIP_level;
            if (ff->flags & FO_EXCLUDE) {
               return false;          /* reject file */
            }
@@ -174,8 +176,6 @@ static bool accept_file(FF_PKT *ff)
         const int nmatch = 30;
         regmatch_t pmatch[nmatch];
         if (regexec((regex_t *)fo->regex.get(k), ff->fname, nmatch, pmatch,  0) == 0) {
-           ff->flags = fo->flags;
-           ff->GZIP_level = fo->GZIP_level;
            if (ff->flags & FO_EXCLUDE) {
               return false;          /* reject file */
            }
index 1bf334c1250b5f78afb7dcbeb8607b103d0ca134..5ca69c57973392fb81348bc3ba2ad069e616462b 100755 (executable)
@@ -67,38 +67,38 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
  * Status codes returned by create_file()
  */
 enum {
-   CF_SKIP = 1,                      /* skip file (not newer or something) */
-   CF_ERROR,                         /* error creating file */
-   CF_EXTRACT,                       /* file created, data to extract */
-   CF_CREATED                        /* file created, no data to extract */
+   CF_SKIP = 1,                       /* skip file (not newer or something) */
+   CF_ERROR,                          /* error creating file */
+   CF_EXTRACT,                        /* file created, data to extract */
+   CF_CREATED                         /* file created, no data to extract */
 };
 
 
 /* Options saved int "options" of the include/exclude lists.
  * They are directly jammed ito  "flag" of ff packet 
  */
-#define FO_MD5         (1<<1)        /* Do MD5 checksum */
-#define FO_GZIP        (1<<2)        /* Do Zlib compression */
-#define FO_NO_RECURSION (1<<3)       /* no recursion in directories */
-#define FO_MULTIFS     (1<<4)        /* multiple file systems */
-#define FO_SPARSE      (1<<5)        /* do sparse file checking */
-#define FO_IF_NEWER    (1<<6)        /* replace if newer */
-#define FO_NOREPLACE   (1<<7)        /* never replace */
-#define FO_READFIFO    (1<<8)        /* read data from fifo */
-#define FO_SHA1        (1<<9)        /* Do SHA1 checksum */
-#define FO_PORTABLE    (1<<10)       /* Use portable data format -- no BackupWrite */
-#define FO_MTIMEONLY   (1<<11)       /* Use mtime rather than mtime & ctime */
-#define FO_KEEPATIME   (1<<12)       /* Reset access time */
-#define FO_EXCLUDE     (1<<13)       /* Exclude file */
-#define FO_ACL         (1<<14)         /* Backup ACLs */
+#define FO_MD5          (1<<1)        /* Do MD5 checksum */
+#define FO_GZIP         (1<<2)        /* Do Zlib compression */
+#define FO_NO_RECURSION (1<<3)        /* no recursion in directories */
+#define FO_MULTIFS      (1<<4)        /* multiple file systems */
+#define FO_SPARSE       (1<<5)        /* do sparse file checking */
+#define FO_IF_NEWER     (1<<6)        /* replace if newer */
+#define FO_NOREPLACE    (1<<7)        /* never replace */
+#define FO_READFIFO     (1<<8)        /* read data from fifo */
+#define FO_SHA1         (1<<9)        /* Do SHA1 checksum */
+#define FO_PORTABLE     (1<<10)       /* Use portable data format -- no BackupWrite */
+#define FO_MTIMEONLY    (1<<11)       /* Use mtime rather than mtime & ctime */
+#define FO_KEEPATIME    (1<<12)       /* Reset access time */
+#define FO_EXCLUDE      (1<<13)       /* Exclude file */
+#define FO_ACL          (1<<14)         /* Backup ACLs */
 
 struct s_included_file {
    struct s_included_file *next;
-   uint32_t options;                 /* backup options */
-   int level;                        /* compression level */
-   int len;                          /* length of fname */
-   int pattern;                      /* set if wild card pattern */
-   char VerifyOpts[20];              /* Options for verify */
+   uint32_t options;                  /* backup options */
+   int level;                         /* compression level */
+   int len;                           /* length of fname */
+   int pattern;                       /* set if wild card pattern */
+   char VerifyOpts[20];               /* Options for verify */
    char fname[1];
 };
 
@@ -113,7 +113,7 @@ struct s_excluded_file {
  *  of the structure are passed by the Director to the
  *  File daemon and recompiled back into this structure
  */
-#undef MAX_FOPTS 
+#undef  MAX_FOPTS 
 #define MAX_FOPTS 30
 
 enum {
@@ -125,20 +125,22 @@ enum {
 
 /* File options structure */
 struct findFOPTS {
-   uint32_t flags;                   /* options in bits */
-   int GZIP_level;                   /* GZIP level */
-   char VerifyOpts[MAX_FOPTS];       /* verify options */
-   alist regex;                      /* regex string(s) */
-   alist wild;                       /* wild card strings */
-   alist base;                       /* list of base names */
+   uint32_t flags;                    /* options in bits */
+   int GZIP_level;                    /* GZIP level */
+   char VerifyOpts[MAX_FOPTS];        /* verify options */
+   alist regex;                       /* regex string(s) */
+   alist wild;                        /* wild card strings */
+   alist base;                        /* list of base names */
+   char *reader;                      /* reader program */
+   char *writer;                      /* writer program */
 };
 
 
 /* This is either an include item or an exclude item */
 struct findINCEXE {
-   findFOPTS *current_opts;          /* points to current options structure */
-   alist opts_list;                  /* options list */
-   alist name_list;                  /* filename list -- holds char * */
+   findFOPTS *current_opts;           /* points to current options structure */
+   alist opts_list;                   /* options list */
+   alist name_list;                   /* filename list -- holds char * */
 };
 
 /* 
@@ -147,7 +149,7 @@ struct findINCEXE {
  */
 struct findFILESET {
    int state;
-   findINCEXE *incexe;               /* current item */
+   findINCEXE *incexe;                /* current item */
    alist include_list;
    alist exclude_list;
 };
@@ -158,22 +160,20 @@ struct findFILESET {
  * first argument to the find_files callback subroutine.
  */
 struct FF_PKT {
-   char *fname;                      /* filename */
-   char *link;                       /* link if file linked */
-   POOLMEM *sys_fname;               /* system filename */
-   struct stat statp;                /* stat packet */
-   int32_t FileIndex;                /* FileIndex of this file */
-   int32_t LinkFI;                   /* FileIndex of main hard linked file */
-   struct f_link *linked;            /* Set if this file is hard linked */
-   int type;                         /* FT_ type from above */
-   uint32_t flags;                   /* backup options */
-   int ff_errno;                     /* errno */
-   BFILE bfd;                        /* Bacula file descriptor */
-   time_t save_time;                 /* start of incremental time */
-   bool dereference;                 /* follow links (not implemented) */
-   bool null_output_device;          /* using null output device */
-   bool incremental;                 /* incremental save */
-   int GZIP_level;                   /* compression level */
+   char *fname;                       /* filename */
+   char *link;                        /* link if file linked */
+   POOLMEM *sys_fname;                /* system filename */
+   struct stat statp;                 /* stat packet */
+   int32_t FileIndex;                 /* FileIndex of this file */
+   int32_t LinkFI;                    /* FileIndex of main hard linked file */
+   struct f_link *linked;             /* Set if this file is hard linked */
+   int type;                          /* FT_ type from above */
+   int ff_errno;                      /* errno */
+   BFILE bfd;                         /* Bacula file descriptor */
+   time_t save_time;                  /* start of incremental time */
+   bool dereference;                  /* follow links (not implemented) */
+   bool null_output_device;           /* using null output device */
+   bool incremental;                  /* incremental save */
    char VerifyOpts[20];
    struct s_included_file *included_files_list;
    struct s_excluded_file *excluded_files_list;
@@ -181,8 +181,14 @@ struct FF_PKT {
    findFILESET *fileset;
    int (*callback)(FF_PKT *, void *); /* User's callback */
 
+   /* Values set by accept_file while processing Options */  
+   uint32_t flags;                    /* backup options */
+   int GZIP_level;                    /* compression level */
+   char *reader;                      /* reader program */
+   char *writer;                      /* writer program */
+
    /* List of all hard linked files found */
-   struct f_link *linklist;          /* hard linked files */
+   struct f_link *linklist;           /* hard linked files */
 };
 
 
index 58272bbe6f00d7938643d35430820c230413efc6..ca87ab7bb432f5ee4a6ca92142dc21b0670fc63f 100644 (file)
@@ -671,7 +671,7 @@ static BSOCK *bnet_open(JCR * jcr, const char *name, char *host, char *service,
 
    foreach_dlist(ipaddr, addr_list) {
       ipaddr->set_port(htons(port));
-      char allbuf[256 * addr_list->size()];
+      char allbuf[256 * 10];
       char curbuf[256];
       Dmsg2(100, "Current %sAll %s\n", 
                   ipaddr->build_address_str(curbuf, sizeof(curbuf)), 
index 6f8e38e1b1bf0def2a2b62801e1888f3cffa5ddf..aafd216ea7d017e5fd3a0c5ec93ce740303143ff 100644 (file)
@@ -83,7 +83,7 @@ bnet_thread_server(dlist *addrs, int max_clients, workq_t *client_wq,
    char buf[128];
    dlist sockfds;
 
-   char allbuf[256 * addrs->size()];
+   char allbuf[256 * 10];
    Dmsg1(100, "Addresses %s\n", build_addresses_str(addrs, allbuf, sizeof(allbuf)));
 
    foreach_dlist(p, addrs) {
index 337279271785d2b00e1be4f6274394c70fd19d67..de9c98951f587ca38469444a20ec8fc4ee215304 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2002-2004 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index ee1d3b01d3297f5f29c3487fbedfaf73af85488d..ac93adabdc91f6adfeb6693a098861f8f425b7b7 100644 (file)
@@ -40,6 +40,7 @@ ALL : "$(OUTDIR)\bacula-fd.exe"
 
 
 CLEAN :
+        -@erase "$(INTDIR)\address_conf.obj"
         -@erase "$(INTDIR)\alist.obj"
         -@erase "$(INTDIR)\alloc.obj"
         -@erase "$(INTDIR)\attr.obj"
@@ -127,6 +128,7 @@ BSC32_SBRS= \
 LINK32=link.exe
 LINK32_FLAGS=user32.lib advapi32.lib gdi32.lib wsock32.lib shell32.lib pthreadVCE.lib zlib.lib /nologo /subsystem:windows /pdb:none /machine:I386 /nodefaultlib:"MSVCRT.lib" /out:"$(OUTDIR)\bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" 
 LINK32_OBJS= \
+        "$(INTDIR)\address_conf.obj" \
         "$(INTDIR)\alist.obj" \
         "$(INTDIR)\alloc.obj" \
         "$(INTDIR)\attr.obj" \
@@ -217,6 +219,8 @@ ALL : "$(OUTDIR)\bacula-fd.exe" "$(OUTDIR)\baculafd.bsc"
 
 
 CLEAN :
+        -@erase "$(INTDIR)\address_conf.obj"
+        -@erase "$(INTDIR)\address_conf.sbr"
         -@erase "$(INTDIR)\alist.obj"
         -@erase "$(INTDIR)\alist.sbr"
         -@erase "$(INTDIR)\alloc.obj"
@@ -373,6 +377,7 @@ RSC_PROJ=/l 0x409 /fo"$(INTDIR)\winres.res" /d "_DEBUG"
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\baculafd.bsc" 
 BSC32_SBRS= \
+        "$(INTDIR)\address_conf.sbr" \
         "$(INTDIR)\alist.sbr" \
         "$(INTDIR)\alloc.sbr" \
         "$(INTDIR)\attr.sbr" \
@@ -453,6 +458,7 @@ BSC32_SBRS= \
 LINK32=link.exe
 LINK32_FLAGS=user32.lib advapi32.lib gdi32.lib shell32.lib wsock32.lib pthreadVCE.lib zlib.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"MSVCRT.lib" /out:"$(OUTDIR)\bacula-fd.exe" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" 
 LINK32_OBJS= \
+        "$(INTDIR)\address_conf.obj" \
         "$(INTDIR)\alist.obj" \
         "$(INTDIR)\alloc.obj" \
         "$(INTDIR)\attr.obj" \
@@ -574,6 +580,25 @@ LINK32_OBJS= \
 
 
 !IF "$(CFG)" == "baculafd - Win32 Release" || "$(CFG)" == "baculafd - Win32 Debug"
+
+SOURCE=..\lib\address_conf.cpp
+
+!IF  "$(CFG)" == "baculafd - Win32 Release"
+
+
+"$(INTDIR)\address_conf.obj" : $(SOURCE) "$(INTDIR)"
+        $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF  "$(CFG)" == "baculafd - Win32 Debug"
+
+
+"$(INTDIR)\address_conf.obj"   "$(INTDIR)\address_conf.sbr" : $(SOURCE) "$(INTDIR)"
+        $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF 
+
 SOURCE=..\lib\alist.cpp
 
 !IF  "$(CFG)" == "baculafd - Win32 Release"
@@ -592,6 +617,7 @@ SOURCE=..\lib\alist.cpp
 
 !ENDIF 
 
+
 SOURCE=..\lib\alloc.cpp
 
 !IF  "$(CFG)" == "baculafd - Win32 Release"
index 5ac8c61c938d00b104ef1197b6af55a69c83cd99..d9715ff19bf946e2e22ab6f07f90b9d3465a3a4f 100644 (file)
@@ -40,6 +40,7 @@ ALL : "$(OUTDIR)\bconsole.exe" "$(OUTDIR)\console.pch"
 
 
 CLEAN :
+        -@erase "$(INTDIR)\address_conf.obj"
         -@erase "$(INTDIR)\alist.obj"
         -@erase "$(INTDIR)\authenticate.obj"
         -@erase "$(INTDIR)\base64.obj"
@@ -89,6 +90,7 @@ BSC32_SBRS= \
 LINK32=link.exe
 LINK32_FLAGS=wsock32.lib pthreadVCE.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"$(OUTDIR)\bconsole.exe" /libpath:"../../../../depkgs-win32/pthreads" 
 LINK32_OBJS= \
+        "$(INTDIR)\address_conf.obj" \
         "$(INTDIR)\alist.obj" \
         "$(INTDIR)\authenticate.obj" \
         "$(INTDIR)\base64.obj" \
@@ -141,6 +143,7 @@ ALL : "$(OUTDIR)\bconsole.exe" "$(OUTDIR)\console.pch"
 
 
 CLEAN :
+        -@erase "$(INTDIR)\address_conf.obj"
         -@erase "$(INTDIR)\alist.obj"
         -@erase "$(INTDIR)\authenticate.obj"
         -@erase "$(INTDIR)\base64.obj"
@@ -191,6 +194,7 @@ BSC32_SBRS= \
 LINK32=link.exe
 LINK32_FLAGS=wsock32.lib pthreadVCE.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"$(OUTDIR)\bconsole.exe" /libpath:"../../../../depkgs-win32/pthreads" 
 LINK32_OBJS= \
+        "$(INTDIR)\address_conf.obj" \
         "$(INTDIR)\alist.obj" \
         "$(INTDIR)\authenticate.obj" \
         "$(INTDIR)\base64.obj" \
@@ -274,12 +278,19 @@ LINK32_OBJS= \
 
 
 !IF "$(CFG)" == "console - Win32 Release" || "$(CFG)" == "console - Win32 Debug"
+
+SOURCE=..\lib\address_conf.cpp
+
+"$(INTDIR)\address_conf.obj" : $(SOURCE) "$(INTDIR)"
+        $(CPP) $(CPP_PROJ) $(SOURCE)
+
 SOURCE=..\lib\alist.cpp
 
 "$(INTDIR)\alist.obj" : $(SOURCE) "$(INTDIR)"
         $(CPP) $(CPP_PROJ) $(SOURCE)
 
 
+
 SOURCE=.\authenticate.cpp
 
 "$(INTDIR)\authenticate.obj" : $(SOURCE) "$(INTDIR)"
diff --git a/bacula/src/win32/lib/address_conf.cpp b/bacula/src/win32/lib/address_conf.cpp
new file mode 100755 (executable)
index 0000000..7cc33e1
--- /dev/null
@@ -0,0 +1 @@
+#include "../../lib/address_conf.c"
index aa737be66b3fced59faca05534649967907ef86d..82362c37ba1a9f0461b640e22562c847d546dba7 100644 (file)
@@ -1,3 +1,4 @@
+..\lib\address_conf
 ..\lib\alist
 ..\lib\alloc
 ..\lib\attr
index ec3a9a2cf54c4368274c89e0462670f2c757835f..10d867ad132d33189cf012199cb634a010566365 100644 (file)
@@ -40,6 +40,7 @@ ALL : "$(OUTDIR)\wx-console.exe"
 
 
 CLEAN :
+       -@erase "$(INTDIR)\address_conf.obj"
        -@erase "$(INTDIR)\alist.obj"
        -@erase "$(INTDIR)\alloc.obj"
        -@erase "$(INTDIR)\attr.obj"
@@ -113,6 +114,7 @@ LINK32_FLAGS=wxmsw.lib rpcrt4.lib oleaut32.lib ole32.lib uuid.lib winspool.lib w
   wldap32.lib pthreadVCE.lib zlib.lib /nodefaultlib:libcmt.lib \
   /nologo /subsystem:windows /machine:I386 /out:"$(OUTDIR)\wx-console.exe" /libpath:"../../../../depkgs-win32/wx/lib" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" 
 LINK32_OBJS= \
+       "$(INTDIR)\address_conf.obj" \
        "$(INTDIR)\alist.obj" \
        "$(INTDIR)\alloc.obj" \
        "$(INTDIR)\attr.obj" \
@@ -187,6 +189,8 @@ OutDir=.\Debug
 ALL : "$(OUTDIR)\wx-console.exe" "$(OUTDIR)\wx-console.bsc"
 
 CLEAN :
+       -@erase "$(INTDIR)\address_conf.obj
+       -@erase "$(INTDIR)\address_conf.sbr"
        -@erase "$(INTDIR)\alist.obj
        -@erase "$(INTDIR)\alist.sbr"
        -@erase "$(INTDIR)\alloc.obj
@@ -311,6 +315,7 @@ RSC_PROJ=/l 0x409 /fo"$(INTDIR)\winres.res" /d "_DEBUG"
 BSC32=bscmake.exe
 BSC32_FLAGS=/nologo /o"$(OUTDIR)\wx-console.bsc" 
 BSC32_SBRS= \
+       "$(INTDIR)\address_conf.sbr" \
        "$(INTDIR)\alist.sbr" \
        "$(INTDIR)\alloc.sbr" \
        "$(INTDIR)\attr.sbr" \
@@ -379,6 +384,7 @@ LINK32_FLAGS=wxmswd.lib rpcrt4.lib oleaut32.lib ole32.lib uuid.lib winspool.lib
   wldap32.lib pthreadVCE.lib zlib.lib /nodefaultlib:libcmtd.lib \
   /nologo /subsystem:windows /pdb:none /debug /machine:I386 /out:"$(OUTDIR)\wx-console.exe" /libpath:"../../../../depkgs-win32/wx/lib" /libpath:"../../../../depkgs-win32/pthreads" /libpath:"../../../../depkgs-win32/zlib" 
 LINK32_OBJS= \
+       "$(INTDIR)\address_conf.obj" \
        "$(INTDIR)\alist.obj" \
        "$(INTDIR)\alloc.obj" \
        "$(INTDIR)\attr.obj" \
@@ -488,6 +494,25 @@ SOURCE=..\..\wx-console\wx-console_private.rc
 "$(INTDIR)\wx-console_private.res" : $(SOURCE) "$(INTDIR)"
         $(RSC) /l 0x409 /fo"$(INTDIR)\wx-console_private.res" /d "NDEBUG" $(SOURCE)
 
+FILENAME=address_conf
+SOURCE=..\lib\address_conf.cpp
+!IF  "$(CFG)" == "wx-console - Win32 Release"
+
+
+"$(INTDIR)\$(FILENAME).obj" : $(SOURCE) "$(INTDIR)"
+       $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF  "$(CFG)" == "wx-console - Win32 Debug"
+
+
+"$(INTDIR)\$(FILENAME).obj"    "$(INTDIR)\$(FILENAME).sbr" : $(SOURCE) "$(INTDIR)"
+       $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF 
+
+
 FILENAME=alist
 SOURCE=..\lib\alist.cpp
 !IF  "$(CFG)" == "wx-console - Win32 Release"