From 6cb36d5b0e7efc1663432d438e993646faa5d3bf Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 10 Feb 2008 11:22:59 +0000 Subject: [PATCH] kes Fix bug #1047, which had a heap overrun when stripping certain paths, 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 | 32 +++++++++++++++ bacula/patches/2.2.8-strip-path.patch | 57 ++++++++++++++++++++++++++ bacula/technotes-2.1 | 2 + 3 files changed, 91 insertions(+) create mode 100644 bacula/patches/2.2.8-bacula-conf.patch create mode 100644 bacula/patches/2.2.8-strip-path.patch diff --git a/bacula/patches/2.2.8-bacula-conf.patch b/bacula/patches/2.2.8-bacula-conf.patch new file mode 100644 index 0000000000..0438708543 --- /dev/null +++ b/bacula/patches/2.2.8-bacula-conf.patch @@ -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 + patch -p0 <2.2.8-bacula-conf.patch + ./configure + 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 ++ 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 index 0000000000..db75b85b69 --- /dev/null +++ b/bacula/patches/2.2.8-strip-path.patch @@ -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 + patch -p0 <2.2.8-strip-path.patch + ./configure + 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); + } + } diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index cf8e532080..cc75afd623 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -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 -- 2.39.2