* 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);
{"tlskey", store_dir, ITEM(res_dir.tls_keyfile), 0, 0, 0},
{"tlsdhfile", store_dir, ITEM(res_dir.tls_dhfile), 0, 0, 0},
{"tlsallowedcn", store_alist_str, ITEM(res_dir.tls_allowed_cns), 0, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/*
{"tlskey", store_dir, ITEM(res_con.tls_keyfile), 0, 0, 0},
{"tlsdhfile", store_dir, ITEM(res_con.tls_dhfile), 0, 0, 0},
{"tlsallowedcn", store_alist_str, ITEM(res_con.tls_allowed_cns), 0, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
{"tlscacertificatedir", store_dir, ITEM(res_client.tls_ca_certdir), 0, 0, 0},
{"tlscertificate", store_dir, ITEM(res_client.tls_certfile), 0, 0, 0},
{"tlskey", store_dir, ITEM(res_client.tls_keyfile), 0, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/* Storage daemon resource
{"tlscacertificatedir", store_dir, ITEM(res_store.tls_ca_certdir), 0, 0, 0},
{"tlscertificate", store_dir, ITEM(res_store.tls_certfile), 0, 0, 0},
{"tlskey", store_dir, ITEM(res_store.tls_keyfile), 0, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/*
{"dbsocket", store_str, ITEM(res_cat.db_socket), 0, 0, 0},
/* Turned off for the moment */
{"multipleconnections", store_bit, ITEM(res_cat.mult_db_connections), 0, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/*
{"pool", store_res, ITEM(res_job.pool), R_POOL, ITEM_REQUIRED, 0},
{"fullbackuppool", store_res, ITEM(res_job.full_pool), R_POOL, 0, 0},
{"incrementalbackuppool", store_res, ITEM(res_job.inc_pool), R_POOL, 0, 0},
- {"differentialbackuppool", store_res, ITEM(res_job.dif_pool), R_POOL, 0, 0},
+ {"differentialbackuppool", store_res, ITEM(res_job.diff_pool), R_POOL, 0, 0},
{"client", store_res, ITEM(res_job.client), R_CLIENT, ITEM_REQUIRED, 0},
{"fileset", store_res, ITEM(res_job.fileset), R_FILESET, ITEM_REQUIRED, 0},
{"schedule", store_res, ITEM(res_job.schedule), R_SCHEDULE, 0, 0},
{"selectionpattern", store_str, ITEM(res_job.selection_pattern), 0, 0, 0},
{"selectiontype", store_migtype, ITEM(res_job.selection_type), 0, 0, 0},
{"runscript", store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/* FileSet resource
static RES_ITEM fs_items[] = {
{"name", store_name, ITEM(res_fs.hdr.name), 0, ITEM_REQUIRED, 0},
{"description", store_str, ITEM(res_fs.hdr.desc), 0, 0, 0},
- {"include", store_inc, NULL, 0, ITEM_NO_EQUALS, 0},
- {"exclude", store_inc, NULL, 1, ITEM_NO_EQUALS, 0},
+ {"include", store_inc, {0}, 0, ITEM_NO_EQUALS, 0},
+ {"exclude", store_inc, {0}, 1, ITEM_NO_EQUALS, 0},
{"ignorefilesetchanges", store_bool, ITEM(res_fs.ignore_fs_changes), 0, ITEM_DEFAULT, false},
{"enablevss", store_bool, ITEM(res_fs.enable_vss), 0, ITEM_DEFAULT, false},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/* Schedule -- see run_conf.c */
{"name", store_name, ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0},
{"description", store_str, ITEM(res_sch.hdr.desc), 0, 0, 0},
{"run", store_run, ITEM(res_sch.run), 0, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/* Pool resource
{"maximumvolumejobs", store_pint, ITEM(res_pool.MaxVolJobs), 0, 0, 0},
{"maximumvolumefiles", store_pint, ITEM(res_pool.MaxVolFiles), 0, 0, 0},
{"maximumvolumebytes", store_size, ITEM(res_pool.MaxVolBytes), 0, 0, 0},
- {"acceptanyvolume", store_bool, ITEM(res_pool.accept_any_volume), 0, ITEM_DEFAULT, true},
{"catalogfiles", store_bool, ITEM(res_pool.catalog_files), 0, ITEM_DEFAULT, true},
{"volumeretention", store_time, ITEM(res_pool.VolRetention), 0, ITEM_DEFAULT, 60*60*24*365},
{"volumeuseduration", store_time, ITEM(res_pool.VolUseDuration), 0, 0, 0},
{"storage", store_alist_res, ITEM(res_pool.storage), R_STORAGE, 0, 0},
{"autoprune", store_bool, ITEM(res_pool.AutoPrune), 0, ITEM_DEFAULT, true},
{"recycle", store_bool, ITEM(res_pool.Recycle), 0, ITEM_DEFAULT, true},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
/*
{"maximum", store_pint, ITEM(res_counter.MaxValue), 0, ITEM_DEFAULT, INT32_MAX},
{"wrapcounter", store_res, ITEM(res_counter.WrapCounter), R_COUNTER, 0, 0},
{"catalog", store_res, ITEM(res_counter.Catalog), R_CATALOG, 0, 0},
- {NULL, NULL, NULL, 0, 0, 0}
+ {NULL, NULL, {0}, 0, 0, 0}
};
sendit(sock, _(" --> "));
dump_resource(-R_POOL, (RES *)res->res_job.inc_pool, sendit, sock);
}
- if (res->res_job.dif_pool) {
+ if (res->res_job.diff_pool) {
sendit(sock, _(" --> "));
- dump_resource(-R_POOL, (RES *)res->res_job.dif_pool, sendit, sock);
+ dump_resource(-R_POOL, (RES *)res->res_job.diff_pool, sendit, sock);
}
if (res->res_job.verify_job) {
sendit(sock, _(" --> "));
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));
}
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);
}
case R_POOL:
sendit(sock, _("Pool: name=%s PoolType=%s\n"), res->res_pool.hdr.name,
res->res_pool.pool_type);
- sendit(sock, _(" use_cat=%d use_once=%d acpt_any=%d cat_files=%d\n"),
+ sendit(sock, _(" use_cat=%d use_once=%d cat_files=%d\n"),
res->res_pool.use_catalog, res->res_pool.use_volume_once,
- res->res_pool.accept_any_volume, res->res_pool.catalog_files);
+ res->res_pool.catalog_files);
sendit(sock, _(" max_vols=%d auto_prune=%d VolRetention=%s\n"),
res->res_pool.max_volumes, res->res_pool.AutoPrune,
edit_utime(res->res_pool.VolRetention, ed1, sizeof(ed1)));
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);
}
res->res_job.pool = res_all.res_job.pool;
res->res_job.full_pool = res_all.res_job.full_pool;
res->res_job.inc_pool = res_all.res_job.inc_pool;
- res->res_job.dif_pool = res_all.res_job.dif_pool;
+ res->res_job.diff_pool = res_all.res_job.diff_pool;
res->res_job.verify_job = res_all.res_job.verify_job;
res->res_job.jobdefs = res_all.res_job.jobdefs;
res->res_job.run_cmds = res_all.res_job.run_cmds;
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)
if (pass == 2) {
if (strcmp(lc->str, "%c") == 0) {
- ((RUNSCRIPT*) item->value)->set_target(lc->str);
+ ((RUNSCRIPT*) item->value)->set_target(lc->str);
} else if (strcmp(lc->str, "yes") == 0) {
- ((RUNSCRIPT*) item->value)->set_target("%c");
+ ((RUNSCRIPT*) item->value)->set_target("%c");
} else if (strcmp(lc->str, "no") == 0) {
- /* store nothing, run on director */
+ /* store nothing, run on director */
} else {
- RES *res = GetResWithName(R_CLIENT, lc->str);
- if (res == NULL) {
- scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"),
- lc->str, lc->line_no, lc->line);
- }
+ RES *res = GetResWithName(R_CLIENT, lc->str);
+ if (res == NULL) {
+ scan_err3(lc, _("Could not find config Resource %s referenced on line %d : %s\n"),
+ lc->str, lc->line_no, lc->line);
+ }
- ((RUNSCRIPT*) item->value)->set_target(lc->str);
+ ((RUNSCRIPT*) item->value)->set_target(lc->str);
}
}
scan_to_eol(lc);
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;
+ script->when = SCRIPT_Before;
+ script->abort_on_error = true;
} else if (strcmp(item->name, "runafterjob") == 0) {
- script->when = SCRIPT_After;
- script->on_success = true;
- script->on_failure = false;
-
+ script->when = SCRIPT_After;
+ script->on_success = true;
+ script->on_failure = false;
+
} else if (strcmp(item->name, "clientrunafterjob") == 0) {
- script->when = SCRIPT_After;
- script->set_target("%c");
- script->on_success = true;
- script->on_failure = false;
+ 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->when = SCRIPT_Before;
- script->set_target("%c");
- script->abort_on_error = true;
+ script->old_proto = true;
+ script->when = SCRIPT_Before;
+ script->set_target("%c");
+ script->abort_on_error = true;
} else if (strcmp(item->name, "runafterfailedjob") == 0) {
- script->when = SCRIPT_After;
- script->on_failure = true;
- script->on_success = false;
+ script->when = SCRIPT_After;
+ script->on_failure = true;
+ script->on_success = false;
}
if (*runscripts == NULL) {
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, (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, NULL, 0, 0, 0}
+ {"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}
};
/*
if (pass == 2) {
if (res_runscript.command == NULL) {
- scan_err2(lc, _("%s item is required in %s resource, but not found.\n"),
- "command", "runscript");
+ scan_err2(lc, _("%s item is required in %s resource, but not found.\n"),
+ "command", "runscript");
}
+
+ /* run on client by default */
+ if (res_runscript.target == NULL) {
+ res_runscript.set_target("%c");
+ }
+
RUNSCRIPT *script = new_runscript();
memcpy(script, &res_runscript, sizeof(RUNSCRIPT));