]> git.sur5r.net Git - bacula/bacula/commitdiff
Escape filenames in restore command
authorKern Sibbald <kern@sibbald.com>
Thu, 20 Mar 2003 08:21:16 +0000 (08:21 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 20 Mar 2003 08:21:16 +0000 (08:21 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@387 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/ua_restore.c
bacula/src/stored/job.c

index 378b154e521d571b313becb488bac968b9211c1d..f41db51da68c6dfab7b7a4da758459abe3dafb17 100644 (file)
@@ -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;
index b05d5ec458d1145edef30c626333bb99921b5e70..432238ee7b0b17aaa9193db7acfd71abfb8e0bc6 100644 (file)
@@ -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";