X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fua_restore.c;h=67f4f3fa727e4b8a44bdd394c826df9a5d761feb;hb=369727090d4c5ca6f9b258c037ae6d6df5d49d5a;hp=49176f92fd281b2a7226ffa1cf3cdecf911df322;hpb=23d83d520ed254b08fcf836a28f9847918bdcde7;p=bacula%2Fbacula diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 49176f92fd..67f4f3fa72 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -371,7 +371,8 @@ static int get_client_name(UAContext *ua, RESTORE_CTX *rx) i = find_arg_with_value(ua, NT_("backupclient")); } if (i >= 0) { - if (!has_value(ua, i)) { + if (!is_name_valid(ua->argv[i], &ua->errmsg)) { + ua->error_msg("%s argument: %s", ua->argk[i], ua->errmsg); return 0; } bstrncpy(rx->ClientName, ua->argv[i], sizeof(rx->ClientName)); @@ -397,7 +398,8 @@ static int get_restore_client_name(UAContext *ua, RESTORE_CTX &rx) /* 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->errmsg)) { + ua->error_msg("%s argument: %s", ua->argk[i], ua->errmsg); return 0; } bstrncpy(rx.RestoreClientName, ua->argv[i], sizeof(rx.RestoreClientName)); @@ -1276,14 +1278,18 @@ static bool select_backups_before_date(UAContext *ua, RESTORE_CTX *rx, char *dat */ 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->errmsg)) { 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->errmsg); } + if (i < 0) { /* fileset not found */ edit_int64(cr.ClientId, ed1); Mmsg(rx->query, uar_sel_fileset, ed1, ed1);