]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Correctly detect Ubuntu systems, and add ubuntu platform directory.
authorKern Sibbald <kern@sibbald.com>
Sun, 6 Apr 2008 13:19:17 +0000 (13:19 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 6 Apr 2008 13:19:17 +0000 (13:19 +0000)
kes  Fix bug #1063, reuse of freed ptr in list nextvol.
kes  Release regex compile buffer in filed/job.c
kes  Add proper type of const char in sql_create.c
kes  Turn off debug in daemon termination routines
kes  Move free_volume_list() before devices are freed in stored.c
kes  Fix reference to uninitalized stack variables in bregex.c.
     This should correct bug #1067.

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

17 files changed:
bacula/autoconf/configure.in
bacula/configure
bacula/platforms/Makefile.in
bacula/platforms/ubuntu/Makefile.in [new file with mode: 0644]
bacula/platforms/ubuntu/bacula-dir.in [new file with mode: 0644]
bacula/platforms/ubuntu/bacula-fd.in [new file with mode: 0644]
bacula/platforms/ubuntu/bacula-sd.in [new file with mode: 0644]
bacula/scripts/bacula-ctl-dir.in
bacula/src/cats/sql_create.c
bacula/src/dird/dird.c
bacula/src/dird/ua_output.c
bacula/src/filed/filed.c
bacula/src/filed/job.c
bacula/src/lib/bregex.c
bacula/src/stored/stored.c
bacula/src/version.h
bacula/technotes-2.3

index f9debcac621d3619dedc7ca5bc56d3ed4ffc596e..9341be235e3bb23eb01540df469c0e58ebad6a7e 100644 (file)
@@ -1944,14 +1944,37 @@ darwin)
           platforms/darwin/Makefile"
   ;;
 debian)
+       if `grep -q ubuntu /etc/apt/sources.list`; then
+          DISTNAME="ubuntu"
+       fi
        DISTVER=`cat /etc/debian_version`
+       if test -f /etc/lsb-release ; then
+          . /etc/lsb-release
+          if test "x$DISTRIB_ID" != "x" ; then
+             DISTNAME=$DISTRIB_ID
+          fi
+          if test "x$DISTRIB_RELEASE" != "x" ; then
+             DISTVER=$DISTRIB_RELEASE
+          fi
+       fi
+       if test "$DISTNAME" = "Ubuntu" ; then
+          DISTNAME="ubuntu"
+       fi
        TAPEDRIVE="/dev/nst0"
        PSCMD="ps -e -o pid,command"
-       PFILES="${PFILES} \
-           platforms/debian/Makefile \
-           platforms/debian/bacula-fd \
-           platforms/debian/bacula-sd \
-           platforms/debian/bacula-dir"
+       if test "$DISTNAME" = "ubuntu" ; then
+          PFILES="${PFILES} \
+             platforms/ubuntu/Makefile \
+             platforms/ubuntu/bacula-fd \
+             platforms/ubuntu/bacula-sd \
+             platforms/ubuntu/bacula-dir"
+       else 
+          PFILES="${PFILES} \
+             platforms/debian/Makefile \
+             platforms/debian/bacula-fd \
+             platforms/debian/bacula-sd \
+             platforms/debian/bacula-dir"
+       fi
   ;;
 freebsd)
        DISTVER=`uname -a |awk '{print $3}'`
@@ -2290,8 +2313,8 @@ chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
 cd ..
 
 c=updatedb
-chmod 755 $c/update_mysql_tables_10_to_11       $c/update_sqlite3_tables_10_to_11
-chmod 755 $c/update_postgresql_tables_10_to_11  $c/update_sqlite_tables_10_to_11
+chmod 755 $c/update_mysql_tables_10_to_11      $c/update_sqlite3_tables_10_to_11
+chmod 755 $c/update_postgresql_tables_10_to_11 $c/update_sqlite_tables_10_to_11
 
 c=src/cats
 
index 555921d121ee6dece7bd3073d3619eb5a6ea01fe..6efb78a7278a322ab6575851a0fac4a5c17d7ed6 100755 (executable)
@@ -30110,14 +30110,37 @@ darwin)
           platforms/darwin/Makefile"
   ;;
 debian)
+       if `grep -q ubuntu /etc/apt/sources.list`; then
+          DISTNAME="ubuntu"
+       fi
        DISTVER=`cat /etc/debian_version`
+       if test -f /etc/lsb-release ; then
+          . /etc/lsb-release
+          if test "x$DISTRIB_ID" != "x" ; then
+             DISTNAME=$DISTRIB_ID
+          fi
+          if test "x$DISTRIB_RELEASE" != "x" ; then
+             DISTVER=$DISTRIB_RELEASE
+          fi
+       fi
+       if test "$DISTNAME" = "Ubuntu" ; then
+          DISTNAME="ubuntu"
+       fi
        TAPEDRIVE="/dev/nst0"
        PSCMD="ps -e -o pid,command"
-       PFILES="${PFILES} \
-           platforms/debian/Makefile \
-           platforms/debian/bacula-fd \
-           platforms/debian/bacula-sd \
-           platforms/debian/bacula-dir"
+       if test "$DISTNAME" = "ubuntu" ; then
+          PFILES="${PFILES} \
+             platforms/ubuntu/Makefile \
+             platforms/ubuntu/bacula-fd \
+             platforms/ubuntu/bacula-sd \
+             platforms/ubuntu/bacula-dir"
+       else
+          PFILES="${PFILES} \
+             platforms/debian/Makefile \
+             platforms/debian/bacula-fd \
+             platforms/debian/bacula-sd \
+             platforms/debian/bacula-dir"
+       fi
   ;;
 freebsd)
        DISTVER=`uname -a |awk '{print $3}'`
@@ -30325,7 +30348,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then
    exit 1
 fi
 
-ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/bgnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat.console_apps src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/bgnome-console.conf src/qt-console/bat.conf src/qt-console/bat.pro src/qt-console/install_conf_file src/wx-console/Makefile src/wx-console/bwx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile po/Makefile.in $PFILES"
+ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/bgnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat.console_apps src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/bgnome-console.conf src/qt-console/bat.conf src/qt-console/bat.pro src/qt-console/install_conf_file src/wx-console/Makefile src/wx-console/bwx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile po/Makefile.in updatedb/update_mysql_tables_10_to_11 updatedb/update_sqlite3_tables_10_to_11 updatedb/update_postgresql_tables_10_to_11 updatedb/update_sqlite_tables_10_to_11 $PFILES"
 
 ac_config_commands="$ac_config_commands default"
 
     "src/findlib/Makefile") CONFIG_FILES="$CONFIG_FILES src/findlib/Makefile" ;;
     "src/tools/Makefile") CONFIG_FILES="$CONFIG_FILES src/tools/Makefile" ;;
     "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
+    "updatedb/update_mysql_tables_10_to_11") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_10_to_11" ;;
+    "updatedb/update_sqlite3_tables_10_to_11") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables_10_to_11" ;;
+    "updatedb/update_postgresql_tables_10_to_11") CONFIG_FILES="$CONFIG_FILES updatedb/update_postgresql_tables_10_to_11" ;;
+    "updatedb/update_sqlite_tables_10_to_11") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite_tables_10_to_11" ;;
     "$PFILES") CONFIG_FILES="$CONFIG_FILES $PFILES" ;;
     "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
 
@@ -31984,6 +32011,10 @@ chmod 755 dvd-handler dvd-simulator
 chmod 755 bconsole gconsole mtx-changer devel_bacula logrotate
 cd ..
 
+c=updatedb
+chmod 755 $c/update_mysql_tables_10_to_11      $c/update_sqlite3_tables_10_to_11
+chmod 755 $c/update_postgresql_tables_10_to_11 $c/update_sqlite_tables_10_to_11
+
 c=src/cats
 
 chmod 755 $c/create_bacula_database   $c/update_bacula_tables  $c/make_bacula_tables
index c8b24eb0f9f4cff8af4f3ce221da6d4351d3aec9..103cd034d0544574f3e528ee721119fc889d0918 100644 (file)
@@ -12,7 +12,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL = @INSTALL@
 
 SUBDIRS = freebsd redhat solaris unknown openbsd irix gentoo \
-         debian darwin aix bsdi mandrake slackware alpha
+         debian darwin aix bsdi mandrake slackware alpha ubuntu
 
 MAKE = make
 
diff --git a/bacula/platforms/ubuntu/Makefile.in b/bacula/platforms/ubuntu/Makefile.in
new file mode 100644 (file)
index 0000000..aa77f36
--- /dev/null
@@ -0,0 +1,88 @@
+# 
+# This file is used as the template to create the
+# Makefile for the Debian/Ubuntu/Kubuntu specific installation.
+#
+#  21 March 2008 -- Kern Sibbald
+#
+#  for Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ -m 754
+
+nothing:
+
+install: install-autostart
+
+install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
+
+install_logrotate:
+       @$(INSTALL_PROGRAM) ../../scripts/logrotate $(DESTDIR)/etc/logrotate.d/bacula
+       
+install-autostart-fd: uninstall-autostart-fd
+       @echo "Installing bacula-fd boot script ..."
+       @$(INSTALL_PROGRAM) bacula-fd $(DESTDIR)/etc/init.d/bacula-fd
+       @echo "Installing bacula-fd symlinks ..."
+       @if test x$(DESTDIR) = x ; then \
+          /usr/sbin/update-rc.d bacula-fd start 91 2 3 4 5 . stop 9 0 1 6 .; \
+       fi
+
+
+install-autostart-sd: uninstall-autostart-sd
+       @echo "Installing bacula-sd boot script ..."
+       @$(INSTALL_PROGRAM) bacula-sd $(DESTDIR)/etc/init.d/bacula-sd
+       @echo "Installing bacula-sd symlinks ..."
+       @if test "x$(DESTDIR)" = "x" ; then \
+          /usr/sbin/update-rc.d bacula-sd start 91 2 3 4 5 . stop 9 0 1 6 .; \
+       fi
+
+
+install-autostart-dir: uninstall-autostart-dir
+       @echo "Installing bacula-dir boot script ..."
+       @$(INSTALL_PROGRAM) bacula-dir $(DESTDIR)/etc/init.d/bacula-dir
+       @echo "Installing bacula-dir symlinks ..."
+       @if test "x$(DESTDIR)" = "x" ; then \
+          /usr/sbin/update-rc.d bacula-dir start 90 2 3 4 5 . stop 9 0 1 6 .; \
+       fi
+
+
+uninstall: uninstall-autostart
+
+uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
+
+uninstall-logrotate:
+       @rm -f $(DESTDIR)/etc/logrotate.d/bacula
+
+uninstall-autostart-fd:
+       @if test "x$(DESTDIR)" = "x" -a  -f /etc/init.d/bacula-fd; then \
+          /etc/init.d/bacula-fd stop; \
+          rm -f  $(DESTDIR)/etc/init.d/bacula-fd; \
+          /usr/sbin/update-rc.d bacula-fd remove; \
+       fi
+
+
+uninstall-autostart-sd:
+       @if test "x$(DESTDIR)" = "x" -a  -f /etc/init.d/bacula-sd; then \
+          /etc/init.d/bacula-sd stop; \
+          rm -f  $(DESTDIR)/etc/init.d/bacula-sd; \
+          /usr/sbin/update-rc.d bacula-sd remove; \
+       fi
+
+uninstall-autostart-dir:
+       @if test "x$(DESTDIR)" = "x" -a  -f /etc/init.d/bacula-dir; then \
+          /etc/init.d/bacula-dir stop; \
+          rm -f  $(DESTDIR)/etc/init.d/bacula-dir; \
+          /usr/sbin/update-rc.d bacula-dir remove; \
+       fi
+       @rm -f  $(DESTDIR)/etc/init.d/bacula-dir
+
+clean:
+       @rm -f 1 2 3
+
+distclean: clean
+       @rm -f Makefile
+       @rm -f bacula-sd bacula-fd bacula-dir
+
+devclean: clean
+       @rm -f Makefile
+       @rm -f bacula-sd bacula-fd bacula-dir
diff --git a/bacula/platforms/ubuntu/bacula-dir.in b/bacula/platforms/ubuntu/bacula-dir.in
new file mode 100644 (file)
index 0000000..19a342d
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+#
+# bacula  This shell script takes care of starting and stopping
+#        the bacula Director daemon on Debian/Ubuntu/Kubuntu 
+#        systems. 
+#
+#   Kern E. Sibbald - 21 March 2008
+#
+#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+NAME="bacula-dir"
+DESC="Bacula Director"
+DAEMON=@sbindir@/${NAME}
+BUSER=@dir_user@
+BGROUP=@dir_group@
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+BPORT=@dir_port@
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+test -f $DAEMON || exit 0
+
+if [ -n "`getent services ${NAME}`" ]; then
+   BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
+fi
+
+PIDFILE=@piddir@/${NAME}.${BPORT}.pid
+
+if [ "x${BUSER}" != "x" ]; then
+   BOPTIONS="${BOPTIONS} -u ${BUSER}"
+fi
+if [ "x${BGROUP}" != "x" ]; then
+   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+fi
+
+case "$1" in
+   start)
+      echo -n "Starting ${DESC}: "
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      echo "${NAME}"
+      ;;
+   stop)
+      echo -n "Stopping ${DESC}: "
+      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      echo "${NAME}"
+      ;;
+   restart|force-reload)
+      $0 stop
+      sleep 5
+      $0 start
+      ;;
+   *)
+      echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
+      exit 1
+      ;;
+esac
+exit 0
diff --git a/bacula/platforms/ubuntu/bacula-fd.in b/bacula/platforms/ubuntu/bacula-fd.in
new file mode 100644 (file)
index 0000000..a0bc014
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+#
+# bacula  This shell script takes care of starting and stopping
+#        the bacula Director daemon on Debian/Ubuntu/Kubuntu 
+#        systems. 
+#
+#   Kern E. Sibbald - 21 March 2008
+#
+#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+NAME="bacula-fd"
+DESC="Bacula File Daemon"
+DAEMON=@sbindir@/${NAME}
+BUSER=@fd_user@
+BGROUP=@fd_group@
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+BPORT=@fd_port@
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+test -f $DAEMON || exit 0
+
+if [ -n "`getent services ${NAME}`" ]; then
+   BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
+fi
+
+PIDFILE=@piddir@/${NAME}.${BPORT}.pid
+
+if [ "x${BUSER}" != "x" ]; then
+   BOPTIONS="${BOPTIONS} -u ${BUSER}"
+fi
+if [ "x${BGROUP}" != "x" ]; then
+   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+fi
+
+case "$1" in
+   start)
+      echo -n "Starting ${DESC}: "
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      echo "${NAME}"
+      ;;
+   stop)
+      echo -n "Stopping ${DESC}: "
+      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      echo "${NAME}"
+      ;;
+   restart|force-reload)
+      $0 stop
+      sleep 5
+      $0 start
+      ;;
+   *)
+      echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
+      exit 1
+      ;;
+esac
+exit 0
diff --git a/bacula/platforms/ubuntu/bacula-sd.in b/bacula/platforms/ubuntu/bacula-sd.in
new file mode 100644 (file)
index 0000000..6b68ce1
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+#
+# bacula  This shell script takes care of starting and stopping
+#        the bacula Director daemon on Debian/Ubuntu/Kubuntu 
+#        systems. 
+#
+#   Kern E. Sibbald - 21 March 2008
+#
+#  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
+#
+
+NAME="bacula-sd"
+DESC="Bacula Storage Daemon"
+DAEMON=@sbindir@/${NAME}
+BUSER=@sd_user@
+BGROUP=@sd_group@
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
+BPORT=@sd_port@
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+test -f $DAEMON || exit 0
+
+if [ -n "`getent services ${NAME}`" ]; then
+   BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
+fi
+
+PIDFILE=@piddir@/${NAME}.${BPORT}.pid
+
+if [ "x${BUSER}" != "x" ]; then
+   BOPTIONS="${BOPTIONS} -u ${BUSER}"
+fi
+if [ "x${BGROUP}" != "x" ]; then
+   BOPTIONS="${BOPTIONS} -g ${BGROUP}"
+fi
+
+case "$1" in
+   start)
+      echo -n "Starting ${DESC}: "
+      start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
+      echo "${NAME}"
+      ;;
+   stop)
+      echo -n "Stopping ${DESC}: "
+      start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
+      echo "${NAME}"
+      ;;
+   restart|force-reload)
+      $0 stop
+      sleep 5
+      $0 start
+      ;;
+   *)
+      echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
+      exit 1
+      ;;
+esac
+exit 0
index fdebdfbe216d7a901293de90bc38a34a52db2e2a..a455f93857344b622ce3511600e703de9bc11a51 100644 (file)
@@ -208,7 +208,7 @@ case "$1" in
            OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
         fi
 
-        if [ "${VALGRIND}" != '' ]; then
+        if [ "x${VALGRIND}" = "x1" ]; then
            valgrind --leak-check=full ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
         else
            ${BACDIRBIN}/bacula-dir $2 ${OPTIONS} -v -c ${BACDIRCFG}/bacula-dir.conf
index 447974b969a9e93da6e3ffb185d159c1f4b22992..86afb5b83529a2b5a1035198f67f6a30eefe3781 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -965,8 +965,8 @@ bail_out:
 static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 {
    int stat;
-   static char *no_digest = "0";
-   char *digest;
+   static const char *no_digest = "0";
+   const char *digest;
 
    ASSERT(ar->JobId);
    ASSERT(ar->PathId);
index d42b00defc5899ceb95cd34001eef8d8186da1f8..cba298e56cb624b7b21dc3b9cc4d8671cb6b4619 100644 (file)
@@ -338,6 +338,7 @@ void terminate_dird(int sig)
       exit(1);
    }
    already_here = true;
+   debug_level = 0;                   /* turn off debug */
    stop_watchdog();
    generate_daemon_event(NULL, "Exit");
    unload_plugins();
index a32fbe0243bccfd622a8ac526e649dc32784a55d..bf624fbca62329507d37ee78bb599516c32af413 100644 (file)
@@ -446,7 +446,7 @@ static int do_list_cmd(UAContext *ua, const char *cmd, e_list_type llist)
 static bool list_nextvol(UAContext *ua, int ndays)
 {
    JOB *job;
-   JCR *jcr = ua->jcr;
+   JCR *jcr;          
    USTORE store;
    RUN *run;
    time_t runtime;
@@ -463,23 +463,26 @@ static bool list_nextvol(UAContext *ua, int ndays)
    } else {
       job = (JOB *)GetResWithName(R_JOB, ua->argv[i]);
       if (!job) {
-         Jmsg(jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]);
+         Jmsg(ua->jcr, M_ERROR, 0, _("%s is not a job name.\n"), ua->argv[i]);
          if ((job = select_job_resource(ua)) == NULL) {
             return false;
          }
       }
    }
+
+   jcr = new_jcr(sizeof(JCR), dird_free_jcr);
    for (run=NULL; (run = find_next_run(run, job, runtime, ndays)); ) {
       if (!complete_jcr_for_job(jcr, job, run->pool)) {
-         return false;
+         found = false;
+         goto get_out;
       }
       if (!jcr->jr.PoolId) {
-         ua->error_msg(_("Could not Pool Job %s\n"), job->name());
+         ua->error_msg(_("Could not find Pool for Job %s\n"), job->name());
          continue;
       }
       memset(&pr, 0, sizeof(pr));
       pr.PoolId = jcr->jr.PoolId;
-      if (!db_get_pool_record(ua->jcr, ua->db, &pr)) {
+      if (!db_get_pool_record(jcr, jcr->db, &pr)) {
          bstrncpy(pr.Name, "*UnknownPool*", sizeof(pr.Name));
       }
       mr.PoolId = jcr->jr.PoolId;
@@ -494,11 +497,12 @@ static bool list_nextvol(UAContext *ua, int ndays)
             job->name(), pr.Name, level_to_str(run->level), mr.VolumeName);
          found = true;
       }
-      if (jcr->db && jcr->db != ua->db) {
-         db_close_database(jcr, jcr->db);
-         jcr->db = NULL;
-      }
    }
+
+get_out:
+   db_close_database(jcr, jcr->db);
+   jcr->db = NULL;
+   free_jcr(jcr);
    if (!found) {
       ua->error_msg(_("Could not find next Volume for Job %s.\n"),
          job->hdr.name);
index fc7d1fb9a52fac2afe09b0cc32886ed7ed8c0ee1..1d731da927e5937ed6dd2d4a28cfe526249b835d 100644 (file)
@@ -246,6 +246,7 @@ void terminate_filed(int sig)
       exit(1);                        /* prevent loops */
    }
    already_here = true;
+   debug_level = 0;                   /* turn off debug */
    stop_watchdog();
 
    bnet_stop_thread_server(server_tid);
index 345d1841d762f626e771cf8f38b81e66e156112b..1338e4a2f2548d16f2a458b24c3383c2d9d0a26b 100644 (file)
@@ -305,6 +305,12 @@ void *handle_client_request(void *dirp)
             for (k=0; k<fo->regex.size(); k++) {
                regfree((regex_t *)fo->regex.get(k));
             }
+            for (k=0; k<fo->regexdir.size(); k++) {
+               regfree((regex_t *)fo->regexdir.get(k));
+            }
+            for (k=0; k<fo->regexfile.size(); k++) {
+               regfree((regex_t *)fo->regexfile.get(k));
+            }
             fo->regex.destroy();
             fo->regexdir.destroy();
             fo->regexfile.destroy();
index acba19730cd64f1f894db74e191a10ba78faf854..65fe8884aea6eb06e73fc000d54bffc782b2b101 100644 (file)
@@ -37,7 +37,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2006-2006 Free Software Foundation Europe e.V.
+   Copyright (C) 2006-2008 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -1466,7 +1466,7 @@ int regcomp(regex_t * bufp, const char *regex, int cflags)
    if (bufp->cflags & REG_ICASE) {
       char *p, *lcase = bstrdup(regex);
       for( p = lcase; *p ; p++) {
-        *p = tolower(*p);
+         *p = tolower(*p);
       } 
       re_compile_pattern(bufp, (unsigned char *)lcase);
       bfree(lcase);
@@ -1480,8 +1480,8 @@ int regcomp(regex_t * bufp, const char *regex, int cflags)
 }
 
 void re_registers_to_regmatch(regexp_registers_t old_regs, 
-                             regmatch_t pmatch[], 
-                             size_t nmatch)
+                              regmatch_t pmatch[], 
+                              size_t nmatch)
 {
    size_t i=0;
    
@@ -1502,7 +1502,9 @@ int regexec(regex_t * preg, const char *string, size_t nmatch,
    int len = strlen(string);
    struct re_registers regs;
    stat = re_search(preg, (unsigned char *)string, len, 0, len, &regs);
-   re_registers_to_regmatch(&regs, pmatch, nmatch);
+   if (stat >= 0) {
+      re_registers_to_regmatch(&regs, pmatch, nmatch);
+   }
    /* stat is the start position in the string base 0 where       
     *  the pattern was found or negative if not found.
     */
@@ -1939,12 +1941,12 @@ int re_search(regex_t * bufp, unsigned char *str, int size, int pos,
    if (bufp->cflags & REG_ICASE) { /* we must use string in lowercase */
       int len = strlen((const char *)str);
       if (!bufp->lcase) {
-        bufp->lcase = get_pool_memory(PM_FNAME);
+         bufp->lcase = get_pool_memory(PM_FNAME);
       }
       check_pool_memory_size(bufp->lcase, len+1);
       unsigned char *dst = (unsigned char *)bufp->lcase;
       while (*string) {
-        *dst++ = tolower(*string++);
+         *dst++ = tolower(*string++);
       }
       *dst = '\0';
       string = (unsigned char *)bufp->lcase;
index e4a4d6eb49c195c6e21731d35d75ca64d4ee6a35..36ae297f397233add3cce53abebfeda2adcb3a6c 100644 (file)
@@ -553,6 +553,7 @@ void terminate_stored(int sig)
       exit(1);
    }
    in_here = true;
+   debug_level = 0;                   /* turn off any debug */
    stop_watchdog();
 
    if (sig == SIGTERM) {              /* normal shutdown request? */
@@ -596,6 +597,8 @@ void terminate_stored(int sig)
 
    Dmsg1(200, "In terminate_stored() sig=%d\n", sig);
 
+   free_volume_list();
+
    foreach_res(device, R_DEVICE) {
       Dmsg1(10, "Term device %s\n", device->device_name);
       if (device->dev) {
@@ -618,7 +621,6 @@ void terminate_stored(int sig)
    }
    term_msg();
    cleanup_crypto();
-   free_volume_list();
    term_reservations_lock();
    close_memory_pool();
 
index ed93a77cfa01257f4fc05e1098d29e4c8a56983f..8bc07f9ce533070c26f552b485b95d4497863d0a 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.3.16"
-#define BDATE   "04 April 2008"
-#define LSMDATE "04Apr08"
+#define BDATE   "06 April 2008"
+#define LSMDATE "06Apr08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index 4695dc7f03850e3a9e09131d2556c5a038f7d213..e034899c83e55bdb11aef03c06d32dcfae80925d 100644 (file)
@@ -24,6 +24,17 @@ Add long term statistics job table
 
 
 General:
+06Apr08
+kes  Correctly detect Ubuntu systems, and add ubuntu platform directory.
+kes  Fix bug #1063, reuse of freed ptr in list nextvol.
+kes  Release regex compile buffer in filed/job.c
+kes  Add proper type of const char in sql_create.c
+kes  Turn off debug in daemon termination routines
+kes  Move free_volume_list() before devices are freed in stored.c
+kes  Fix reference to uninitalized stack variables in bregex.c. 
+     This should correct bug #1067.
+04Apr08
+kes  Fix possible seg fault in SD when freeing a volume entry.
 03Apr08
 kes  Implement unload_dev() before swap device.
 ebl  Add statistics prunning with option and menu