many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
modify it under the terms of version two of the GNU General Public
- License as published by the Free Software Foundation plus additions
- that are listed in the file LICENSE.
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
*/
int run_cmd(UAContext *ua, const char *cmd)
{
- JCR *jcr;
+ JCR *jcr = NULL;
run_ctx rc;
int i, opt;
return 0;
}
+ if (find_arg(ua, NT_("fdcalled")) > 0) {
+ jcr->file_bsock = dup_bsock(ua->UA_sock);
+ ua->quit = true;
+ }
+
+try_again:
/*
* Create JCR to run job. NOTE!!! after this point, free_jcr()
* before returning.
*/
- jcr = new_jcr(sizeof(JCR), dird_free_jcr);
- set_jcr_defaults(jcr, rc.job);
- jcr->unlink_bsr = ua->jcr->unlink_bsr; /* copy unlink flag from caller */
- ua->jcr->unlink_bsr = false;
+ if (!jcr) {
+ jcr = new_jcr(sizeof(JCR), dird_free_jcr);
+ set_jcr_defaults(jcr, rc.job);
+ jcr->unlink_bsr = ua->jcr->unlink_bsr; /* copy unlink flag from caller */
+ ua->jcr->unlink_bsr = false;
+ }
jcr->verify_job = rc.verify_job;
jcr->previous_job = rc.previous_job;
pm_strcpy(jcr->client_name, rc.client->name());
jcr->fileset = rc.fileset;
jcr->ExpectedFiles = rc.files;
- if (rc.catalog != NULL) {
+ if (rc.catalog) {
jcr->catalog = rc.catalog;
}
if (rc.where) {
free(jcr->where);
}
jcr->where = bstrdup(rc.where);
+ rc.where = NULL;
}
if (rc.regexwhere) {
free(jcr->RegexWhere);
}
jcr->RegexWhere = bstrdup(rc.regexwhere);
+ rc.regexwhere = NULL;
}
if (rc.when) {
ua->send_msg(_("Invalid time, using current time.\n"));
jcr->sched_time = time(NULL);
}
+ rc.when = NULL;
}
if (rc.bootstrap) {
free(jcr->RestoreBootstrap);
}
jcr->RestoreBootstrap = bstrdup(rc.bootstrap);
+ rc.bootstrap = NULL;
}
if (rc.replace) {
} else {
jcr->replace = REPLACE_ALWAYS;
}
+ rc.replace = NULL;
if (rc.Priority) {
jcr->JobPriority = rc.Priority;
+ rc.Priority = 0;
}
if (rc.since) {
jcr->stime = get_pool_memory(PM_MESSAGE);
}
pm_strcpy(jcr->stime, rc.since);
+ rc.since = NULL;
}
- jcr->cloned = rc.cloned;
-
- if (find_arg(ua, NT_("fdcalled")) > 0) {
- jcr->file_bsock = dup_bsock(ua->UA_sock);
- ua->quit = true;
+ if (rc.cloned) {
+ jcr->cloned = rc.cloned;
+ rc.cloned = false;
}
-try_again:
+
/* If pool changed, update migration write storage */
if (jcr->JobType == JT_MIGRATE) {
if (!set_migration_wstorage(jcr, rc.pool)) {
ua->send_msg(_("Level %s not valid.\n"), rc.level_name);
goto bail_out;
}
+ rc.level_name = NULL;
}
if (rc.jid) {
/* Note, this is also MigrateJobId */
jcr->RestoreJobId = str_to_int64(rc.jid);
+ rc.jid = 0;
}
/* Run without prompting? */
goto bail_out;
}
- if (ua->cmd[0] == '.' && strncasecmp(ua->cmd, ".mod ", 5) == 0) {
+ if (strncasecmp(ua->cmd, ".mod ", 5) == 0 ||
+ (strncasecmp(ua->cmd, "mod ", 4) == 0 && strlen(ua->cmd) > 6)) {
Dmsg1(000, "got: %s\n", ua->cmd);
parse_ua_args(ua);
rc.mod = true;
}
if (!rc.store->store) {
ua->error_msg(_("No storage specified.\n"));
- return true;
+ return false;
} else if (!acl_access_ok(ua, Storage_ACL, rc.store->store->name())) {
ua->error_msg(_("No authorization. Storage \"%s\".\n"),
rc.store->store->name());