From 9da4a5fbd87c5aaef927d3fd4c8cc51b366329b9 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 20 Mar 2003 08:21:16 +0000 Subject: [PATCH] Escape filenames in restore command git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@387 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/ua_restore.c | 15 ++++++++++++--- bacula/src/stored/job.c | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 378b154e52..f41db51da6 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -160,13 +160,16 @@ int restorecmd(UAContext *ua, char *cmd) return 0; } - + /* + * Request user to select JobIds by various different methods + * last 20 jobs, where File saved, most recent backup, ... + */ if (!user_select_jobids(ua, &ji)) { return 0; } /* - * Build the directory tree + * Build the directory tree containing JobIds user selected */ tree.root = new_tree(ji.TotalFiles); tree.root->fname = nofname; @@ -314,11 +317,17 @@ static int user_select_jobids(UAContext *ua, JobIds *ji) done = 0; break; case 1: /* list where a file is saved */ + char *fname; + int len; if (!get_cmd(ua, _("Enter Filename: "))) { return 0; } + len = strlen(ua->cmd); + fname = (char *)malloc(len * 2 + 1); + db_escape_string(fname, ua->cmd, len); query = get_pool_memory(PM_MESSAGE); - Mmsg(&query, uar_file, ua->cmd); + Mmsg(&query, uar_file, fname); + free(fname); db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, 1); free_pool_memory(query); done = 0; diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index b05d5ec458..432238ee7b 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -44,7 +44,7 @@ static char use_device[] = "use device=%s media_type=%s pool_name=%s pool_type=% /* Responses sent to Director daemon */ static char OKjob[] = "3000 OK Job SDid=%u SDtime=%u Authorization=%s\n"; static char OK_device[] = "3000 OK use device\n"; -static char NO_device[] = "3914 Device %s not available\n"; +static char NO_device[] = "3914 Device %s does not exist\n"; static char BAD_use[] = "3913 Bad use command: %s\n"; static char BAD_job[] = "3915 Bad Job command: %s\n"; -- 2.39.5