]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/dird_conf.c
Minor tweaks to Migration
[bacula/bacula] / bacula / src / dird / dird_conf.c
index 9eedba0e6f9113abf8437228dfb1b221d5ab2bd8..8cbf3e3febe04abae04dcd152bc2b6b95e527729 100644 (file)
@@ -72,7 +72,13 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass);
  * then move it to allocated memory when the resource
  * scan is complete.
  */
+#if defined(_MSC_VER)
+extern "C" { // work around visual compiler mangling variables
+    URES res_all;
+}
+#else
 URES res_all;
+#endif
 int  res_all_size = sizeof(res_all);
 
 
@@ -657,6 +663,15 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          for (j=0; j<incexe->num_opts; j++) {
             FOPTS *fo = incexe->opts_list[j];
             sendit(sock, "      O %s\n", fo->opts);
+
+            bool enhanced_wild = false;
+            for (k=0; fo->opts[k]!='\0'; k++) {
+               if (fo->opts[k]=='W') {
+                  enhanced_wild = true;
+                  break;
+               }
+            }
+
             for (k=0; k<fo->regex.size(); k++) {
                sendit(sock, "      R %s\n", fo->regex.get(k));
             }
@@ -675,12 +690,18 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
             for (k=0; k<fo->wildfile.size(); k++) {
                sendit(sock, "      WF %s\n", fo->wildfile.get(k));
             }
+            for (k=0; k<fo->wildbase.size(); k++) {
+               sendit(sock, "      W%c %s\n", enhanced_wild ? 'B' : 'F', fo->wildbase.get(k));
+            }
             for (k=0; k<fo->base.size(); k++) {
                sendit(sock, "      B %s\n", fo->base.get(k));
             }
             for (k=0; k<fo->fstype.size(); k++) {
                sendit(sock, "      X %s\n", fo->fstype.get(k));
             }
+            for (k=0; k<fo->drivetype.size(); k++) {
+               sendit(sock, "      XD %s\n", fo->drivetype.get(k));
+            }
             if (fo->reader) {
                sendit(sock, "      D %s\n", fo->reader);
             }
@@ -860,8 +881,10 @@ static void free_incexe(INCEXE *incexe)
       fopt->wild.destroy();
       fopt->wilddir.destroy();
       fopt->wildfile.destroy();
+      fopt->wildbase.destroy();
       fopt->base.destroy();
       fopt->fstype.destroy();
+      fopt->drivetype.destroy();
       if (fopt->reader) {
          free(fopt->reader);
       }
@@ -1541,6 +1564,8 @@ void store_acl(LEX *lc, RES_ITEM *item, int index, int pass)
    set_bit(index, res_all.hdr.item_present);
 }
 
+/* We build RunScripts items here */
+static RUNSCRIPT res_runscript;
 
 /* Store a runscript->when in a bit field */
 static void store_runscript_when(LEX *lc, RES_ITEM *item, int index, int pass)
@@ -1609,6 +1634,8 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
 
       script->set_command(lc->str);
 
+      /* TODO: remove all script->old_proto with bacula 1.42 */
+
       if (strcmp(item->name, "runbeforejob") == 0) {
          script->when = SCRIPT_Before;
          script->abort_on_error = true;
@@ -1619,12 +1646,14 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
          script->on_failure = false;
          
       } else if (strcmp(item->name, "clientrunafterjob") == 0) {
+         script->old_proto = true;
          script->when = SCRIPT_After;
          script->set_target("%c");
          script->on_success = true;
          script->on_failure = false;
 
       } else if (strcmp(item->name, "clientrunbeforejob") == 0) {
+         script->old_proto = true;
          script->when = SCRIPT_Before;
          script->set_target("%c");
          script->abort_on_error = true;
@@ -1646,20 +1675,18 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass)
    scan_to_eol(lc);
 }
 
-static RUNSCRIPT  res_runscript;
-
 /*
  * new RunScript items
  *   name             handler         value                                code flags default_value
  */
 static RES_ITEM runscript_items[] = {
-   {"command", store_runscript_cmd,   ITEM(res_runscript),           0,  ITEM_REQUIRED, 0}, 
-   {"target", store_runscript_target, ITEM(res_runscript),            0,  0, 0}, 
-   {"runsonsuccess",    store_bool,   ITEM(res_runscript.on_success), 0,  0, 0},
-   {"runsonfailure",    store_bool,   ITEM(res_runscript.on_failure), 0,  0, 0},
-   {"abortjobonerror", store_bool,    ITEM(res_runscript.abort_on_error), 0, 0,   0},
-   {"runswhen", store_runscript_when, ITEM(res_runscript.when),       0,  0, 0},
-   {"runsonclient", store_runscript_target, ITEM(res_runscript),       0,  0, 0}, /* TODO */
+   {"command", store_runscript_cmd,    {(char **)&res_runscript},           0,  ITEM_REQUIRED, 0}, 
+   {"target", store_runscript_target,  {(char **)&res_runscript},            0,  0, 0}, 
+   {"runsonsuccess",    store_bool,    {(char **)&res_runscript.on_success}, 0,  0, 0},
+   {"runsonfailure",    store_bool,    {(char **)&res_runscript.on_failure}, 0,  0, 0},
+   {"abortjobonerror", store_bool,     {(char **)&res_runscript.abort_on_error}, 0, 0,   0},
+   {"runswhen", store_runscript_when,  {(char **)&res_runscript.when},       0,  0, 0},
+   {"runsonclient", store_runscript_target,  {(char **)&res_runscript},       0,  0, 0}, /* TODO */
    {NULL, NULL, {0}, 0, 0, 0}
 };