]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/dird_conf.c
kes Fix Verify InitCatalog. The attributes were not pointing to the
[bacula/bacula] / bacula / src / dird / dird_conf.c
index c1b81bca152d8901d651181f3c2e8e0bd1f967f0..49951afe1dd26f5798b0f54551ed93cb911aa0c3 100644 (file)
@@ -615,12 +615,11 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm
          sendit(sock, _("  --> "));
          dump_resource(-R_SCHEDULE, (RES *)res->res_job.schedule, sendit, sock);
       }
-      if (res->res_job.RestoreWhere) {
-        if (res->res_job.where_use_regexp) {
-           sendit(sock, _("  --> RegexWhere=%s\n"), NPRT(res->res_job.RestoreWhere));
-        } else {
-           sendit(sock, _("  --> Where=%s\n"), NPRT(res->res_job.RestoreWhere));
-        }
+      if (res->res_job.RestoreWhere && !res->res_job.RegexWhere) {
+          sendit(sock, _("  --> Where=%s\n"), NPRT(res->res_job.RestoreWhere));
+      }
+      if (res->res_job.RegexWhere) {
+          sendit(sock, _("  --> RegexWhere=%s\n"), NPRT(res->res_job.RegexWhere));
       }
       if (res->res_job.RestoreBootstrap) {
          sendit(sock, _("  --> Bootstrap=%s\n"), NPRT(res->res_job.RestoreBootstrap));
@@ -1323,32 +1322,33 @@ void save_resource(int type, RES_ITEM *items, int pass)
          res->res_job.run_cmds   = res_all.res_job.run_cmds;
          res->res_job.RunScripts = res_all.res_job.RunScripts;
 
-        if (res->res_job.strip_prefix ||
-            res->res_job.add_suffix   ||
-            res->res_job.add_prefix)
+        /* TODO: JobDefs where/regexwhere doesn't work well (but this
+         * is not very useful) 
+         * We have to set_bit(index, res_all.hdr.item_present);
+         * or something like that
+         */
+
+         /* we take RegexWhere before all other options */
+        if (!res->res_job.RegexWhere 
+            &&
+            (res->res_job.strip_prefix ||
+             res->res_job.add_suffix   ||
+             res->res_job.add_prefix))
         {
-           if (res->res_job.RestoreWhere) {
-              free(res->res_job.RestoreWhere);
-           }
            int len = bregexp_get_build_where_size(res->res_job.strip_prefix,
                                                   res->res_job.add_prefix,
                                                   res->res_job.add_suffix);
-           res->res_job.RestoreWhere = (char *) bmalloc (len * sizeof(char));
-           bregexp_build_where(res->res_job.RestoreWhere, len,
+           res->res_job.RegexWhere = (char *) bmalloc (len * sizeof(char));
+           bregexp_build_where(res->res_job.RegexWhere, len,
                                res->res_job.strip_prefix,
                                res->res_job.add_prefix,
                                res->res_job.add_suffix);
-           res->res_job.where_use_regexp = true;
-
            /* TODO: test bregexp */
         }
 
-        if (res->res_job.RegexWhere) {
-           if (res->res_job.RestoreWhere) {
-              free(res->res_job.RestoreWhere);
-           }
-           res->res_job.RestoreWhere = bstrdup(res->res_job.RegexWhere);
-           res->res_job.where_use_regexp = true;
+        if (res->res_job.RegexWhere && res->res_job.RestoreWhere) {
+           free(res->res_job.RestoreWhere);
+           res->res_job.RestoreWhere = NULL;
         }
 
          break;