Skip to content

Commit

Permalink
Allow restoreoptions to be specified with restore.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent e59ba5d commit 67190b1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/dird/ua.h
Expand Up @@ -117,6 +117,7 @@ struct RESTORE_CTX {
char *where;
char *RegexWhere;
char *replace;
char *plugin_options;
RBSR *bsr;
POOLMEM *fname; /* Filename only */
POOLMEM *path; /* Path only */
Expand Down
12 changes: 12 additions & 0 deletions src/dird/ua_restore.c
Expand Up @@ -109,6 +109,11 @@ int restore_cmd(UAContext *ua, const char *cmd)
rx.replace = ua->argv[i];
}

i = find_arg_with_value(ua, "pluginoptions");
if (i >= 0) {
rx.plugin_options = ua->argv[i];
}

i = find_arg_with_value(ua, "strip_prefix");
if (i >= 0) {
strip_prefix = ua->argv[i];
Expand Down Expand Up @@ -270,6 +275,11 @@ int restore_cmd(UAContext *ua, const char *cmd)
pm_strcat(ua->cmd, buf);
}

if (rx.plugin_options) {
Mmsg(buf, " pluginoptions=%s", rx.plugin_options);
pm_strcat(ua->cmd, buf);
}

if (rx.comment) {
Mmsg(buf, " comment=\"%s\"", rx.comment);
pm_strcat(ua->cmd, buf);
Expand All @@ -290,6 +300,7 @@ int restore_cmd(UAContext *ua, const char *cmd)
if (find_arg(ua, NT_("yes")) > 0) {
pm_strcat(ua->cmd, " yes"); /* pass it on to the run command */
}

Dmsg1(200, "Submitting: %s\n", ua->cmd);

/*
Expand Down Expand Up @@ -506,6 +517,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
"comment", /* 21 */
"restorejob", /* 22 */
"replace", /* 23 */
"pluginoptions", /* 24 */
NULL
};

Expand Down
2 changes: 1 addition & 1 deletion src/dird/ua_run.c
Expand Up @@ -1826,7 +1826,7 @@ static bool scan_command_line_arguments(UAContext *ua, RUN_CTX &rc)
}
rc.plugin_options = ua->argv[i];
if (!acl_access_ok(ua, PluginOptions_ACL, rc.plugin_options)) {
ua->send_msg(_("No authoriztion for \"PluginOptions\" specification.\n"));
ua->send_msg(_("No authorization for \"PluginOptions\" specification.\n"));
return false;
}
kw_ok = true;
Expand Down

0 comments on commit 67190b1

Please sign in to comment.