]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Fix bug #1047, which had a heap overrun when stripping certain paths,
authorKern Sibbald <kern@sibbald.com>
Sun, 10 Feb 2008 11:22:59 +0000 (11:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 10 Feb 2008 11:22:59 +0000 (11:22 +0000)
     and do not strip paths on symbolic links.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@6392 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/patches/2.2.8-bacula-conf.patch [new file with mode: 0644]
bacula/patches/2.2.8-strip-path.patch [new file with mode: 0644]
bacula/technotes-2.1

diff --git a/bacula/patches/2.2.8-bacula-conf.patch b/bacula/patches/2.2.8-bacula-conf.patch
new file mode 100644 (file)
index 0000000..0438708
--- /dev/null
@@ -0,0 +1,32 @@
+
+ This patch automatically adds the Bacula database and user name to
+ the default make_catalog_backup Run script call line in the bacula-dir.conf
+ file.
+
+ Apply it to version 2.2.8 or earlier with:
+
+ cd <bacula-source>
+ patch -p0 <2.2.8-bacula-conf.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/bacula-dir.conf.in
+===================================================================
+--- src/dird/bacula-dir.conf.in        (revision 6327)
++++ src/dird/bacula-dir.conf.in        (working copy)
+@@ -61,7 +61,11 @@
+   FileSet="Catalog"
+   Schedule = "WeeklyCycleAfterBackup"
+   # This creates an ASCII copy of the catalog
+-  RunBeforeJob = "@scriptdir@/make_catalog_backup bacula bacula"
++  # WARNING!!! Passing the password via the command line is insecure.
++  # see comments in make_catalog_backup for details.
++  # Arguments to make_catalog_backup are:
++  #  make_catalog_backup <database-name> <user-name> <password> <host>
++  RunBeforeJob = "@scriptdir@/make_catalog_backup @db_name@ @db_user@"
+   # This deletes the copy of the catalog
+   RunAfterJob  = "@scriptdir@/delete_catalog_backup"
+   Write Bootstrap = "@working_dir@/BackupCatalog.bsr"
diff --git a/bacula/patches/2.2.8-strip-path.patch b/bacula/patches/2.2.8-strip-path.patch
new file mode 100644 (file)
index 0000000..db75b85
--- /dev/null
@@ -0,0 +1,57 @@
+
+ This patch should fix bug #1047 -- heap corruption when using
+ strippath on certain directories.
+
+ Apply it to 2.2.8 (probably prior versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.2.8-strip-path.patch
+ ./configure <your-options>
+ make 
+ ...
+ make install
+
+
+Index: src/filed/backup.c
+===================================================================
+--- src/filed/backup.c (revision 6390)
++++ src/filed/backup.c (revision 6391)
+@@ -1146,20 +1146,21 @@
+    /* 
+     * Strip path.  If it doesn't succeed put it back.  If
+     *  it does, and there is a different link string,
+-    *  attempt to strip the link. If it fails, but them
++    *  attempt to strip the link. If it fails, back them
+     *  both back.
++    * Don't strip symlinks.
+     * I.e. if either stripping fails don't strip anything.
+     */
+    if (do_strip(ff_pkt->strip_path, ff_pkt->fname)) {
+-      if (ff_pkt->fname != ff_pkt->link) {
++      if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+          pm_strcpy(ff_pkt->link_save, ff_pkt->link);
+          if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
+-            strcpy(ff_pkt->link, ff_pkt->link_save);
+-            strcpy(ff_pkt->fname, ff_pkt->fname_save);
++            pm_strcpy(ff_pkt->link, ff_pkt->link_save);
++            pm_strcpy(ff_pkt->fname, ff_pkt->fname_save);
+          }
+       }
+    } else {
+-      strcpy(ff_pkt->fname, ff_pkt->fname_save);
++      pm_strcpy(ff_pkt->fname, ff_pkt->fname_save);
+    } 
+    Dmsg2(200, "fname=%s stripped=%s\n", ff_pkt->fname_save, ff_pkt->fname);
+ }
+@@ -1169,8 +1170,8 @@
+    if (!(ff_pkt->flags & FO_STRIPPATH) || ff_pkt->strip_path <= 0) {
+       return;
+    }
+-   strcpy(ff_pkt->fname, ff_pkt->fname_save);
+-   if (ff_pkt->fname != ff_pkt->link) {
+-      strcpy(ff_pkt->link, ff_pkt->link_save);
++   pm_strcpy(ff_pkt->fname, ff_pkt->fname_save);
++   if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
++      pm_strcpy(ff_pkt->link, ff_pkt->link_save);
+    }
+ }
index cf8e532080a8583f6a764f7076cc26bf493325d8..cc75afd623b6a3e6f79fffe7c771180c924a187c 100644 (file)
@@ -2,6 +2,8 @@
 
 General:
 10Feb08
+kes  Fix bug #1047, which had a heap overrun when stripping certain paths,
+     and do not strip paths on symbolic links.
 kes  Set catalog backup database and user name from values specified on 
      the ./configure line.
 ebl  Apply patch to corrent bug #1031, about wrong pool source information