From: Kern Sibbald Date: Sun, 6 Apr 2008 13:19:17 +0000 (+0000) Subject: kes Correctly detect Ubuntu systems, and add ubuntu platform directory. X-Git-Tag: Release-3.0.0~1603 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=21ad4ba4160bb72105d6c1e2011e2e31b61f20ad;p=bacula%2Fbacula 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. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6749 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index f9debcac62..9341be235e 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -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 diff --git a/bacula/configure b/bacula/configure index 555921d121..6efb78a727 100755 --- a/bacula/configure +++ b/bacula/configure @@ -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" @@ -31001,6 +31024,10 @@ do "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 diff --git a/bacula/platforms/Makefile.in b/bacula/platforms/Makefile.in index c8b24eb0f9..103cd034d0 100644 --- a/bacula/platforms/Makefile.in +++ b/bacula/platforms/Makefile.in @@ -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 index 0000000000..aa77f36013 --- /dev/null +++ b/bacula/platforms/ubuntu/Makefile.in @@ -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 index 0000000000..19a342ddef --- /dev/null +++ b/bacula/platforms/ubuntu/bacula-dir.in @@ -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 index 0000000000..a0bc014538 --- /dev/null +++ b/bacula/platforms/ubuntu/bacula-fd.in @@ -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 index 0000000000..6b68ce1219 --- /dev/null +++ b/bacula/platforms/ubuntu/bacula-sd.in @@ -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 diff --git a/bacula/scripts/bacula-ctl-dir.in b/bacula/scripts/bacula-ctl-dir.in index fdebdfbe21..a455f93857 100644 --- a/bacula/scripts/bacula-ctl-dir.in +++ b/bacula/scripts/bacula-ctl-dir.in @@ -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 diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 447974b969..86afb5b835 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -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); diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index d42b00defc..cba298e56c 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -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(); diff --git a/bacula/src/dird/ua_output.c b/bacula/src/dird/ua_output.c index a32fbe0243..bf624fbca6 100644 --- a/bacula/src/dird/ua_output.c +++ b/bacula/src/dird/ua_output.c @@ -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); diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index fc7d1fb9a5..1d731da927 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -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); diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 345d1841d7..1338e4a2f2 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -305,6 +305,12 @@ void *handle_client_request(void *dirp) for (k=0; kregex.size(); k++) { regfree((regex_t *)fo->regex.get(k)); } + for (k=0; kregexdir.size(); k++) { + regfree((regex_t *)fo->regexdir.get(k)); + } + for (k=0; kregexfile.size(); k++) { + regfree((regex_t *)fo->regexfile.get(k)); + } fo->regex.destroy(); fo->regexdir.destroy(); fo->regexfile.destroy(); diff --git a/bacula/src/lib/bregex.c b/bacula/src/lib/bregex.c index acba19730c..65fe8884ae 100644 --- a/bacula/src/lib/bregex.c +++ b/bacula/src/lib/bregex.c @@ -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, ®s); - re_registers_to_regmatch(®s, pmatch, nmatch); + if (stat >= 0) { + re_registers_to_regmatch(®s, 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; diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index e4a4d6eb49..36ae297f39 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -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(); diff --git a/bacula/src/version.h b/bacula/src/version.h index ed93a77cfa..8bc07f9ce5 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -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 */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 4695dc7f03..e034899c83 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -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