[pkg-bacula-commits] [bacula] 01/01: Imported Upstream version 7.4.4+dfsg

Carsten Leonhardt leo at moszumanska.debian.org
Wed Sep 21 14:07:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

leo pushed a commit to branch upstream
in repository bacula.

commit c910f7f2ac3d98cbc8314eff062bfe4510845cbc
Author: Carsten Leonhardt <leo at debian.org>
Date:   Wed Sep 21 16:07:20 2016 +0200

    Imported Upstream version 7.4.4+dfsg
---
 ChangeLog                               |  75 ++++++++++++++++++++-
 LICENSE                                 |   2 +-
 LICENSE-FOSS                            |   8 +--
 ReleaseNotes                            |  40 ++++++++++-
 autoconf/configure.in                   |   1 +
 configure                               |  19 +++---
 platforms/systemd/Makefile.in           | 114 ++++++++++++++++----------------
 platforms/systemd/bacula-dir.service.in |   2 +-
 platforms/systemd/bacula-fd.service.in  |   2 +-
 platforms/systemd/bacula-sd.service.in  |   4 +-
 platforms/systemd/bacula.conf.in        |   3 +
 src/cats/bdb.h                          |   2 +-
 src/cats/bvfs.c                         |   4 +-
 src/cats/mysql.c                        |   1 +
 src/cats/postgresql.c                   |   1 +
 src/cats/sql.c                          |   8 ++-
 src/cats/sql_create.c                   |   4 +-
 src/cats/sql_update.c                   |  51 ++++++++------
 src/cats/sqlite.c                       |   1 +
 src/console/console.c                   |   3 +
 src/dird/authenticate.c                 |   5 ++
 src/dird/catreq.c                       |  10 ++-
 src/dird/dird_conf.c                    |   3 +
 src/dird/msgchan.c                      |   4 ++
 src/dird/next_vol.c                     |   5 +-
 src/dird/ua_cmds.c                      |   7 ++
 src/dird/ua_run.c                       |  13 +++-
 src/dird/ua_status.c                    |  16 +++--
 src/filed/bacula-fd.conf.in             |   2 +-
 src/lib/bsys.c                          |   9 ++-
 src/lib/cram-md5.c                      |  10 +++
 src/lib/edit.c                          |   4 +-
 src/lib/parse_conf.c                    |   8 ++-
 src/lib/parse_conf.h                    |  10 +--
 src/lib/util.c                          |   8 +++
 src/stored/askdir.c                     |   8 +--
 src/stored/bextract.c                   |   4 +-
 src/stored/block_util.c                 |   4 +-
 src/stored/mount.c                      |   2 +
 src/version.h                           |   6 +-
 40 files changed, 347 insertions(+), 136 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1e15ff4..12d6cad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,77 @@
-              Changelog on version 7.4.3
+              Changelog on version 7.4.4
+
+Release version 7.4.4 
+
+20Sep16
+ - Fix broken backport commit
+
+12Sep16
+ - Fix #2085 About director segfault in cram-md5 function
+ - Attempt to fix bug #2237
+
+11Sep16
+ - Recompile configure.in
+ - Fix systemd installation
+ - If using readline reset terminal at bconsole exit
+
+08Sep16
+ - Fix compilation without SMARTALLOC
+
+02Sep16
+ - Fix #2060 about SQL false error message with "update volume fromallpools" 
+  command
+
+29Aug16
+ - Fix spurious MD5 update errors when nothing changed should fix bug #2237 and 
+  others
+
+23Aug16
+ - Fix small memory leak with the restart command
+
+14Aug16
+ - baculum: Update language files
+
+11Aug16
+ - Fix #335 Avoid backups going to the scratch pool
+
+08Aug16
+ - systemd: Give 3mins to the bacula-sd service to stop and close the dde
+
+31Jul16
+ - Minor modifications to Ubuntu packaging
+
+22Jul16
+ - Check if the ScratchPool points to the current Pool and print a warning 
+  message in such case
+
+21Jul16
+ - Fix #1968 print the ScratchPool name instead of just 'Scratch'
+
+20Jul16
+ - Display PrefixLinks in "show job" output
+ - Add explicit LL to big integers to appease older compilers
+
+18Jul16
+ - Enable the plugin directory for the FileDaemon by default
+ - Allow multiple mailcommand+operatorcommand in Messages. Fixes bug #2222
+
+14Jul16
+ - Handle NULL pointers in smartdump() and asciidump()
+
+12Jul16
+ - Modify status to include Admin and Restore in Level field -- clearer
+
+11Jul16
+ - Ensure that zero JobMedias are written for labelling
+
+07Jul16
+ - Fix error message about the stream 26 (PLUGIN_NAME) in bextract
+
+Bugs fixed/closed since last release:
+1968 2060 2085 2222 2237 335
+
+
+====================================================================
 
 Release version 7.4.3
 
diff --git a/LICENSE b/LICENSE
index 6f339a7..10d15ca 100644
--- a/LICENSE
+++ b/LICENSE
@@ -109,7 +109,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ====
 
 Note: the exact form of the copyright (dates, name) might vary, but
-the intent is the same, namely that the full BSD 2-Clause coypright 
+the intent is the same, namely that the full BSD 2-Clause copyright 
 applies.  The file LICENSE-FOSS has a few more details.
 
 
diff --git a/LICENSE-FOSS b/LICENSE-FOSS
index ad7bbb7..33d32b3 100644
--- a/LICENSE-FOSS
+++ b/LICENSE-FOSS
@@ -53,7 +53,7 @@ However, the Bacula Community binary releases consist of files, with few
 source files (mostly scripts), and some of the FOSS licenses such such as
 the BSD (Berkeley Software Development) require publication of the
 copyright notices if the code is released in binary format.  For example
-certain copyright notifications are simplifed such as:
+certain copyright notifications are simplified such as:
 
 # Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
@@ -86,7 +86,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ====
 
-The release of binaires mentioned above is covered in point 2 (above) of 
+The release of binaries mentioned above is covered in point 2 (above) of 
 license.  This file contains a list of all such licenses.
 
 Database scripts (src/cats):
@@ -107,7 +107,7 @@ Translations (po):
 Manpages:
 This man page document is released under the BSD 2-Clause license.
 
-Update datbase (updatedb):
+Update database (updatedb):
 # Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
 
@@ -279,7 +279,7 @@ lz4.c lz4_encoder.h lz4.h
 
    You can contact the author at :
    - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
-   - LZ4 source repository : http://code.google.com/p/lz4/
+   - LZ4 source repository : https://github.com/Cyan4973/lz4
 */
 ===
 
diff --git a/ReleaseNotes b/ReleaseNotes
index e96f41e..cb5437a 100644
--- a/ReleaseNotes
+++ b/ReleaseNotes
@@ -1,5 +1,43 @@
 
-               Release Notes for Bacula 7.4.3
+               Release Notes for Bacula 7.4.4
+
+Release version 7.4.4
+
+This is a bug fix release.
+
+20Sep16
+ - Fix #2085 About director segfault in cram-md5 function
+ - Attempt to fix bug #2237
+ - Recompile configure.in
+ - Fix systemd installation
+ - If using readline reset terminal at bconsole exit
+ - Fix compilation without SMARTALLOC
+ - Fix #2060 about SQL false error message with "update volume fromallpools" 
+   command
+ - Fix spurious MD5 update errors when nothing changed should fix bug #2237 and 
+   others
+ - Fix small memory leak with the restart command
+ - baculum: Update language files
+ - Fix #335 Avoid backups going to the scratch pool
+ - systemd: Give 3mins to the bacula-sd service to stop and close the dde
+ - Minor modifications to Ubuntu packaging
+ - Check if the ScratchPool points to the current Pool and print a warning 
+   message in such case
+ - Fix #1968 print the ScratchPool name instead of just 'Scratch'
+ - Display PrefixLinks in "show job" output
+ - Add explicit LL to big integers to appease older compilers
+ - Enable the plugin directory for the FileDaemon by default
+ - Allow multiple mailcommand+operatorcommand in Messages. Fixes bug #2222
+ - Handle NULL pointers in smartdump() and asciidump()
+ - Modify status to include Admin and Restore in Level field -- clearer
+ - Ensure that zero JobMedias are written for labelling
+ - Fix error message about the stream 26 (PLUGIN_NAME) in bextract
+
+Bugs fixed/closed since last release:
+1968 2060 2085 2222 2237 335
+
+
+=====================================================
 
 Release version 7.4.3
 
diff --git a/autoconf/configure.in b/autoconf/configure.in
index 44e8a86..7eed901 100644
--- a/autoconf/configure.in
+++ b/autoconf/configure.in
@@ -3227,6 +3227,7 @@ AC_ARG_WITH(systemd,
 
 	   PFILES="${PFILES} \
 		   platforms/systemd/Makefile \
+		   platforms/systemd/bacula.conf \
 		   platforms/systemd/bacula-dir.service \
 		   platforms/systemd/bacula-fd.service \
 		   platforms/systemd/bacula-sd.service"
diff --git a/configure b/configure
index 78b3fef..1e87022 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for bacula 7.4.1.
+# Generated by GNU Autoconf 2.69 for bacula 7.4.4.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='bacula'
 PACKAGE_TARNAME='bacula'
-PACKAGE_VERSION='7.4.1'
-PACKAGE_STRING='bacula 7.4.1'
+PACKAGE_VERSION='7.4.4'
+PACKAGE_STRING='bacula 7.4.4'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1566,7 +1566,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures bacula 7.4.1 to adapt to many kinds of systems.
+\`configure' configures bacula 7.4.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1635,7 +1635,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of bacula 7.4.1:";;
+     short | recursive ) echo "Configuration of bacula 7.4.4:";;
    esac
   cat <<\_ACEOF
 
@@ -1833,7 +1833,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-bacula configure 7.4.1
+bacula configure 7.4.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2768,7 +2768,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by bacula $as_me 7.4.1, which was
+It was created by bacula $as_me 7.4.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -30885,6 +30885,7 @@ if test "${with_systemd+set}" = set; then :
 
 	   PFILES="${PFILES} \
 		   platforms/systemd/Makefile \
+		   platforms/systemd/bacula.conf \
 		   platforms/systemd/bacula-dir.service \
 		   platforms/systemd/bacula-fd.service \
 		   platforms/systemd/bacula-sd.service"
@@ -31459,7 +31460,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by bacula $as_me 7.4.1, which was
+This file was extended by bacula $as_me 7.4.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -31525,7 +31526,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-bacula config.status 7.4.1
+bacula config.status 7.4.4
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/platforms/systemd/Makefile.in b/platforms/systemd/Makefile.in
index 2c3ddba..4d2dfe0 100644
--- a/platforms/systemd/Makefile.in
+++ b/platforms/systemd/Makefile.in
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # This file is used as the template to create the
@@ -21,55 +21,55 @@ nothing:
 install: install-dir install-conf install-autostart
 
 install-dir:
-	mkdir -p $(DESTDIR)/$(SYSTEMD_UNITDIR) $(DESTDIR)/$(SYSTEMD_TMPFILES)
+        mkdir -p $(DESTDIR)/$(SYSTEMD_UNITDIR) $(DESTDIR)/$(SYSTEMD_TMPFILES)
 
 install-conf:
-	@$(INSTALL_PROGRAM) -m 644 bacula.conf $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
+        @$(INSTALL_PROGRAM) -m 644 bacula.conf $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
 
 install-autostart: install-autostart-fd install-autostart-sd install-autostart-dir
 
 install-service:
-	@$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
-	@$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
-	@$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
+        @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
+        @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
+        @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)
 
 install-autostart-fd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
-	   /bin/systemctl stop bacula-fd.service; \
-	   /bin/systemctl disable bacula-fd.service; \
-	fi
-	@$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-fd.service
-	# set symlinks for script at startup and shutdown
-	@if test x$(DESTDIR) = x ; then \
-	   /bin/systemctl enable bacula-fd.service; \
-	   /bin/systemctl start bacula-fd.service; \
-	fi
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
+           /bin/systemctl stop bacula-fd.service; \
+           /bin/systemctl disable bacula-fd.service; \
+        fi
+        @$(INSTALL_PROGRAM) -m 644 bacula-fd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-fd.service
+        # set symlinks for script at startup and shutdown
+        @if test x$(DESTDIR) = x ; then \
+           /bin/systemctl enable bacula-fd.service; \
+           /bin/systemctl start bacula-fd.service; \
+        fi
 
 
 install-autostart-sd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
-	   /bin/systemctl stop bacula-sd.service; \
-	   /bin/systemctl disable bacula-sd.service; \
-	fi
-	@$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-sd.service
-	# set symlinks for script at startup and shutdown
-	@if test x$(DESTDIR) = x ; then \
-	   /bin/systemctl enable bacula-sd.service; \
-	   /bin/systemctl start bacula-sd.service; \
-	fi
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
+           /bin/systemctl stop bacula-sd.service; \
+           /bin/systemctl disable bacula-sd.service; \
+        fi
+        @$(INSTALL_PROGRAM) -m 644 bacula-sd.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-sd.service
+        # set symlinks for script at startup and shutdown
+        @if test x$(DESTDIR) = x ; then \
+           /bin/systemctl enable bacula-sd.service; \
+           /bin/systemctl start bacula-sd.service; \
+        fi
 
 
 install-autostart-dir:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-dir.service; then \
-	   /bin/systemctl stop bacula-dir.service; \
-	   /bin/systemctl disable bacula-dir.service; \
-	fi
-	@$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-dir.service
-	# set symlinks for script at startup and shutdown
-	@if test x$(DESTDIR) = x ; then \
-	   /bin/systemctl enable bacula-dir.service; \
-	   /bin/systemctl start bacula-dir.service; \
-	fi
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-dir.service; then \
+           /bin/systemctl stop bacula-dir.service; \
+           /bin/systemctl disable bacula-dir.service; \
+        fi
+        @$(INSTALL_PROGRAM) -m 644 bacula-dir.service $(DESTDIR)/$(SYSTEMD_UNITDIR)/bacula-dir.service
+        # set symlinks for script at startup and shutdown
+        @if test x$(DESTDIR) = x ; then \
+           /bin/systemctl enable bacula-dir.service; \
+           /bin/systemctl start bacula-dir.service; \
+        fi
 
 
 uninstall: uninstall-autostart uninstall-conf
@@ -77,37 +77,37 @@ uninstall: uninstall-autostart uninstall-conf
 uninstall-autostart: uninstall-autostart-fd uninstall-autostart-sd uninstall-autostart-dir
 
 uninstall-autostart-fd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
-	   /bin/systemctl stop bacula-fd.service; \
-	   /bin/systemctl disable bacula-fd.service; \
-	fi
-	@rm -f	$(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-fd.service
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-fd.service; then \
+           /bin/systemctl stop bacula-fd.service; \
+           /bin/systemctl disable bacula-fd.service; \
+        fi
+        @rm -f  $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-fd.service
 
 
 uninstall-autostart-sd:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
-	   /bin/systemctl stop bacula-fd.service; \
-	   /bin/systemctl disable bacula-fd.service; \
-	fi
-	@rm -f	$(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-sd.service
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD_UNITDIR)/bacula-sd.service; then \
+           /bin/systemctl stop bacula-fd.service; \
+           /bin/systemctl disable bacula-fd.service; \
+        fi
+        @rm -f  $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-sd.service
 
 uninstall-autostart-dir:
-	@if test x$(DESTDIR) = x -a  -f $(SYSTEMD)/bacula-dir.service; then \
-	   /bin/systemctl stop bacula-dir.service; \
-	   /bin/systemctl disable bacula-dir.service; \
-	fi
-	@rm -f	$(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-dir.service
+        @if test x$(DESTDIR) = x -a  -f $(SYSTEMD)/bacula-dir.service; then \
+           /bin/systemctl stop bacula-dir.service; \
+           /bin/systemctl disable bacula-dir.service; \
+        fi
+        @rm -f  $(DESTDIR)$(SYSTEMD_UNITDIR)/bacula-dir.service
 
 uninstall-conf:
-	@rm -f	$(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
+        @rm -f  $(DESTDIR)/$(SYSTEMD_TMPFILES)/bacula.conf
 
 clean:
-	@rm -f 1 2 3
+        @rm -f 1 2 3
 
 distclean: clean
-	@rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
-	@rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
+        @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
+        @rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
 
 devclean: clean
-	@rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
-	@rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
+        @rm -f Makefile bacula-*.spec bacula.*.spec bacula.spec
+        @rm -f bacula.conf bacula-sd.service bacula-fd.service bacula-dir.service
diff --git a/platforms/systemd/bacula-dir.service.in b/platforms/systemd/bacula-dir.service.in
index 28995ad..c2dbc0b 100644
--- a/platforms/systemd/bacula-dir.service.in
+++ b/platforms/systemd/bacula-dir.service.in
@@ -1,6 +1,6 @@
 # Systemd Bacula service file
 #
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # /lib/systemd/system/bacula-dir.service
diff --git a/platforms/systemd/bacula-fd.service.in b/platforms/systemd/bacula-fd.service.in
index 456ea1d..5899058 100644
--- a/platforms/systemd/bacula-fd.service.in
+++ b/platforms/systemd/bacula-fd.service.in
@@ -1,6 +1,6 @@
 # Systemd Bacula service file
 #
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # /lib/systemd/system/bacula-fd.service
diff --git a/platforms/systemd/bacula-sd.service.in b/platforms/systemd/bacula-sd.service.in
index 9663f74..6de48ba 100644
--- a/platforms/systemd/bacula-sd.service.in
+++ b/platforms/systemd/bacula-sd.service.in
@@ -1,6 +1,6 @@
 # Systemd Bacula service file
 #
-# Copyright (C) 2000-2015 Kern Sibbald
+# Copyright (C) 2000-2016 Kern Sibbald
 # License: BSD 2-Clause; see file LICENSE-FOSS
 #
 # /lib/systemd/system/bacula-sd.service
@@ -27,6 +27,8 @@ Group=@sd_group@
 ExecStart=@sbindir@/bacula-sd -c @sysconfdir@/bacula-sd.conf
 PIDFile=@piddir@/bacula-sd. at sd_port@.pid
 StandardError=syslog
+#LimitMEMLOCK=infinity
+TimeoutStopSec=3min
 
 [Install]
 WantedBy=multi-user.target
diff --git a/platforms/systemd/bacula.conf.in b/platforms/systemd/bacula.conf.in
new file mode 100644
index 0000000..6266f98
--- /dev/null
+++ b/platforms/systemd/bacula.conf.in
@@ -0,0 +1,3 @@
+#
+# See tmpfiles.d(5) for details
+d @piddir@ 2775 bacula bacula -
diff --git a/src/cats/bdb.h b/src/cats/bdb.h
index ae4770b..c8b4985 100644
--- a/src/cats/bdb.h
+++ b/src/cats/bdb.h
@@ -102,7 +102,7 @@ public:
    void print_lock_info(FILE *fp);
 
    /* sql.c */
-   bool UpdateDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
+   bool UpdateDB(JCR *jcr, char *cmd, bool can_be_empty, const char *file=__FILE__, int line=__LINE__);
    bool InsertDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
    bool QueryDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
    int  DeleteDB(JCR *jcr, char *cmd, const char *file=__FILE__, int line=__LINE__);
diff --git a/src/cats/bvfs.c b/src/cats/bvfs.c
index 372149e..76ce058 100644
--- a/src/cats/bvfs.c
+++ b/src/cats/bvfs.c
@@ -513,7 +513,7 @@ static int update_path_hierarchy_cache(JCR *jcr,
    } while (ret && mdb->sql_affected_rows() > 0);
 
    Mmsg(mdb->cmd, "UPDATE Job SET HasCache=1 WHERE JobId=%s", jobid);
-   ret = mdb->UpdateDB(jcr, mdb->cmd);
+   ret = mdb->UpdateDB(jcr, mdb->cmd, false);
 
 bail_out:
    mdb->bdb_end_transaction(jcr);
@@ -694,7 +694,7 @@ void Bvfs::fv_update_size_and_count(int64_t pathid, int64_t size, int64_t count)
         " WHERE JobId = %s "
         " AND PathId = %lld ", count, size, jobids, pathid);
 
-   db->UpdateDB(jcr, db->cmd);
+   db->UpdateDB(jcr, db->cmd, false);
 }
 
 void bvfs_update_cache(JCR *jcr, BDB *mdb)
diff --git a/src/cats/mysql.c b/src/cats/mysql.c
index 52546b7..529e6c5 100644
--- a/src/cats/mysql.c
+++ b/src/cats/mysql.c
@@ -443,6 +443,7 @@ void BDB_MYSQL::bdb_start_transaction(JCR *jcr)
    } 
    if (!jcr->ar) { 
       jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); 
+      memset(jcr->ar, 0, sizeof(ATTR_DBR));
    } 
 } 
  
diff --git a/src/cats/postgresql.c b/src/cats/postgresql.c
index 51d1a13..6794b4a 100644
--- a/src/cats/postgresql.c
+++ b/src/cats/postgresql.c
@@ -445,6 +445,7 @@ void BDB_POSTGRESQL::bdb_start_transaction(JCR *jcr)
    }
    if (!jcr->ar) { 
       jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); 
+      memset(jcr->ar, 0, sizeof(ATTR_DBR));
    }
 
    /* 
diff --git a/src/cats/sql.c b/src/cats/sql.c
index b20911c..eb8aefb 100644
--- a/src/cats/sql.c
+++ b/src/cats/sql.c
@@ -280,8 +280,12 @@ bool BDB::InsertDB(JCR *jcr, char *cmd, const char *file, int line)
 /* Utility routine for updates. 
  *  Returns: false on failure 
  *           true  on success 
+ *
+ * Some UPDATE queries must update record(s), other queries might not update
+ * anything.
  */ 
-bool BDB::UpdateDB(JCR *jcr, char *cmd, const char *file, int line) 
+bool BDB::UpdateDB(JCR *jcr, char *cmd, bool can_be_empty,
+                   const char *file, int line) 
 { 
    if (!sql_query(cmd)) { 
       m_msg(file, line, &errmsg, _("update %s failed:\n%s\n"), cmd, sql_strerror()); 
@@ -292,7 +296,7 @@ bool BDB::UpdateDB(JCR *jcr, char *cmd, const char *file, int line)
       return false; 
    } 
    int num_rows = sql_affected_rows(); 
-   if (num_rows < 1) { 
+   if ((num_rows == 0 && !can_be_empty) || num_rows < 0) { 
       char ed1[30]; 
       m_msg(file, line, &errmsg, _("Update failed: affected_rows=%s for %s\n"), 
          edit_uint64(num_rows, ed1), cmd); 
diff --git a/src/cats/sql_create.c b/src/cats/sql_create.c
index 047c650..255d407 100644
--- a/src/cats/sql_create.c
+++ b/src/cats/sql_create.c
@@ -133,7 +133,7 @@ bool BDB::bdb_create_jobmedia_record(JCR *jcr, JOBMEDIA_DBR *jm)
       Mmsg(cmd,
            "UPDATE Media SET EndFile=%u, EndBlock=%u WHERE MediaId=%u",
            jm->EndFile, jm->EndBlock, jm->MediaId);
-      if (!UpdateDB(jcr, cmd)) {
+      if (!UpdateDB(jcr, cmd, false)) {
          Mmsg2(&errmsg, _("Update Media record %s failed: ERR=%s\n"), cmd,
               sql_strerror());
          ok = false;
@@ -443,7 +443,7 @@ int BDB::bdb_create_media_record(JCR *jcr, MEDIA_DBR *mr)
          strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
          Mmsg(cmd, "UPDATE Media SET LabelDate='%s' "
               "WHERE MediaId=%d", dt, mr->MediaId);
-         stat = UpdateDB(jcr, cmd);
+         stat = UpdateDB(jcr, cmd, false);
       }
       /*
        * Make sure that if InChanger is non-zero any other identical slot
diff --git a/src/cats/sql_update.c b/src/cats/sql_update.c
index 205a6d3..b6c4677 100644
--- a/src/cats/sql_update.c
+++ b/src/cats/sql_update.c
@@ -29,6 +29,9 @@
  
 #include  "cats.h"
 
+#define dbglevel1  100
+#define dbglevel2  400
+
 /* -----------------------------------------------------------------------
  *
  *   Generic Routines (or almost generic)
@@ -55,7 +58,7 @@ int BDB::bdb_add_digest_to_file_record(JCR *jcr, FileId_t FileId, char *digest,
    bdb_escape_string(jcr, esc_name, digest, len);
    Mmsg(cmd, "UPDATE File SET MD5='%s' WHERE FileId=%s", esc_name,
         edit_int64(FileId, ed1));
-   ret = UpdateDB(jcr, cmd);
+   ret = UpdateDB(jcr, cmd, true);
    bdb_unlock();
    return ret;
 }
@@ -71,7 +74,7 @@ int BDB::bdb_mark_file_record(JCR *jcr, FileId_t FileId, JobId_t JobId)
    bdb_lock();
    Mmsg(cmd, "UPDATE File SET MarkId=%s WHERE FileId=%s",
       edit_int64(JobId, ed1), edit_int64(FileId, ed2));
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
    bdb_unlock();
    return stat;
 }
@@ -107,7 +110,7 @@ bool BDB::bdb_update_job_start_record(JCR *jcr, JOB_DBR *jr)
       edit_int64(jr->FileSetId, ed4),
       edit_int64(jr->JobId, ed5));
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
    changes = 0;
    bdb_unlock();
    return stat;
@@ -185,7 +188,7 @@ int BDB::bdb_update_job_end_record(JCR *jcr, JOB_DBR *jr)
       rdt, PriorJobId, jr->HasBase, jr->PurgedFiles,
       edit_int64(jr->JobId, ed3));
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
 
    bdb_unlock();
    return stat;
@@ -221,7 +224,7 @@ int BDB::bdb_update_client_record(JCR *jcr, CLIENT_DBR *cr)
       edit_uint64(cr->JobRetention, ed2),
       esc_uname, esc_name);
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
    bdb_unlock();
    return stat;
 }
@@ -242,7 +245,7 @@ int BDB::bdb_update_counter_record(JCR *jcr, COUNTER_DBR *cr)
       cr->MinValue, cr->MaxValue, cr->CurrentValue,
       cr->WrapCounter, esc);
 
-   int stat = UpdateDB(jcr, cmd);
+   int stat = UpdateDB(jcr, cmd, false);
    bdb_unlock();
    return stat;
 }
@@ -260,7 +263,7 @@ int BDB::bdb_update_pool_record(JCR *jcr, POOL_DBR *pr)
    Mmsg(cmd, "SELECT count(*) from Media WHERE PoolId=%s",
       edit_int64(pr->PoolId, ed4));
    pr->NumVols = get_sql_record_max(jcr, this);
-   Dmsg1(400, "NumVols=%d\n", pr->NumVols);
+   Dmsg1(dbglevel2, "NumVols=%d\n", pr->NumVols);
 
    Mmsg(cmd,
 "UPDATE Pool SET NumVols=%u,MaxVols=%u,UseOnce=%d,UseCatalog=%d,"
@@ -278,7 +281,7 @@ int BDB::bdb_update_pool_record(JCR *jcr, POOL_DBR *pr)
       edit_int64(pr->ScratchPoolId,ed6),
       pr->ActionOnPurge,
       ed4);
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
    bdb_unlock();
    return stat;
 }
@@ -292,7 +295,7 @@ bool BDB::bdb_update_storage_record(JCR *jcr, STORAGE_DBR *sr)
    Mmsg(cmd, "UPDATE Storage SET AutoChanger=%d WHERE StorageId=%s",
       sr->AutoChanger, edit_int64(sr->StorageId, ed1));
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
    bdb_unlock();
    return stat;
 }
@@ -317,20 +320,20 @@ int BDB::bdb_update_media_record(JCR *jcr, MEDIA_DBR *mr)
    char esc_name[MAX_ESCAPE_NAME_LENGTH];
    char esc_status[MAX_ESCAPE_NAME_LENGTH];
 
-   Dmsg1(100, "update_media: FirstWritten=%d\n", mr->FirstWritten);
+   Dmsg1(dbglevel1, "update_media: FirstWritten=%d\n", mr->FirstWritten);
    bdb_lock();
    bdb_escape_string(jcr, esc_name, mr->VolumeName, strlen(mr->VolumeName));
    bdb_escape_string(jcr, esc_status, mr->VolStatus, strlen(mr->VolStatus));
 
    if (mr->set_first_written) {
-      Dmsg1(400, "Set FirstWritten Vol=%s\n", mr->VolumeName);
+      Dmsg1(dbglevel2, "Set FirstWritten Vol=%s\n", mr->VolumeName);
       ttime = mr->FirstWritten;
       (void)localtime_r(&ttime, &tm);
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
       Mmsg(cmd, "UPDATE Media SET FirstWritten='%s'"
            " WHERE VolumeName='%s'", dt, esc_name);
-      stat = UpdateDB(jcr, cmd);
-      Dmsg1(400, "Firstwritten=%d\n", mr->FirstWritten);
+      stat = UpdateDB(jcr, cmd, false);
+      Dmsg1(dbglevel2, "Firstwritten=%d\n", mr->FirstWritten);
    }
 
    /* Label just done? */
@@ -343,7 +346,7 @@ int BDB::bdb_update_media_record(JCR *jcr, MEDIA_DBR *mr)
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
       Mmsg(cmd, "UPDATE Media SET LabelDate='%s' "
            "WHERE VolumeName='%s'", dt, esc_name);
-      UpdateDB(jcr, cmd);
+      UpdateDB(jcr, cmd, false);
    }
 
    if (mr->LastWritten != 0) {
@@ -352,7 +355,7 @@ int BDB::bdb_update_media_record(JCR *jcr, MEDIA_DBR *mr)
       strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm);
       Mmsg(cmd, "UPDATE Media Set LastWritten='%s' "
            "WHERE VolumeName='%s'", dt, esc_name);
-      UpdateDB(jcr, cmd);
+      UpdateDB(jcr, cmd, false);
    }
 
    /* sanity checks for #1066 */
@@ -396,9 +399,9 @@ int BDB::bdb_update_media_record(JCR *jcr, MEDIA_DBR *mr)
         mr->RecycleCount,mr->Recycle, mr->ActionOnPurge,
         esc_name);
 
-   Dmsg1(400, "%s\n", cmd);
+   Dmsg1(dbglevel1, "%s\n", cmd);
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
 
    /* Make sure InChanger is 0 for any record having the same Slot */
    db_make_inchanger_unique(jcr, this, mr);
@@ -418,6 +421,7 @@ int BDB::bdb_update_media_defaults(JCR *jcr, MEDIA_DBR *mr)
    int stat;
    char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50];
    char esc[MAX_ESCAPE_NAME_LENGTH];
+   bool can_be_empty;
 
    bdb_lock();
    if (mr->VolumeName[0]) {
@@ -432,6 +436,8 @@ int BDB::bdb_update_media_defaults(JCR *jcr, MEDIA_DBR *mr)
            edit_uint64(mr->MaxVolBytes, ed3),
            edit_uint64(mr->RecyclePoolId, ed4),
            esc);
+      can_be_empty = false;
+
    } else {
       Mmsg(cmd, "UPDATE Media SET "
            "ActionOnPurge=%d, Recycle=%d,VolRetention=%s,VolUseDuration=%s,"
@@ -443,11 +449,12 @@ int BDB::bdb_update_media_defaults(JCR *jcr, MEDIA_DBR *mr)
            edit_uint64(mr->MaxVolBytes, ed3),
            edit_int64(mr->RecyclePoolId, ed4),
            edit_int64(mr->PoolId, ed5));
+      can_be_empty = true;
    }
 
-   Dmsg1(400, "%s\n", cmd);
+   Dmsg1(dbglevel1, "%s\n", cmd);
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, can_be_empty);
 
    bdb_unlock();
    return stat;
@@ -485,8 +492,8 @@ void BDB::bdb_make_inchanger_unique(JCR *jcr, MEDIA_DBR *mr)
                mr->Slot,
                edit_int64(mr->StorageId, ed1), mr->VolumeName);
        }
-       Dmsg1(100, "%s\n", cmd);
-       UpdateDB(jcr, cmd);
+       Dmsg1(dbglevel1, "%s\n", cmd);
+       UpdateDB(jcr, cmd, true);
    }
 }
 
@@ -505,7 +512,7 @@ bool BDB::bdb_update_snapshot_record(JCR *jcr, SNAPSHOT_DBR *sr)
    Mmsg(cmd, "UPDATE Snapshot SET Retention=%s, Comment='%s' WHERE SnapshotId=%s",
         edit_int64(sr->Retention, ed2), sr->Comment, edit_int64(sr->SnapshotId, ed1));
 
-   stat = UpdateDB(jcr, cmd);
+   stat = UpdateDB(jcr, cmd, false);
    bdb_unlock();
    return stat;
 }
diff --git a/src/cats/sqlite.c b/src/cats/sqlite.c
index 7dcbafe..9ee8171 100644
--- a/src/cats/sqlite.c
+++ b/src/cats/sqlite.c
@@ -378,6 +378,7 @@ void BDB_SQLITE::bdb_start_transaction(JCR *jcr)
    } 
    if (!jcr->ar) { 
       jcr->ar = (ATTR_DBR *)malloc(sizeof(ATTR_DBR)); 
+      memset(jcr->ar, 0, sizeof(ATTR_DBR));
    } 
  
    if (!mdb->m_allow_transactions) { 
diff --git a/src/console/console.c b/src/console/console.c
index e1862b8..40a1dd4 100644
--- a/src/console/console.c
+++ b/src/console/console.c
@@ -1289,6 +1289,9 @@ static void terminate_console(int sig)
    if (!no_conio) {
       con_term();
    }
+#ifdef HAVE_READLINE
+   rl_restore_state(NULL);
+#endif
    (void)WSACleanup();               /* Cleanup Windows sockets */
    lmgr_cleanup_main();
 
diff --git a/src/dird/authenticate.c b/src/dird/authenticate.c
index e0eb7ac..0dce7ef 100644
--- a/src/dird/authenticate.c
+++ b/src/dird/authenticate.c
@@ -67,6 +67,11 @@ bool authenticate_storage_daemon(JCR *jcr, STORE *store)
    int compatible = true;
    bool auth_success = false;
 
+   if (!sd) {
+      Dmsg0(dbglvl, "Invalid bsock\n");
+      return false;
+   }
+
    /*
     * Send my name to the Storage daemon then do authentication
     */
diff --git a/src/dird/catreq.c b/src/dird/catreq.c
index d7341ad..ed0a736 100644
--- a/src/dird/catreq.c
+++ b/src/dird/catreq.c
@@ -612,9 +612,13 @@ static void update_attribute(JCR *jcr, char *msg, int32_t msglen)
                  Stream);
          }
 
-         bin_to_base64(digestbuf, sizeof(digestbuf), fname, len, true);
-         Dmsg3(400, "DigestLen=%d Digest=%s type=%d\n", strlen(digestbuf),
-               digestbuf, Stream);
+         if (len != 0) {
+            bin_to_base64(digestbuf, sizeof(digestbuf), fname, len, true);
+            Dmsg3(400, "DigestLen=%d Digest=%s type=%d\n", strlen(digestbuf),
+                  digestbuf, Stream);
+         } else {
+            digestbuf[0] = 0;
+         }
          if (jcr->cached_attribute) {
             ar->Digest = digestbuf;
             ar->DigestType = type;
diff --git a/src/dird/dird_conf.c b/src/dird/dird_conf.c
index 3a4b381..64a1b40 100644
--- a/src/dird/dird_conf.c
+++ b/src/dird/dird_conf.c
@@ -713,6 +713,9 @@ void dump_resource(int type, RES *ares, void sendit(void *sock, const char *fmt,
       if (res->res_job.JobType == JT_MIGRATE || res->res_job.JobType == JT_COPY) {
          sendit(sock, _("     SelectionType=%d\n"), res->res_job.selection_type);
       }
+      if (res->res_job.JobType == JT_RESTORE) {
+         sendit(sock, _("     PrefixLinks=%d\n"), res->res_job.PrefixLinks);
+      }
       if (res->res_job.client) {
          sendit(sock, _("  --> "));
          dump_resource(-R_CLIENT, (RES *)res->res_job.client, sendit, sock);
diff --git a/src/dird/msgchan.c b/src/dird/msgchan.c
index 1f227bb..ee5f636 100644
--- a/src/dird/msgchan.c
+++ b/src/dird/msgchan.c
@@ -123,6 +123,10 @@ bool connect_to_storage_daemon(JCR *jcr, int retry_interval,
    sd->set_source_address(director->DIRsrc_addr);
    if (!sd->connect(jcr, retry_interval, max_retry_time, heart_beat, _("Storage daemon"),
          store->address, NULL, store->SDport, verbose)) {
+
+      if (!jcr->store_bsock) {  /* The bsock was locally created, so we free it here */
+         free_bsock(sd);
+      }
       sd = NULL;
    }
 
diff --git a/src/dird/next_vol.c b/src/dird/next_vol.c
index 522e323..f895e5c 100644
--- a/src/dird/next_vol.c
+++ b/src/dird/next_vol.c
@@ -479,8 +479,9 @@ bool get_scratch_volume(JCR *jcr, bool InChanger, MEDIA_DBR *mr,
             goto bail_out;
          }
 
-         Jmsg(jcr, M_INFO, 0, _("Using Volume \"%s\" from 'Scratch' pool.\n"),
-              mr->VolumeName);
+         Jmsg(jcr, M_INFO, 0, _("Using Volume \"%s\" from '%s' %spool.\n"),
+              mr->VolumeName, spr.Name,
+              ((strcmp(spr.Name, "Scratch") == 0) ? "" : "Scratch "));
 
          ok = true;
       }
diff --git a/src/dird/ua_cmds.c b/src/dird/ua_cmds.c
index 334066e..d2e007b 100644
--- a/src/dird/ua_cmds.c
+++ b/src/dird/ua_cmds.c
@@ -529,6 +529,13 @@ int update_pool_references(JCR *jcr, BDB *db, POOL *pool)
 {
    POOL_DBR  pr;
 
+   if (pool->ScratchPool == pool) {
+      Jmsg(NULL, M_WARNING, 0,
+           _("The ScratchPool directive for Pool \"%s\" is incorrect. Using default Scratch pool instead.\n"),
+           pool->name());
+      pool->ScratchPool = NULL;
+   }
+
    if (!pool->RecyclePool && !pool->ScratchPool) {
       return 1;
    }
diff --git a/src/dird/ua_run.c b/src/dird/ua_run.c
index f54df8f..beb67e3 100644
--- a/src/dird/ua_run.c
+++ b/src/dird/ua_run.c
@@ -69,7 +69,12 @@ public:
    /* Methods */
    run_ctx() { memset(this, 0, sizeof(run_ctx));
                store = new USTORE; };
-   ~run_ctx() { delete store; };
+   ~run_ctx() {
+      delete store;
+      if (JobIds) {
+         delete JobIds;
+      }
+   };
 };
 
 /* Forward referenced subroutines */
@@ -144,7 +149,6 @@ int run_cmd(UAContext *ua, const char *cmd)
          break; /* error get out of while loop */
       }
 
-
       /* Run without prompting? */
       if (ua->batch || find_arg(ua, NT_("yes")) > 0) {
          return start_job(ua, jcr, rc);
@@ -1067,6 +1071,11 @@ static bool set_run_context_in_jcr(UAContext *ua, JCR *jcr, run_ctx &rc)
       jcr->IgnoreDuplicateJobChecking = rc.ignoreduplicatecheck;
    }
 
+   /* Not a good idea to start a job with the Scratch pool */
+   if (rc.pool && strcmp(rc.pool->name(), NT_("Scratch")) == 0) {
+      ua->send_msg(_("Pool \"Scratch\" not valid.\n"));
+      return false;
+   }
    return true;
 }
 
diff --git a/src/dird/ua_status.c b/src/dird/ua_status.c
index ccf0b84..c0faaa8 100644
--- a/src/dird/ua_status.c
+++ b/src/dird/ua_status.c
@@ -522,8 +522,10 @@ static void prt_runtime(UAContext *ua, sched_pkt *sp)
    bstrftime_nc(dt, sizeof(dt), sp->runtime);
    switch (sp->job->JobType) {
    case JT_ADMIN:
+      level_ptr = "Admin";
+      break;
    case JT_RESTORE:
-      level_ptr = " ";
+      level_ptr = "Restore";
       break;
    default:
       level_ptr = level_to_str(sp->level);
@@ -680,8 +682,10 @@ static void llist_scheduled_jobs(UAContext *ua)
             }
             switch (job->JobType) {
             case JT_ADMIN:
+               level_ptr = "Admin";
+               break;
             case JT_RESTORE:
-               level_ptr = " ";
+               level_ptr = "Restore";
                break;
             default:
                level_ptr = level_to_str(level);
@@ -1032,8 +1036,10 @@ static void list_running_jobs(UAContext *ua)
       }
       switch (jcr->getJobType()) {
       case JT_ADMIN:
+         bstrncpy(level, "Admin", sizeof(level));
+         break;
       case JT_RESTORE:
-         bstrncpy(level, "      ", sizeof(level));
+         bstrncpy(level, "Restore", sizeof(level));
          break;
       default:
          bstrncpy(level, level_to_str(jcr->getJobLevel()), sizeof(level));
@@ -1107,8 +1113,10 @@ static void list_terminated_jobs(UAContext *ua)
       bstrftime_nc(dt, sizeof(dt), je->end_time);
       switch (je->JobType) {
       case JT_ADMIN:
+         bstrncpy(level, "Admin", sizeof(level));
+         break;
       case JT_RESTORE:
-         bstrncpy(level, "    ", sizeof(level));
+         bstrncpy(level, "Restore", sizeof(level));
          break;
       default:
          bstrncpy(level, level_to_str(je->JobLevel), sizeof(level));
diff --git a/src/filed/bacula-fd.conf.in b/src/filed/bacula-fd.conf.in
index 2c05dd9..0770d9e 100644
--- a/src/filed/bacula-fd.conf.in
+++ b/src/filed/bacula-fd.conf.in
@@ -38,7 +38,7 @@ FileDaemon {                          # this is me
   WorkingDirectory = @working_dir@
   Pid Directory = @piddir@
   Maximum Concurrent Jobs = 20
-# Plugin Directory = @plugindir@
+  Plugin Directory = @plugindir@
 }
 
 # Send all messages except skipped files back to Director
diff --git a/src/lib/bsys.c b/src/lib/bsys.c
index 9235ab2..54add7b 100644
--- a/src/lib/bsys.c
+++ b/src/lib/bsys.c
@@ -327,7 +327,14 @@ int cstrlen(const char *str)
    return len;
 }
 
-
+/* We need to disable the malloc() macro if SMARTALLOC is not used,
+ * else, it points to b_malloc() and causes problems.
+ */
+#ifndef SMARTALLOC
+ #ifdef malloc
+  #undef malloc
+ #endif
+#endif
 
 #ifndef bmalloc
 void *bmalloc(size_t size)
diff --git a/src/lib/cram-md5.c b/src/lib/cram-md5.c
index 035983a..facdbe0 100644
--- a/src/lib/cram-md5.c
+++ b/src/lib/cram-md5.c
@@ -50,6 +50,11 @@ bool cram_md5_challenge(BSOCK *bs, const char *password, int tls_local_need, int
    char host[MAXSTRING];
    uint8_t hmac[20];
 
+   if (!bs) {
+      Dmsg0(dbglvl, "Invalid bsock\n");
+      return false;
+   }
+
    gettimeofday(&t1, &tz);
    for (i=0; i<4; i++) {
       gettimeofday(&t2, &tz);
@@ -110,6 +115,11 @@ bool cram_md5_respond(BSOCK *bs, const char *password, int *tls_remote_need, int
    char chal[MAXSTRING];
    uint8_t hmac[20];
 
+   if (!bs) {
+      Dmsg0(dbglvl, "Invalid bsock\n");
+      return false;
+   }
+
    *compatible = false;
    if (bs->recv() <= 0) {
       bmicrosleep(5, 0);
diff --git a/src/lib/edit.c b/src/lib/edit.c
index 1929011..d7f43b4 100644
--- a/src/lib/edit.c
+++ b/src/lib/edit.c
@@ -350,8 +350,8 @@ static bool strunit_to_uint64(char *str, int str_len, uint64_t *value,
                            1000000,        /* mb megabyte */
                            1073741824,     /* gigabyte */
                            1000000000,     /* gb gigabyte */
-                           1099511627776,  /* terabyte */
-                           1000000000000}; /* tb terabyte */
+                           1099511627776LL,  /* terabyte */
+                           1000000000000LL}; /* tb terabyte */
 
    if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
       return 0;
diff --git a/src/lib/parse_conf.c b/src/lib/parse_conf.c
index dad7f5c..c00a4e6 100644
--- a/src/lib/parse_conf.c
+++ b/src/lib/parse_conf.c
@@ -91,8 +91,8 @@ static bool find_config_file(const char *config_file, char *full_path, int max_p
 RES_ITEM msgs_items[] = {
    {"Name",        store_name,    ITEM(res_msgs.hdr.name),  0, 0, 0},
    {"Description", store_str,     ITEM(res_msgs.hdr.desc),  0, 0, 0},
-   {"MailCommand", store_str,     ITEM(res_msgs.mail_cmd),  0, 0, 0},
-   {"OperatorCommand", store_str, ITEM(res_msgs.operator_cmd), 0, 0, 0},
+   {"MailCommand", store_str,     ITEM(res_msgs.mail_cmd),  0, ITEM_ALLOW_DUPS, 0},
+   {"OperatorCommand", store_str, ITEM(res_msgs.operator_cmd), 0, ITEM_ALLOW_DUPS, 0},
    {"Syslog",      store_msgs, ITEM(res_msgs), MD_SYSLOG,   0, 0},
    {"Mail",        store_msgs, ITEM(res_msgs), MD_MAIL,     0, 0},
    {"MailOnError", store_msgs, ITEM(res_msgs), MD_MAIL_ON_ERROR, 0, 0},
@@ -404,6 +404,10 @@ void store_str(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    lex_get_token(lc, T_STRING);
    if (pass == 1) {
+      if (*(item->value) && (item->flags & ITEM_ALLOW_DUPS)) {
+         free(*(item->value));
+         *(item->value) = NULL;
+      }
       if (*(item->value)) {
          scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"),
             item->name, *(item->value), lc->str, lc->line_no, lc->line);
diff --git a/src/lib/parse_conf.h b/src/lib/parse_conf.h
index 9b147d6..5ae4c74 100644
--- a/src/lib/parse_conf.h
+++ b/src/lib/parse_conf.h
@@ -119,10 +119,12 @@ struct RES_TABLE {
 
 #define MAX_RES_NAME_LENGTH MAX_NAME_LENGTH-1       /* maximum resource name length */
 
-#define ITEM_REQUIRED    0x1          /* item required */
-#define ITEM_DEFAULT     0x2          /* default supplied */
-#define ITEM_NO_EQUALS   0x4          /* Don't scan = after name */
-#define ITEM_LAST        0x8          /* Last item in list */
+/* Permitted bits in Flags field */
+#define ITEM_REQUIRED    (1<<0)       /* item required */
+#define ITEM_DEFAULT     (1<<1)       /* default supplied */
+#define ITEM_NO_EQUALS   (1<<2)       /* Don't scan = after name */
+#define ITEM_LAST        (1<<3)       /* Last item in list */
+#define ITEM_ALLOW_DUPS  (1<<4)       /* Allow duplicate directives */
 
 /* Message Resource */
 class MSGS {
diff --git a/src/lib/util.c b/src/lib/util.c
index 4456c80..88de1b0 100644
--- a/src/lib/util.c
+++ b/src/lib/util.c
@@ -199,6 +199,10 @@ char *asciidump(const char *data, int len, char *buf, int capacity)
 {
    char *b=buf;
    const unsigned char *p=(const unsigned char *)data;
+   if (!data) {
+      strncpy(buf, "<NULL>", capacity);
+      return buf;
+   }
    while (len>0 && capacity>1) {
       if (isprint(*p)) {
          *(b++)=*(p++);
@@ -223,6 +227,10 @@ char *smartdump(const char *data, int len, char *buf, int capacity, bool *is_asc
    int l=len;
    int c=capacity;
    const unsigned char *p=(const unsigned char *)data;
+   if (!data) {
+      strncpy(buf, "<NULL>", capacity);
+      return buf;
+   }
    if (is_ascii != NULL) {
       *is_ascii = false;
    }
diff --git a/src/stored/askdir.c b/src/stored/askdir.c
index d60ae10..af0da08 100644
--- a/src/stored/askdir.c
+++ b/src/stored/askdir.c
@@ -520,17 +520,17 @@ bool dir_create_jobmedia_record(DCR *dcr, bool zero)
    JOBMEDIA_ITEM *item;
    bool ok = true;;
 
-   if (!dcr->WroteVol) {
+   if (!zero && !dcr->WroteVol) {
       return true;
    }
-   if (dcr->VolLastIndex == 0) {
+   if (!zero && dcr->VolLastIndex == 0) {
       Dmsg7(dbglvl, "JobMedia Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n",
          dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId,
          dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock);
       return true;                    /* nothing written to the Volume */
    }
-   if (dcr->StartFile == dcr->EndFile && dcr->EndBlock < dcr->StartBlock) {
-      Dmsg7(0/*dbglvl*/, "PROBLEM Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n",
+   if (!zero && dcr->StartFile == dcr->EndFile && dcr->EndBlock < dcr->StartBlock) {
+      Dmsg7(dbglvl, "JobMedia Vol=%s wrote=%d MediaId=%d FI=%d LI=%d StartBlock=%d EndBlock=%d Suppressed\n",
          dcr->VolumeName, dcr->WroteVol, dcr->VolMediaId,
          dcr->VolFirstIndex, dcr->VolLastIndex, dcr->StartBlock, dcr->EndBlock);
       return true;
diff --git a/src/stored/bextract.c b/src/stored/bextract.c
index 717ceca..a300792 100644
--- a/src/stored/bextract.c
+++ b/src/stored/bextract.c
@@ -646,7 +646,9 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
          prog_name_msg++;
       }
       break;
-
+   case STREAM_PLUGIN_NAME:
+      /* Just ignore the plugin name */
+      break;
    default:
       /* If extracting, weird stream (not 1 or 2), close output file anyway */
       if (extract) {
diff --git a/src/stored/block_util.c b/src/stored/block_util.c
index cedcc8d..3d67de9 100644
--- a/src/stored/block_util.c
+++ b/src/stored/block_util.c
@@ -621,8 +621,8 @@ bool check_for_newvol_or_newfile(DCR *dcr)
          Dmsg0(100, "Canceled\n");
          return false;
       }
-      /* Create a jobmedia record for this job */
-      if (!dir_create_jobmedia_record(dcr)) {
+      /* If we wrote on Volume create a last jobmedia record for this job */
+      if (dcr->VolFirstIndex && !dir_create_jobmedia_record(dcr)) {
          dcr->dev->dev_errno = EIO;
          Jmsg2(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
             dcr->getVolCatName(), jcr->Job);
diff --git a/src/stored/mount.c b/src/stored/mount.c
index 4b81019..960ef83 100644
--- a/src/stored/mount.c
+++ b/src/stored/mount.c
@@ -216,6 +216,8 @@ mount_next_vol:
          break;                       /* created a new volume label */
       }
 
+      /* ***FIXME*** if autochanger, before giving up try unload and load */
+
       Jmsg4(jcr, M_WARNING, 0, _("Open of %s device %s Volume \"%s\" failed: ERR=%s\n"),
             dev->print_type(), dev->print_name(), dcr->VolumeName, dev->bstrerror());
 
diff --git a/src/version.h b/src/version.h
index cfcf2f9..584c351 100644
--- a/src/version.h
+++ b/src/version.h
@@ -5,9 +5,9 @@
 #define COMMUNITY 1      /* Define to create a Windows community binary */
 
 /* Note: there can be only *one* VERSION in this file */
-#define VERSION "7.4.3"
-#define BDATE   "18 June 2016"
-#define LSMDATE "18Jun16"
+#define VERSION "7.4.4"
+#define BDATE   "20 September 2016"
+#define LSMDATE "202Sep16"
 
 #define RELEASE 1   /* Use ONLY in rpms */
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bacula/bacula.git



More information about the pkg-bacula-commits mailing list