]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Add Media.Enabled flag to client backups for dotcmds.c
authorKern Sibbald <kern@sibbald.com>
Thu, 24 Aug 2006 09:48:11 +0000 (09:48 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 24 Aug 2006 09:48:11 +0000 (09:48 +0000)
kes  Enforce Media.Enabled=1 for a current restore to work.
kes  Require restore case 3 to have sqlquery permission to work.
kes  Remove obsolete del_MAC sql command.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3359 91ce42f0-d328-0410-95d8-f526ca767f89

13 files changed:
bacula/ReleaseNotes
bacula/kernstodo
bacula/scripts/bacula-ctl-fd.in
bacula/src/cats/sql_cmds.c
bacula/src/dird/ua_dotcmds.c
bacula/src/dird/ua_restore.c
bacula/src/dird/ua_update.c
bacula/src/dird/verify.c
bacula/src/stored/bscan.c
bacula/src/version.h
bacula/src/win32/README.mingw32
bacula/src/win32/cats/bacula_cats.def
bacula/technotes-1.39

index dc41a78054cb25ca2df9c95e7a6c832340769a44..de6d1fa6285b1b53ee8a839453bc47d915b92252 100644 (file)
@@ -18,7 +18,7 @@ New Features in 1.39.20:
 - Implement mount command for autochanger
 
 Fixes for 1.39.20:
-- Writing DVDs should work much better thans to Richard Mortimer.
+- Writing DVDs should work much better thanks to Richard Mortimer.
 - Fix bug #462 incorrect error message printed when client script called
   from File= was not found.
 - Fix bug #558 (waiting for feedback) where Bacula needs too much time to
index 4c5af74dd05f885fa2a428fec374188ac66eff94..948d44122d8f0cbb11011ef6701940ebe7d52691 100644 (file)
@@ -33,6 +33,10 @@ Document:
 Priority:
 
 For 1.39:
+- Restricted consoles start in the Default catalog even if it
+  is not permitted.
+- Make sure that the restore options don't permit "seeing" other
+  Client's job data.
 - Implement Python event for backing up/restoring a file.
 - Fix wx-console scanning problem with commas in names.
 - Change dbcheck to tell users to use native tools for fixing
index f3552c32d1cc69221ecbabd5804b89014a968633..539a04da3a2b710e732dbf5deeb326372eea0c30 100644 (file)
@@ -226,7 +226,7 @@ case "$1" in
       ;;
 
    status)
-      [ -x ${BACFDBIN}/bacula-fd   ] && status ${BACFDBIN}/bacula-fd  ${FD_PORT}
+      [ -x ${BACFDBIN}/bacula-fd ] && status ${BACFDBIN}/bacula-fd  ${FD_PORT}
       ;;
 
    *)
index e4e273025a7f94d01f4f3884de37943de2582058..c90ae3ac28fe4c7872e1eb61f5397f4cf86f0ef2 100644 (file)
 #include "bacula.h"
 #include "cats.h"
 
-/* For ua_cmds.c */
+/* For ua_update.c */
 const char *list_pool = "SELECT * FROM Pool WHERE PoolId=%s";
 
 /* For ua_dotcmds.c */
 const char *client_backups =
    "SELECT DISTINCT Job.JobId,Client.Name as Client,Level,StartTime,"
-   "JobFiles,JobBytes,VolumeName,MediaType,FileSet"
+   "JobFiles,JobBytes,VolumeName,MediaType,FileSet,Media.Enabled as Enabled"
    " FROM Client,Job,JobMedia,Media,FileSet"
    " WHERE Client.Name='%s'"
    " AND FileSet='%s'"
@@ -47,7 +47,6 @@ const char *del_File     = "DELETE FROM File WHERE JobId=%s";
 const char *upd_Purged   = "UPDATE Job Set PurgedFiles=1 WHERE JobId=%s";
 const char *cnt_DelCand  = "SELECT count(*) FROM DelCandidates";
 const char *del_Job      = "DELETE FROM Job WHERE JobId=%s";
-const char *del_MAC      = "DELETE FROM MAC WHERE JobId=%s";
 const char *del_JobMedia = "DELETE FROM JobMedia WHERE JobId=%s";
 const char *cnt_JobMedia = "SELECT count(*) FROM JobMedia WHERE MediaId=%s";
 const char *sel_JobMedia = "SELECT JobId FROM JobMedia WHERE MediaId=%s";
@@ -261,6 +260,7 @@ const char *uar_last_full =
    "AND Job.StartTime<'%s' "
    "AND Level='F' AND JobStatus='T' AND Type='B' "
    "AND JobMedia.JobId=Job.JobId "
+   "AND Media.Enabled=1 "
    "AND JobMedia.MediaId=Media.MediaId "
    "AND Job.FileSetId=FileSet.FileSetId "
    "AND FileSet.FileSet='%s' "
@@ -273,6 +273,7 @@ const char *uar_full =
    "StartTime,VolumeName,JobMedia.StartFile,VolSessionId,VolSessionTime "
    "FROM temp1,Job,JobMedia,Media WHERE temp1.JobId=Job.JobId "
    "AND Level='F' AND JobStatus='T' AND Type='B' "
+   "AND Media.Enabled=1 "
    "AND JobMedia.JobId=Job.JobId "
    "AND JobMedia.MediaId=Media.MediaId";
 
@@ -285,6 +286,7 @@ const char *uar_dif =
    "WHERE Job.JobTDate>%s AND Job.StartTime<'%s' "
    "AND Job.ClientId=%s "
    "AND JobMedia.JobId=Job.JobId "
+   "AND Media.Enabled=1 "
    "AND JobMedia.MediaId=Media.MediaId "
    "AND Job.Level='D' AND JobStatus='T' AND Type='B' "
    "AND Job.FileSetId=FileSet.FileSetId "
@@ -300,6 +302,7 @@ const char *uar_inc =
    "FROM Job,JobMedia,Media,FileSet "
    "WHERE Job.JobTDate>%s AND Job.StartTime<'%s' "
    "AND Job.ClientId=%s "
+   "AND Media.Enabled=1 "
    "AND JobMedia.JobId=Job.JobId "
    "AND JobMedia.MediaId=Media.MediaId "
    "AND Job.Level='I' AND JobStatus='T' AND Type='B' "
index 420003181749615c7bab29fe493ef43513127473..b172e679e475ccd66015de07c01597fdb80c012f 100644 (file)
@@ -220,8 +220,8 @@ static int typescmd(UAContext *ua, const char *cmd)
 static int client_backups_handler(void *ctx, int num_field, char **row)
 {
    UAContext *ua = (UAContext *)ctx;
-   bsendmsg(ua, "| %s | %s | %s | %s | %s | %s | %s |\n",
-      row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7]);
+   bsendmsg(ua, "| %s | %s | %s | %s | %s | %s | %s | %s |\n",
+      row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8]);
    return 0;
 }
 
index 0ada4cf794c9c26fd9abfc03500afd7448f4aeb0..07f00a0c3d10f99e0c90a6a303f9ec4af2312dcb 100644 (file)
@@ -414,6 +414,7 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
       case -1:                        /* error or cancel */
          return 0;
       case 0:                         /* list last 20 Jobs run */
+         /* ***FIXME*** restrict clients on restricted console */
          gui_save = ua->jcr->gui;
          ua->jcr->gui = true;
          db_list_sql_query(ua->jcr, ua->db, uar_list_jobs, prtit, ua, 1, HORZ_LIST);
@@ -445,6 +446,9 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx)
          pm_strcpy(rx->JobIds, ua->cmd);
          break;
       case 3:                         /* Enter an SQL list command */
+         if (!acl_access_ok(ua, Command_ACL, NT_("sqlquery"), 8)) {
+            return 0;
+         }
          if (!get_cmd(ua, _("Enter SQL list command: "))) {
             return 0;
          }
index c3191e377f33a32483eca16e558222ccbc3ae087..aa5d80b598fb9acb786b04921bd691ee53008914 100644 (file)
@@ -32,7 +32,7 @@ void update_slots(UAContext *ua);
 
 /* Forward referenced functions */
 static int update_volume(UAContext *ua);
-static int update_pool(UAContext *ua);
+static bool update_pool(UAContext *ua);
 
 /*
  * Update a Pool Record in the database.
@@ -676,7 +676,7 @@ static int update_volume(UAContext *ua)
 /*
  * Update pool record -- pull info from current POOL resource
  */
-static int update_pool(UAContext *ua)
+static bool update_pool(UAContext *ua)
 {
    POOL_DBR  pr;
    int id;
@@ -686,13 +686,13 @@ static int update_pool(UAContext *ua)
 
    pool = get_pool_resource(ua);
    if (!pool) {
-      return 0;
+      return false;
    }
 
    memset(&pr, 0, sizeof(pr));
    bstrncpy(pr.Name, pool->hdr.name, sizeof(pr.Name));
    if (!get_pool_dbr(ua, &pr)) {
-      return 0;
+      return false;
    }
 
    set_pooldbr_from_poolres(&pr, pool, POOL_OP_UPDATE); /* update */
@@ -707,5 +707,5 @@ static int update_pool(UAContext *ua)
    db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, 1, HORZ_LIST);
    free_pool_memory(query);
    bsendmsg(ua, _("Pool DB record updated from resource.\n"));
-   return 1;
+   return true;
 }
index a83c1b1cba1529cf77f1b2ffc0db7fa2969f5ab7..a4075474467879e12c2df4c6f7ca48ef4f545ed3 100644 (file)
@@ -711,11 +711,11 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
     */
    jcr->fn_printed = false;
    bsnprintf(buf, sizeof(buf),
-"SELECT Path.Path,Filename.Name FROM File,Path,Filename "
-"WHERE File.JobId=%d "
-"AND File.MarkId!=%d AND File.PathId=Path.PathId "
-"AND File.FilenameId=Filename.FilenameId",
-      JobId, jcr->JobId);
+      "SELECT Path.Path,Filename.Name FROM File,Path,Filename "
+      "WHERE File.JobId=%d "
+      "AND File.MarkId!=%d AND File.PathId=Path.PathId "
+      "AND File.FilenameId=Filename.FilenameId",
+         JobId, jcr->JobId);
    /* missing_handler is called for each file found */
    db_sql_query(jcr->db, buf, missing_handler, (void *)jcr);
    if (jcr->fn_printed) {
index eb7856fdcca8c866d131c9968a774fef0677ff6f..48602c216e4679097e1ce002373d9d66de44403f 100644 (file)
@@ -844,6 +844,7 @@ static int create_media_record(B_DB *db, MEDIA_DBR *mr, VOLUME_LABEL *vl)
    /* We mark Vols as Archive to keep them from being re-written */
    bstrncpy(mr->VolStatus, "Archive", sizeof(mr->VolStatus));
    mr->VolRetention = 365 * 3600 * 24; /* 1 year */
+   mr->Enabled = 1;
    if (vl->VerNum >= 11) {
       mr->FirstWritten = btime_to_utime(vl->write_btime);
       mr->LabelDate    = btime_to_utime(vl->label_btime);
index 971a25709d34608800ac6df004e7dd452ea54860..99683cf5a64cec8a8e534242f02c4b03d22e7d5d 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 #undef  VERSION
-#define VERSION "1.39.20"
-#define BDATE   "22 August 2006"
-#define LSMDATE "22Aug06"
+#define VERSION "1.39.21"
+#define BDATE   "23 August 2006"
+#define LSMDATE "23Aug06"
 #define BYEAR "2006"       /* year for copyright messages in progs */
 
 /* Debug flags */
index f444e4b7e632185ed01b01c410b1b39a7605eaf2..2c1ded4d8f220a33169b571ec82eaaa40364ecfa 100644 (file)
@@ -127,6 +127,14 @@ in question is for openssl):
 NOTE: The -C means clobber.  Any local changes to the source code in 
 the depkgs-mingw32/src directory will be lost.  The source will be 
 reextracted from the archive and the current patches will be applied.
+
+If you add a new subroutine or global symbol in the CATS library 
+================================================================= 
+Edit src/win32/cats/bacula_cats.def and update it appropriately. 
+The output of a link will tell you the C++ mangled subroutine name 
+to add, and for global symbols, it is rather easy.  See the file.
+           
+
                                      
 Structure of the new Win32 build environment
 ============================================
index b3a1a57a4fab480135e17d3372542a6dbfca7184..c7b741026d03f132e8ee25be17f83798ef769601 100644 (file)
@@ -114,7 +114,6 @@ del_File DATA
 ;cnt_File DATA
 cnt_DelCand DATA
 del_Job DATA
-del_MAC DATA
 del_JobMedia DATA
 cnt_JobMedia DATA
 sel_JobMedia DATA
index a5284c28aefd85194a65f90ffd2dce6984ab79b4..550fdb24fa886d34f567d3a0d84f8e61050d11a7 100644 (file)
@@ -1,6 +1,13 @@
               Technical notes on version 1.39  
 
 General:
+24Aug06
+kes  Add Media.Enabled flag to client backups for dotcmds.c
+kes  Enforce Media.Enabled=1 for a current restore to work.
+kes  Require restore case 3 to have sqlquery permission to work.
+kes  Remove obsolete del_MAC sql command.
+
+Version 1.39.20 beta released:
 22Aug06
 kes  Correct missing Client table reference in SQL pointed out by
      Marc.