CONRES *cons; /* console resource */
POOLMEM *cmd; /* return command/name buffer */
POOLMEM *args; /* command line arguments */
+ POOLMEM *err; /* store error message */
char *argk[MAX_CMD_ARGS]; /* argument keywords */
char *argv[MAX_CMD_ARGS]; /* argument values */
int argc; /* number of arguments */
if (strcasecmp(ua->argk[i], NT_("allpools")) == 0) {
allpools = true;
- } else if (strcasecmp(ua->argk[i], NT_("volume")) == 0 && ua->argv[i]) {
+ } else if (strcasecmp(ua->argk[i], NT_("volume")) == 0
+ && is_name_valid(ua->argv[i], NULL)) {
bstrncpy(mr.VolumeName, ua->argv[i], sizeof(mr.VolumeName));
- } else if (strcasecmp(ua->argk[i], NT_("devicetype")) == 0 && ua->argv[i]) {
+ } else if (strcasecmp(ua->argk[i], NT_("devicetype")) == 0
+ && ua->argv[i]) {
bstrncpy(mr.MediaType, ua->argv[i], sizeof(mr.MediaType));
} else if (strcasecmp(ua->argk[i], NT_("drive")) == 0 && ua->argv[i]) {
drive = atoi(ua->argv[i]);
- } else if (strcasecmp(ua->argk[i], NT_("action")) == 0 && ua->argv[i]) {
+ } else if (strcasecmp(ua->argk[i], NT_("action")) == 0
+ && is_name_valid(ua->argv[i], NULL)) {
action=ua->argv[i];
}
}
i = find_arg_with_value(ua, NT_("backupclient"));
}
if (i >= 0) {
- if (!has_value(ua, i)) {
+ if (!is_name_valid(ua->argv[i], &ua->err)) {
+ ua->error_msg("%s argument: %s", ua->argk[i], ua->err);
return 0;
}
bstrncpy(rx->ClientName, ua->argv[i], sizeof(rx->ClientName));
/* try command line argument */
int i = find_arg_with_value(ua, NT_("restoreclient"));
if (i >= 0) {
- if (!has_value(ua, i)) {
+ if (!is_name_valid(ua->argv[i], &ua->err)) {
+ ua->error_msg("%s argument: %s", ua->argk[i], ua->err);
return 0;
}
bstrncpy(rx.RestoreClientName, ua->argv[i], sizeof(rx.RestoreClientName));
*/
memset(&fsr, 0, sizeof(fsr));
i = find_arg_with_value(ua, "FileSet");
- if (i >= 0) {
+
+ if (i >= 0 && is_name_valid(ua->argv[i], &ua->err)) {
bstrncpy(fsr.FileSet, ua->argv[i], sizeof(fsr.FileSet));
if (!db_get_fileset_record(ua->jcr, ua->db, &fsr)) {
ua->error_msg(_("Error getting FileSet \"%s\": ERR=%s\n"), fsr.FileSet,
db_strerror(ua->db));
i = -1;
}
+ } else if (i >= 0) { /* name is invalid */
+ ua->error_msg(_("FileSet argument: %s\n"), ua->err);
}
+
if (i < 0) { /* fileset not found */
edit_int64(cr.ClientId, ed1);
Mmsg(rx->query, uar_sel_fileset, ed1, ed1);