/*
Bacula(R) - The Network Backup Solution
- Copyright (C) 2000-2015 Kern Sibbald
- Copyright (C) 2000-2014 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2016 Kern Sibbald
The original author of Bacula is Kern Sibbald, with contributions
from many others, a complete list can be found in the file AUTHORS.
{"DbName", store_str, ITEM(res_cat.db_name), 0, ITEM_REQUIRED, 0},
{"dbdriver", store_str, ITEM(res_cat.db_driver), 0, 0, 0},
{"DbSocket", store_str, ITEM(res_cat.db_socket), 0, 0, 0},
+ {"dbsslkey", store_str, ITEM(res_cat.db_ssl_key), 0, 0, 0},
+ {"dbsslcert", store_str, ITEM(res_cat.db_ssl_cert), 0, 0, 0},
+ {"dbsslca", store_str, ITEM(res_cat.db_ssl_ca), 0, 0, 0},
+ {"dbsslcapath", store_str, ITEM(res_cat.db_ssl_capath), 0, 0, 0},
+ {"dbsslcipher", store_str, ITEM(res_cat.db_ssl_cipher), 0, 0, 0},
/* Turned off for the moment */
{"MultipleConnections", store_bit, ITEM(res_cat.mult_db_connections), 0, 0, 0},
{"DisableBatchInsert", store_bool, ITEM(res_cat.disable_batch_insert), 0, ITEM_DEFAULT, false},
{"SpoolSize", store_size64, ITEM(res_job.spool_size), 0, 0, 0},
{"ReRunFailedLevels", store_bool, ITEM(res_job.rerun_failed_levels), 0, ITEM_DEFAULT, false},
{"PreferMountedVolumes", store_bool, ITEM(res_job.PreferMountedVolumes), 0, ITEM_DEFAULT, true},
- {"runbeforejob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
- {"runafterjob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
- {"runafterfailedjob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
- {"clientrunbeforejob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
- {"clientrunafterjob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"RunBeforeJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"RunAfterJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"RunAfterFailedJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"ClientRunBeforeJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"ClientRunAfterJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"ConsoleRunBeforeJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
+ {"ConsoleRunAfterJob", store_short_runscript, ITEM(res_job.RunScripts), 0, 0, 0},
{"Runscript", store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0},
{"MaximumConcurrentJobs", store_pint32, ITEM(res_job.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
{"MaximumSpawnedJobs", store_pint32, ITEM(res_job.MaxSpawnedJobs), 0, ITEM_DEFAULT, 600},
if (res->res_job.JobType == JT_MIGRATE || res->res_job.JobType == JT_COPY) {
sendit(sock, _(" SelectionType=%d\n"), res->res_job.selection_type);
}
+ if (res->res_job.JobType == JT_RESTORE) {
+ sendit(sock, _(" PrefixLinks=%d\n"), res->res_job.PrefixLinks);
+ }
if (res->res_job.client) {
sendit(sock, _(" --> "));
dump_resource(-R_CLIENT, (RES *)res->res_job.client, sendit, sock);
if (res->res_cat.db_password) {
free(res->res_cat.db_password);
}
+ if (res->res_cat.db_ssl_key) {
+ free(res->res_cat.db_ssl_key);
+ }
+ if (res->res_cat.db_ssl_cert) {
+ free(res->res_cat.db_ssl_cert);
+ }
+ if (res->res_cat.db_ssl_ca) {
+ free(res->res_cat.db_ssl_ca);
+ }
+ if (res->res_cat.db_ssl_capath) {
+ free(res->res_cat.db_ssl_capath);
+ }
+ if (res->res_cat.db_ssl_cipher) {
+ free(res->res_cat.db_ssl_cipher);
+ }
break;
case R_FILESET:
if ((num=res->res_fs.num_includes)) {
for (i=0; items[i].name; i++) {
if (items[i].flags & ITEM_REQUIRED) {
if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) {
- Emsg2(M_ERROR_TERM, 0, _("%s item is required in %s resource, but not found.\n"),
- items[i].name, resources[rindex]);
+ Emsg2(M_ERROR_TERM, 0, _("\"%s\" directive is required in \"%s\" resource, but not found.\n"),
+ items[i].name, resources[rindex].name);
}
}
/* If this triggers, take a look at lib/parse_conf.h */
if (i >= MAX_RES_ITEMS) {
- Emsg1(M_ERROR_TERM, 0, _("Too many items in %s resource\n"), resources[rindex]);
+ Emsg1(M_ERROR_TERM, 0, _("Too many directive in \"%s\" resource\n"), resources[rindex].name);
}
}
} else if (type == R_JOB) {
*/
if (items[0].flags & ITEM_REQUIRED) {
if (!bit_is_set(0, res_all.res_dir.hdr.item_present)) {
- Emsg2(M_ERROR_TERM, 0, _("%s item is required in %s resource, but not found.\n"),
- items[0].name, resources[rindex]);
+ Emsg2(M_ERROR_TERM, 0, _("\"%s\" directive is required in \"%s\" resource, but not found.\n"),
+ items[0].name, resources[rindex].name);
}
}
}
} else {
RES *next, *last;
if (res->res_dir.hdr.name == NULL) {
- Emsg1(M_ERROR_TERM, 0, _("Name item is required in %s resource, but not found.\n"),
- resources[rindex]);
+ Emsg1(M_ERROR_TERM, 0, _("A Name directive is required in \"%s\" resource, but not found.\n"),
+ resources[rindex].name);
}
/* Add new res to end of chain */
for (last=next=res_head[rindex]; next; next=next->next) {
last = next;
if (strcmp(next->name, res->res_dir.hdr.name) == 0) {
Emsg2(M_ERROR_TERM, 0,
- _("Attempt to define second %s resource named \"%s\" is not permitted.\n"),
+ _("Attempt to define second \"%s\" resource named \"%s\" is not permitted.\n"),
resources[rindex].name, res->res_dir.hdr.name);
}
}
script->on_failure = false;
script->set_target("");
+ } else if (strcasecmp(item->name, "clientrunbeforejob") == 0) {
+ script->old_proto = true;
+ script->when = SCRIPT_Before;
+ script->set_target("%c");
+ script->fail_on_error = true;
+
} else if (strcasecmp(item->name, "clientrunafterjob") == 0) {
script->old_proto = true;
script->when = SCRIPT_After;
script->on_success = true;
script->on_failure = false;
- } else if (strcasecmp(item->name, "clientrunbeforejob") == 0) {
- script->old_proto = true;
+ } else if (strcasecmp(item->name, "consolerunbeforejob") == 0) {
script->when = SCRIPT_Before;
- script->set_target("%c");
+ script->set_target("");
script->fail_on_error = true;
+ script->set_command(NPRT(script->command), CONSOLE_CMD);
+
+ } else if (strcasecmp(item->name, "consolerunafterjob") == 0) {
+ script->when = SCRIPT_After;
+ script->set_target("");
+ script->on_success = true;
+ script->on_failure = false;
+ script->set_command(NPRT(script->command), CONSOLE_CMD);
} else if (strcasecmp(item->name, "runafterfailedjob") == 0) {
script->when = SCRIPT_After;
{
static char yes[] = "yes";
static char no[] = "no";
+ static char nothing[] = "";
+
+ if (jcr == NULL) {
+ return nothing;
+ }
switch (param[0]) {
case 'f':
if (jcr->fileset) {
}
break;
case 'h':
- if (jcr->client) {
+ if (jcr->client && jcr->client->address) {
return jcr->client->address;
}
break;
case 'C':
return jcr->cloned ? yes : no;
}
- return NULL;
+ return nothing;
}
bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code)