+++ /dev/null
-Index: scripts/bacula.in
-===================================================================
---- scripts/bacula.in (revision 7106)
-+++ scripts/bacula.in (working copy)
-@@ -13,22 +13,20 @@
- # easier to "steal" this code for the development
- # environment where they are different.
- #
--BACFDCFG=@sysconfdir@
--BACSDCFG=@sysconfdir@
--BACDIRCFG=@sysconfdir@
-+SCRIPTDIR=@scriptdir@
-
- case "$1" in
- start)
-- [ -x ${BACSDCFG}/bacula-ctl-sd ] && ${BACSDCFG}/bacula-ctl-sd $1 $2
-- [ -x ${BACFDCFG}/bacula-ctl-fd ] && ${BACFDCFG}/bacula-ctl-fd $1 $2
-- [ -x ${BACDIRCFG}/bacula-ctl-dir ] && ${BACDIRCFG}/bacula-ctl-dir $1 $2
-+ [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
-+ [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
-+ [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
- ;;
-
- stop)
- # Stop the FD first so that SD will fail jobs and update catalog
-- [ -x ${BACFDCFG}/bacula-ctl-fd ] && ${BACFDCFG}/bacula-ctl-fd $1 $2
-- [ -x ${BACSDCFG}/bacula-ctl-sd ] && ${BACSDCFG}/bacula-ctl-sd $1 $2
-- [ -x ${BACDIRCFG}/bacula-ctl-dir ] && ${BACDIRCFG}/bacula-ctl-dir $1 $2
-+ [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
-+ [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
-+ [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
- echo
- sleep 6
- ;;
-@@ -39,9 +37,9 @@
- ;;
-
- status)
-- [ -x ${BACSDCFG}/bacula-ctl-sd ] && ${BACSDCFG}/bacula-ctl-sd status
-- [ -x ${BACFDCFG}/bacula-ctl-fd ] && ${BACFDCFG}/bacula-ctl-fd status
-- [ -x ${BACDIRCFG}/bacula-ctl-dir ] && ${BACDIRCFG}/bacula-ctl-dir status
-+ [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
-+ [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
-+ [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status
- ;;
-
- *)
+++ /dev/null
-Index: src/gnome2-console/console_conf.c
-===================================================================
---- src/gnome2-console/console_conf.c (revision 7106)
-+++ src/gnome2-console/console_conf.c (working copy)
-@@ -24,7 +24,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2000-2006 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.
-@@ -82,8 +82,8 @@
- {"dirport", store_int, ITEM(dir_res.DIRport), 0, ITEM_DEFAULT, 9101},
- {"address", store_str, ITEM(dir_res.address), 0, ITEM_REQUIRED, 0},
- {"password", store_password, ITEM(dir_res.password), 0, 0, 0},
-- {"tlsenable", store_bit, ITEM(dir_res.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(dir_res.tls_require), 1, 0, 0},
-+ {"tlsenable", store_bool, ITEM(dir_res.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(dir_res.tls_require), 1, 0, 0},
- {"tlscacertificatefile", store_dir, ITEM(dir_res.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(dir_res.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(dir_res.tls_certfile), 0, 0, 0},
-@@ -95,8 +95,8 @@
- {"name", store_name, ITEM(con_res.hdr.name), 0, ITEM_REQUIRED, 0},
- {"description", store_str, ITEM(con_res.hdr.desc), 0, 0, 0},
- {"password", store_password, ITEM(con_res.password), 0, ITEM_REQUIRED, 0},
-- {"tlsenable", store_bit, ITEM(con_res.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(con_res.tls_require), 1, 0, 0},
-+ {"tlsenable", store_bool, ITEM(con_res.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(con_res.tls_require), 1, 0, 0},
- {"tlscacertificatefile", store_dir, ITEM(con_res.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(con_res.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(con_res.tls_certfile), 0, 0, 0},
-Index: src/gnome2-console/console_conf.h
-===================================================================
---- src/gnome2-console/console_conf.h (revision 7106)
-+++ src/gnome2-console/console_conf.h (working copy)
-@@ -8,7 +8,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
-+ Copyright (C) 2002-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.
-@@ -66,8 +66,8 @@
- int DIRport; /* UA server port */
- char *address; /* UA server address */
- char *password; /* UA server password */
-- int tls_enable; /* Enable TLS */
-- int tls_require; /* Require TLS */
-+ bool tls_enable; /* Enable TLS */
-+ bool tls_require; /* Require TLS */
- char *tls_ca_certfile; /* TLS CA Certificate File */
- char *tls_ca_certdir; /* TLS CA Certificate Directory */
- char *tls_certfile; /* TLS Client Certificate File */
-@@ -84,8 +84,8 @@
- struct CONRES {
- RES hdr;
- char *password; /* UA server password */
-- int tls_enable; /* Enable TLS on all connections */
-- int tls_require; /* Require TLS on all connections */
-+ bool tls_enable; /* Enable TLS on all connections */
-+ bool tls_require; /* Require TLS on all connections */
- char *tls_ca_certfile; /* TLS CA Certificate File */
- char *tls_ca_certdir; /* TLS CA Certificate Directory */
- char *tls_certfile; /* TLS Client Certificate File */
-Index: src/wx-console/console_conf.c
-===================================================================
---- src/wx-console/console_conf.c (revision 7106)
-+++ src/wx-console/console_conf.c (working copy)
-@@ -100,12 +100,12 @@
- {"rcfile", store_dir, ITEM(res_cons.rc_file), 0, 0, 0},
- {"historyfile", store_dir, ITEM(res_cons.hist_file), 0, 0, 0},
- {"password", store_password, ITEM(res_cons.password), 0, ITEM_REQUIRED, 0},
-- {"tlsenable", store_bit, ITEM(res_cons.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(res_cons.tls_require), 1, 0, 0},
- {"tlscacertificatefile", store_dir, ITEM(res_cons.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(res_cons.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(res_cons.tls_certfile), 0, 0, 0},
- {"tlskey", store_dir, ITEM(res_cons.tls_keyfile), 0, 0, 0},
-+ {"tlsenable", store_bool, ITEM(res_cons.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(res_cons.tls_require), 1, 0, 0},
- {NULL, NULL, {0}, 0, 0, 0}
- };
-
-@@ -117,12 +117,12 @@
- {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
- {"address", store_str, ITEM(res_dir.address), 0, 0, 0},
- {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
-- {"tlsenable", store_bit, ITEM(res_dir.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(res_dir.tls_require), 1, 0, 0},
- {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
- {"tlskey", store_dir, ITEM(res_dir.tls_keyfile), 0, 0, 0},
-+ {"tlsenable", store_bool, ITEM(res_dir.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(res_dir.tls_require), 1, 0, 0},
- {NULL, NULL, {0}, 0, 0, 0}
- };
-
-Index: src/wx-console/console_conf.h
-===================================================================
---- src/wx-console/console_conf.h (revision 7106)
-+++ src/wx-console/console_conf.h (working copy)
-@@ -4,7 +4,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2000-2006 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.
-@@ -63,14 +63,13 @@
- char *rc_file; /* startup file */
- char *hist_file; /* command history file */
- char *password; /* UA server password */
-- int tls_enable; /* Enable TLS on all connections */
-- int tls_require; /* Require TLS on all connections */
- char *tls_ca_certfile; /* TLS CA Certificate File */
- char *tls_ca_certdir; /* TLS CA Certificate Directory */
- char *tls_certfile; /* TLS Client Certificate File */
- char *tls_keyfile; /* TLS Client Key File */
--
- TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
-+ bool tls_enable; /* Enable TLS on all connections */
-+ bool tls_require; /* Require TLS on all connections */
- };
-
- /* Director */
-@@ -79,14 +78,13 @@
- int DIRport; /* UA server port */
- char *address; /* UA server address */
- char *password; /* UA server password */
-- int tls_enable; /* Enable TLS on all connections */
-- int tls_require; /* Require TLS on all connections */
- char *tls_ca_certfile; /* TLS CA Certificate File */
- char *tls_ca_certdir; /* TLS CA Certificate Directory */
- char *tls_certfile; /* TLS Client Certificate File */
- char *tls_keyfile; /* TLS Client Key File */
--
- TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
-+ bool tls_enable; /* Enable TLS on all connections */
-+ bool tls_require; /* Require TLS on all connections */
- };
-
-
-Index: src/stored/stored_conf.c
-===================================================================
---- src/stored/stored_conf.c (revision 7106)
-+++ src/stored/stored_conf.c (working copy)
-@@ -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.
-@@ -77,9 +77,9 @@
- {"scriptsdirectory", store_dir, ITEM(res_store.scripts_directory), 0, 0, 0},
- {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
- {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
-- {"tlsenable", store_bit, ITEM(res_store.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(res_store.tls_require), 1, 0, 0},
-- {"tlsverifypeer", store_bit, ITEM(res_store.tls_verify_peer), 1, ITEM_DEFAULT, 1},
-+ {"tlsenable", store_bool, ITEM(res_store.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(res_store.tls_require), 1, 0, 0},
-+ {"tlsverifypeer", store_bool, ITEM(res_store.tls_verify_peer), 1, ITEM_DEFAULT, 1},
- {"tlscacertificatefile", store_dir, ITEM(res_store.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(res_store.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(res_store.tls_certfile), 0, 0, 0},
-@@ -96,10 +96,10 @@
- {"name", store_name, ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
- {"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0},
- {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
-- {"monitor", store_bit, ITEM(res_dir.monitor), 1, ITEM_DEFAULT, 0},
-- {"tlsenable", store_bit, ITEM(res_dir.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(res_dir.tls_require), 1, 0, 0},
-- {"tlsverifypeer", store_bit, ITEM(res_dir.tls_verify_peer), 1, ITEM_DEFAULT, 1},
-+ {"monitor", store_bool, ITEM(res_dir.monitor), 1, ITEM_DEFAULT, 0},
-+ {"tlsenable", store_bool, ITEM(res_dir.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(res_dir.tls_require), 1, 0, 0},
-+ {"tlsverifypeer", store_bool, ITEM(res_dir.tls_verify_peer), 1, ITEM_DEFAULT, 1},
- {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
-@@ -137,7 +137,7 @@
- {"checklabels", store_bit, ITEM(res_dev.cap_bits), CAP_CHECKLABELS, ITEM_DEFAULT, 0},
- {"requiresmount", store_bit, ITEM(res_dev.cap_bits), CAP_REQMOUNT, ITEM_DEFAULT, 0},
- {"offlineonunmount", store_bit, ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0},
-- {"autoselect", store_bit, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
-+ {"autoselect", store_bool, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
- {"changerdevice", store_strname,ITEM(res_dev.changer_name), 0, 0, 0},
- {"changercommand", store_strname,ITEM(res_dev.changer_command), 0, 0, 0},
- {"alertcommand", store_strname,ITEM(res_dev.alert_command), 0, 0, 0},
-@@ -177,9 +177,6 @@
- };
-
-
--// {"mountanonymousvolumes", store_bit, ITEM(res_dev.cap_bits), CAP_ANONVOLS, ITEM_DEFAULT, 0},
--
--
- /* Message resource */
- extern RES_ITEM msgs_items[];
-
-Index: src/stored/stored_conf.h
-===================================================================
---- src/stored/stored_conf.h (revision 7106)
-+++ src/stored/stored_conf.h (working copy)
-@@ -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.
-@@ -126,9 +126,9 @@
- char *spool_directory; /* Spool file directory */
- int dev_type; /* device type */
- int label_type; /* label type */
-- int autoselect; /* Automatically select from AutoChanger */
-+ bool autoselect; /* Automatically select from AutoChanger */
- uint32_t drive_index; /* Autochanger drive index */
-- uint32_t cap_bits; /* Capabilities of this device */
-+ int cap_bits; /* Capabilities of this device */
- utime_t max_changer_wait; /* Changer timeout */
- utime_t max_rewind_wait; /* maximum secs to wait for rewind */
- utime_t max_open_wait; /* maximum secs to wait for open */
-Index: src/console/console_conf.c
-===================================================================
---- src/console/console_conf.c (revision 7106)
-+++ src/console/console_conf.c (working copy)
-@@ -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.
-@@ -88,8 +88,8 @@
- {"rcfile", store_dir, ITEM(res_cons.rc_file), 0, 0, 0},
- {"historyfile", store_dir, ITEM(res_cons.hist_file), 0, 0, 0},
- {"password", store_password, ITEM(res_cons.password), 0, ITEM_REQUIRED, 0},
-- {"tlsenable", store_bit, ITEM(res_cons.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(res_cons.tls_require), 1, 0, 0},
-+ {"tlsenable", store_bool, ITEM(res_cons.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(res_cons.tls_require), 1, 0, 0},
- {"tlscacertificatefile", store_dir, ITEM(res_cons.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(res_cons.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(res_cons.tls_certfile), 0, 0, 0},
-@@ -107,8 +107,8 @@
- {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
- {"address", store_str, ITEM(res_dir.address), 0, 0, 0},
- {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
-- {"tlsenable", store_bit, ITEM(res_dir.tls_enable), 1, 0, 0},
-- {"tlsrequire", store_bit, ITEM(res_dir.tls_require), 1, 0, 0},
-+ {"tlsenable", store_bool, ITEM(res_dir.tls_enable), 1, 0, 0},
-+ {"tlsrequire", store_bool, ITEM(res_dir.tls_require), 1, 0, 0},
- {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
- {"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
- {"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
-Index: src/console/console_conf.h
-===================================================================
---- src/console/console_conf.h (revision 7106)
-+++ src/console/console_conf.h (working copy)
-@@ -64,16 +64,15 @@
- char *rc_file; /* startup file */
- char *hist_file; /* command history file */
- char *password; /* UA server password */
-- int tls_enable; /* Enable TLS on all connections */
-- int tls_require; /* Require TLS on all connections */
- char *tls_ca_certfile; /* TLS CA Certificate File */
- char *tls_ca_certdir; /* TLS CA Certificate Directory */
- char *tls_certfile; /* TLS Client Certificate File */
- char *tls_keyfile; /* TLS Client Key File */
- char *director; /* bind to director */
- utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
--
- TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
-+ bool tls_enable; /* Enable TLS on all connections */
-+ bool tls_require; /* Require TLS on all connections */
- };
-
- /* Director */
-@@ -82,15 +81,14 @@
- int DIRport; /* UA server port */
- char *address; /* UA server address */
- char *password; /* UA server password */
-- int tls_enable; /* Enable TLS */
-- int tls_require; /* Require TLS */
- char *tls_ca_certfile; /* TLS CA Certificate File */
- char *tls_ca_certdir; /* TLS CA Certificate Directory */
- char *tls_certfile; /* TLS Client Certificate File */
- char *tls_keyfile; /* TLS Client Key File */
- utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
--
- TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
-+ bool tls_enable; /* Enable TLS */
-+ bool tls_require; /* Require TLS */
- };
-
-
-Index: src/tray-monitor/tray_conf.c
-===================================================================
---- src/tray-monitor/tray_conf.c (revision 7106)
-+++ src/tray-monitor/tray_conf.c (working copy)
-@@ -82,7 +82,7 @@
- static RES_ITEM mon_items[] = {
- {"name", store_name, ITEM(res_monitor.hdr.name), 0, ITEM_REQUIRED, 0},
- {"description", store_str, ITEM(res_monitor.hdr.desc), 0, 0, 0},
-- {"requiressl", store_bit, ITEM(res_monitor.require_ssl), 1, ITEM_DEFAULT, 0},
-+ {"requiressl", store_bool, ITEM(res_monitor.require_ssl), 1, ITEM_DEFAULT, 0},
- {"password", store_password, ITEM(res_monitor.password), 0, ITEM_REQUIRED, 0},
- {"refreshinterval", store_time,ITEM(res_monitor.RefreshInterval), 0, ITEM_DEFAULT, 5},
- {"fdconnecttimeout", store_time,ITEM(res_monitor.FDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
-@@ -96,7 +96,7 @@
- {"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0},
- {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
- {"address", store_str, ITEM(res_dir.address), 0, 0, 0},
-- {"enablessl", store_bit, ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
-+ {"enablessl", store_bool, ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
- {NULL, NULL, {0}, 0, 0, 0}
- };
-
-@@ -112,7 +112,7 @@
- {"address", store_str, ITEM(res_client.address), 0, ITEM_REQUIRED, 0},
- {"fdport", store_pint, ITEM(res_client.FDport), 0, ITEM_DEFAULT, 9102},
- {"password", store_password, ITEM(res_client.password), 0, ITEM_REQUIRED, 0},
-- {"enablessl", store_bit, ITEM(res_client.enable_ssl), 1, ITEM_DEFAULT, 0},
-+ {"enablessl", store_bool, ITEM(res_client.enable_ssl), 1, ITEM_DEFAULT, 0},
- {NULL, NULL, {0}, 0, 0, 0}
- };
-
-@@ -128,7 +128,7 @@
- {"sdaddress", store_str, ITEM(res_store.address), 0, 0, 0},
- {"password", store_password, ITEM(res_store.password), 0, ITEM_REQUIRED, 0},
- {"sdpassword", store_password, ITEM(res_store.password), 0, 0, 0},
-- {"enablessl", store_bit, ITEM(res_store.enable_ssl), 1, ITEM_DEFAULT, 0},
-+ {"enablessl", store_bool, ITEM(res_store.enable_ssl), 1, ITEM_DEFAULT, 0},
- {NULL, NULL, {0}, 0, 0, 0}
- };
-
-Index: src/tray-monitor/tray_conf.h
-===================================================================
---- src/tray-monitor/tray_conf.h (revision 7106)
-+++ src/tray-monitor/tray_conf.h (working copy)
-@@ -1,7 +1,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
-+ Copyright (C) 2004-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.
-@@ -67,7 +67,7 @@
- RES hdr;
- int DIRport; /* UA server port */
- char *address; /* UA server address */
-- int enable_ssl; /* Use SSL */
-+ bool enable_ssl; /* Use SSL */
- };
-
- /*
-@@ -95,7 +95,7 @@
- int FDport; /* Where File daemon listens */
- char *address;
- char *password;
-- int enable_ssl; /* Use SSL */
-+ bool enable_ssl; /* Use SSL */
- };
-
- /*
-@@ -108,7 +108,7 @@
- int SDport; /* port where Directors connect */
- char *address;
- char *password;
-- int enable_ssl; /* Use SSL */
-+ bool enable_ssl; /* Use SSL */
- };
-
- struct CONFONTRES {
+++ /dev/null
-
- This patch should fix (not tested) the recycling bug #1106 when using
- two autochangers. There is a much smaller chance that it also fixes
- bug #1103 where a volume is recycled when it is full.
-
- Apply the patch to version 2.4.0 with:
-
- cd <bacula-source>
- patch -p0 <2.4.0-recycle.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-
-Index: src/dird/autoprune.c
-===================================================================
---- src/dird/autoprune.c (revision 7178)
-+++ src/dird/autoprune.c (working copy)
-@@ -96,7 +96,7 @@
- POOL_MEM query(PM_MESSAGE);
- UAContext *ua;
- bool ok = false;
-- char ed1[50], ed2[100];
-+ char ed1[50], ed2[100], ed3[50];
- POOL_DBR spr;
-
- Dmsg1(050, "Prune volumes PoolId=%d\n", jcr->jr.PoolId);
-@@ -138,10 +138,18 @@
- * RecyclePoolId is the current pool or the scratch pool
- */
- const char *select = "SELECT DISTINCT MediaId,LastWritten FROM Media WHERE "
-- "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' "
-+ "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' %s"
- "ORDER BY LastWritten ASC,MediaId";
-
-- Mmsg(query, select, ed1, ed2, mr->MediaType);
-+ if (InChanger) {
-+ char changer[100];
-+ /* Ensure it is in this autochanger */
-+ bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
-+ edit_int64(mr->StorageId, ed3));
-+ Mmsg(query, select, ed1, ed2, mr->MediaType, changer);
-+ } else {
-+ Mmsg(query, select, ed1, ed2, mr->MediaType, "");
-+ }
-
- Dmsg1(050, "query=%s\n", query.c_str());
- if (!db_get_query_dbids(ua->jcr, ua->db, query, ids)) {
-Index: src/dird/recycle.c
-===================================================================
---- src/dird/recycle.c (revision 7178)
-+++ src/dird/recycle.c (working copy)
-@@ -83,12 +83,19 @@
- const char *select =
- "SELECT MediaId,LastWritten FROM Media "
- "WHERE PoolId=%s AND Recycle=1 AND VolStatus='Purged' "
-- "AND Enabled=1 AND MediaType='%s' "
-+ "AND Enabled=1 AND MediaType='%s' %s"
- "ORDER BY LastWritten ASC,MediaId LIMIT 1";
-
- Dmsg0(100, "Enter recycle_oldest_purged_volume\n");
- oldest.MediaId = 0;
-- Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType);
-+ if (InChanger) {
-+ char changer[100];
-+ bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
-+ edit_int64(mr->StorageId, ed1));
-+ Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, changer);
-+ } else {
-+ Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, "");
-+ }
-
- if (!db_sql_query(jcr->db, query, oldest_handler, (void *)&oldest)) {
- Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
+++ /dev/null
-
- This patch should fix bug #1094 where jobs that wrote bytes and are rescheduled
- do not keep any Pool overrides that were specified in the Schedule Run
- directives. The patch also simplifies the resource lock inc/dec.
-
- Apply it to 2.4.0 with:
-
- cd <bacula-source>
- patch -p0 <2.4.0-reschedule.patch
- ./configure <your options>
- make
- ...
- make install
-
-
-Index: src/dird/jobq.c
-===================================================================
---- src/dird/jobq.c (revision 7178)
-+++ src/dird/jobq.c (working copy)
-@@ -1,7 +1,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2003-2007 Free Software Foundation Europe e.V.
-+ Copyright (C) 2003-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.
-@@ -56,9 +56,10 @@
-
- static int start_server(jobq_t *jq);
- static bool acquire_resources(JCR *jcr);
-+static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je);
-+static void dec_read_store(JCR *jcr);
-+static void dec_write_store(JCR *jcr);
-
--
--
- /*
- * Initialize a job queue
- *
-@@ -357,8 +358,8 @@
- pthread_t id;
-
- /*
-- * if any threads are idle, wake one --
-- * actually we do a broadcast because on /lib/tls
-+ * if any threads are idle, wake one.
-+ * Actually we do a broadcast because on /lib/tls
- * these signals seem to get lost from time to time.
- */
- if (jq->idle_workers > 0) {
-@@ -477,87 +478,17 @@
- * put into the ready queue.
- */
- if (jcr->acquired_resource_locks) {
-- if (jcr->rstore) {
-- jcr->rstore->NumConcurrentJobs--;
-- Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
-- }
-- if (jcr->wstore) {
-- jcr->wstore->NumConcurrentJobs--;
-- Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
-- }
-+ dec_read_store(jcr);
-+ dec_write_store(jcr);
- jcr->client->NumConcurrentJobs--;
- jcr->job->NumConcurrentJobs--;
- jcr->acquired_resource_locks = false;
- }
-
-- /*
-- * Reschedule the job if necessary and requested
-- */
-- if (jcr->job->RescheduleOnError &&
-- jcr->JobStatus != JS_Terminated &&
-- jcr->JobStatus != JS_Canceled &&
-- jcr->JobType == JT_BACKUP &&
-- (jcr->job->RescheduleTimes == 0 ||
-- jcr->reschedule_count < jcr->job->RescheduleTimes)) {
-- char dt[50], dt2[50];
-+ if (reschedule_job(jcr, jq, je)) {
-+ continue; /* go look for more work */
-+ }
-
-- /*
-- * Reschedule this job by cleaning it up, but
-- * reuse the same JobId if possible.
-- */
-- time_t now = time(NULL);
-- jcr->reschedule_count++;
-- jcr->sched_time = now + jcr->job->RescheduleInterval;
-- bstrftime(dt, sizeof(dt), now);
-- bstrftime(dt2, sizeof(dt2), jcr->sched_time);
-- Dmsg4(2300, "Rescheduled Job %s to re-run in %d seconds.(now=%u,then=%u)\n", jcr->Job,
-- (int)jcr->job->RescheduleInterval, now, jcr->sched_time);
-- Jmsg(jcr, M_INFO, 0, _("Rescheduled Job %s at %s to re-run in %d seconds (%s).\n"),
-- jcr->Job, dt, (int)jcr->job->RescheduleInterval, dt2);
-- dird_free_jcr_pointers(jcr); /* partial cleanup old stuff */
-- jcr->JobStatus = -1;
-- set_jcr_job_status(jcr, JS_WaitStartTime);
-- jcr->SDJobStatus = 0;
-- if (jcr->JobBytes == 0) {
-- Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count());
-- V(jq->mutex);
-- jobq_add(jq, jcr); /* queue the job to run again */
-- P(jq->mutex);
-- free_jcr(jcr); /* release jcr */
-- free(je); /* free the job entry */
-- continue; /* look for another job to run */
-- }
-- /*
-- * Something was actually backed up, so we cannot reuse
-- * the old JobId or there will be database record
-- * conflicts. We now create a new job, copying the
-- * appropriate fields.
-- */
-- JCR *njcr = new_jcr(sizeof(JCR), dird_free_jcr);
-- set_jcr_defaults(njcr, jcr->job);
-- njcr->reschedule_count = jcr->reschedule_count;
-- njcr->sched_time = jcr->sched_time;
-- njcr->JobLevel = jcr->JobLevel;
-- njcr->JobStatus = -1;
-- set_jcr_job_status(njcr, jcr->JobStatus);
-- if (jcr->rstore) {
-- copy_rstorage(njcr, jcr->rstorage, _("previous Job"));
-- } else {
-- free_rstorage(njcr);
-- }
-- if (jcr->wstore) {
-- copy_wstorage(njcr, jcr->wstorage, _("previous Job"));
-- } else {
-- free_wstorage(njcr);
-- }
-- njcr->messages = jcr->messages;
-- Dmsg0(2300, "Call to run new job\n");
-- V(jq->mutex);
-- run_job(njcr); /* This creates a "new" job */
-- free_jcr(njcr); /* release "new" jcr */
-- P(jq->mutex);
-- Dmsg0(2300, "Back from running new job.\n");
-- }
- /* Clean up and release old jcr */
- Dmsg2(2300, "====== Termination job=%d use_cnt=%d\n", jcr->JobId, jcr->use_count());
- jcr->SDJobStatus = 0;
-@@ -671,6 +602,91 @@
- }
-
- /*
-+ * Returns true if cleanup done and we should look for more work
-+ */
-+static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
-+{
-+ /*
-+ * Reschedule the job if necessary and requested
-+ */
-+ if (jcr->job->RescheduleOnError &&
-+ jcr->JobStatus != JS_Terminated &&
-+ jcr->JobStatus != JS_Canceled &&
-+ jcr->JobType == JT_BACKUP &&
-+ (jcr->job->RescheduleTimes == 0 ||
-+ jcr->reschedule_count < jcr->job->RescheduleTimes)) {
-+ char dt[50], dt2[50];
-+
-+ /*
-+ * Reschedule this job by cleaning it up, but
-+ * reuse the same JobId if possible.
-+ */
-+ time_t now = time(NULL);
-+ jcr->reschedule_count++;
-+ jcr->sched_time = now + jcr->job->RescheduleInterval;
-+ bstrftime(dt, sizeof(dt), now);
-+ bstrftime(dt2, sizeof(dt2), jcr->sched_time);
-+ Dmsg4(2300, "Rescheduled Job %s to re-run in %d seconds.(now=%u,then=%u)\n", jcr->Job,
-+ (int)jcr->job->RescheduleInterval, now, jcr->sched_time);
-+ Jmsg(jcr, M_INFO, 0, _("Rescheduled Job %s at %s to re-run in %d seconds (%s).\n"),
-+ jcr->Job, dt, (int)jcr->job->RescheduleInterval, dt2);
-+ dird_free_jcr_pointers(jcr); /* partial cleanup old stuff */
-+ jcr->JobStatus = -1;
-+ set_jcr_job_status(jcr, JS_WaitStartTime);
-+ jcr->SDJobStatus = 0;
-+ if (jcr->JobBytes == 0) {
-+ Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count());
-+ V(jq->mutex);
-+ jobq_add(jq, jcr); /* queue the job to run again */
-+ P(jq->mutex);
-+ free_jcr(jcr); /* release jcr */
-+ free(je); /* free the job entry */
-+ return true; /* we already cleaned up */
-+ }
-+ /*
-+ * Something was actually backed up, so we cannot reuse
-+ * the old JobId or there will be database record
-+ * conflicts. We now create a new job, copying the
-+ * appropriate fields.
-+ */
-+ JCR *njcr = new_jcr(sizeof(JCR), dird_free_jcr);
-+ set_jcr_defaults(njcr, jcr->job);
-+ njcr->reschedule_count = jcr->reschedule_count;
-+ njcr->sched_time = jcr->sched_time;
-+ njcr->JobLevel = jcr->JobLevel;
-+ njcr->pool = jcr->pool;
-+ njcr->run_pool_override = jcr->run_pool_override;
-+ njcr->full_pool = jcr->full_pool;
-+ njcr->run_full_pool_override = jcr->run_full_pool_override;
-+ njcr->inc_pool = jcr->inc_pool;
-+ njcr->run_inc_pool_override = jcr->run_inc_pool_override;
-+ njcr->diff_pool = jcr->diff_pool;
-+ njcr->JobStatus = -1;
-+ set_jcr_job_status(njcr, jcr->JobStatus);
-+ if (jcr->rstore) {
-+ copy_rstorage(njcr, jcr->rstorage, _("previous Job"));
-+ } else {
-+ free_rstorage(njcr);
-+ }
-+ if (jcr->wstore) {
-+ copy_wstorage(njcr, jcr->wstorage, _("previous Job"));
-+ } else {
-+ free_wstorage(njcr);
-+ }
-+ njcr->messages = jcr->messages;
-+ njcr->spool_data = jcr->spool_data;
-+ njcr->write_part_after_job = jcr->write_part_after_job;
-+ Dmsg0(2300, "Call to run new job\n");
-+ V(jq->mutex);
-+ run_job(njcr); /* This creates a "new" job */
-+ free_jcr(njcr); /* release "new" jcr */
-+ P(jq->mutex);
-+ Dmsg0(2300, "Back from running new job.\n");
-+ }
-+ return false;
-+}
-+
-+/*
- * See if we can acquire all the necessary resources for the job (JCR)
- *
- * Returns: true if successful
-@@ -681,11 +697,19 @@
- bool skip_this_jcr = false;
-
- jcr->acquired_resource_locks = false;
-+ if (jcr->rstore == jcr->wstore) { /* deadlock */
-+ Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
-+ " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
-+ jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
-+ set_jcr_job_status(jcr, JS_Canceled);
-+ return false;
-+ }
- if (jcr->rstore) {
- Dmsg1(200, "Rstore=%s\n", jcr->rstore->name());
- if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) {
-+// jcr->rstore->NumConcurrentReadJobs++;
- jcr->rstore->NumConcurrentJobs++;
-- Dmsg0(200, "Set rncj=1\n");
-+ Dmsg1(200, "Inc rncj=%d\n", jcr->rstore->NumConcurrentJobs);
- } else {
- Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs);
- set_jcr_job_status(jcr, JS_WaitStoreRes);
-@@ -695,25 +719,11 @@
-
- if (jcr->wstore) {
- Dmsg1(200, "Wstore=%s\n", jcr->wstore->name());
-- if (jcr->rstore == jcr->wstore) { /* deadlock */
-- jcr->rstore->NumConcurrentJobs--; /* back out rstore */
-- Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
-- " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
-- jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
-- set_jcr_job_status(jcr, JS_Canceled);
-- return false;
-- }
-- if (jcr->wstore->NumConcurrentJobs == 0 &&
-- jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
-- /* Simple case, first job */
-- jcr->wstore->NumConcurrentJobs = 1;
-- Dmsg0(200, "Set wncj=1\n");
-- } else if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
-+ if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
- jcr->wstore->NumConcurrentJobs++;
- Dmsg1(200, "Inc wncj=%d\n", jcr->wstore->NumConcurrentJobs);
- } else if (jcr->rstore) {
-- jcr->rstore->NumConcurrentJobs--; /* back out rstore */
-- Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
-+ dec_read_store(jcr);
- skip_this_jcr = true;
- } else {
- Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
-@@ -729,14 +739,8 @@
- jcr->client->NumConcurrentJobs++;
- } else {
- /* Back out previous locks */
-- if (jcr->wstore) {
-- jcr->wstore->NumConcurrentJobs--;
-- Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
-- }
-- if (jcr->rstore) {
-- jcr->rstore->NumConcurrentJobs--;
-- Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
-- }
-+ dec_write_store(jcr);
-+ dec_read_store(jcr);
- set_jcr_job_status(jcr, JS_WaitClientRes);
- return false;
- }
-@@ -744,14 +748,8 @@
- jcr->job->NumConcurrentJobs++;
- } else {
- /* Back out previous locks */
-- if (jcr->wstore) {
-- jcr->wstore->NumConcurrentJobs--;
-- Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
-- }
-- if (jcr->rstore) {
-- jcr->rstore->NumConcurrentJobs--;
-- Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
-- }
-+ dec_write_store(jcr);
-+ dec_read_store(jcr);
- jcr->client->NumConcurrentJobs--;
- set_jcr_job_status(jcr, JS_WaitJobRes);
- return false;
-@@ -760,3 +758,23 @@
- jcr->acquired_resource_locks = true;
- return true;
- }
-+
-+static void dec_read_store(JCR *jcr)
-+{
-+ if (jcr->rstore) {
-+// jcr->rstore->NumConcurrentReadJobs--; /* back out rstore */
-+ jcr->rstore->NumConcurrentJobs--; /* back out rstore */
-+ Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
-+// ASSERT(jcr->rstore->NumConcurrentReadJobs >= 0);
-+ ASSERT(jcr->rstore->NumConcurrentJobs >= 0);
-+ }
-+}
-+
-+static void dec_write_store(JCR *jcr)
-+{
-+ if (jcr->wstore) {
-+ jcr->wstore->NumConcurrentJobs--;
-+ Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
-+ ASSERT(jcr->wstore->NumConcurrentJobs >= 0);
-+ }
-+}
+++ /dev/null
-
- This patch should fix a volume locking deadlock condition in the
- Storage daemon as reported in bug #1100.
-
- Apply it to version 2.4.0 with:
-
- cd <bacula-source>
- patch -p0 <2.4.0-sd-deadlock.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/stored/mount.c
-===================================================================
---- src/stored/mount.c (revision 7204)
-+++ src/stored/mount.c (working copy)
-@@ -179,9 +179,13 @@
- }
- Dmsg2(150, "Ask=%d autochanger=%d\n", ask, autochanger);
-
-- if (ask && !dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
-- Dmsg0(150, "Error return ask_sysop ...\n");
-- goto bail_out; /* error return */
-+ if (ask) {
-+ unlock_volumes();
-+ if (!dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
-+ Dmsg0(150, "Error return ask_sysop ...\n");
-+ goto no_lock_bail_out; /* error return */
-+ }
-+ lock_volumes();
- }
- if (job_canceled(jcr)) {
- goto bail_out;
+++ /dev/null
-
- This patch should fix bug #1118 where bat does not restore correctly
- if multiple pools were used. Bat actually works correctly, but the default
- Pool is taken from the Job resource, and for multiple pools the default
- should be Any. This patch makes Any the default restore pool.
- Apply it to version 2.4.1 with:
-
- cd <bacula-source>
- patch -p0 <2.4.1-bat-restore.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/qt-console/restore/prerestore.cpp
-===================================================================
---- src/qt-console/restore/prerestore.cpp (revision 7414)
-+++ src/qt-console/restore/prerestore.cpp (working copy)
-@@ -1,7 +1,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2007-20087 Free Software Foundation Europe e.V.
-+ Copyright (C) 2007-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.
-@@ -20,7 +20,7 @@
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
-- Bacula® is a registered trademark of John Walker.
-+ Bacula® is a registered trademark of Kern Sibbald.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
-@@ -146,7 +146,7 @@
- cmd += " fileset=\"" + filesetCombo->currentText() + "\"";
- cmd += " client=\"" + clientCombo->currentText() + "\"";
- if (selectJobRadio->isChecked()) {
-- if (poolCombo->currentText() != "Any" ){
-+ if (poolCombo->currentText() != tr("Any") ){
- cmd += " pool=\"" + poolCombo->currentText() + "\"";
- }
- cmd += " storage=\"" + storageCombo->currentText() + "\"";
-@@ -171,12 +171,10 @@
- Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
- }
- m_console->write_dir(cmd.toUtf8().data());
--// consoleCommand(cmd);
-
- /* Note, do not turn notifier back on here ... */
- if (selectFilesRadio->isChecked()) {
- setConsoleCurrent();
--// new restorePage();
- closeStackPage();
- } else {
- closeStackPage();
-@@ -210,7 +208,7 @@
- if (m_console->get_job_defaults(job_defs)) {
- filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
- clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
-- poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
-+ poolCombo->setCurrentIndex(poolCombo->findText(tr("Any"), Qt::MatchExactly));
- storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
- }
- }
+++ /dev/null
-
- This patch should help prevent jobs from being migrated twice if
- you happen to run two migration jobs at the same time. This should
- fix or improve the problem reported in bug #1129.
- Apply it to version 2.4.1 with:
-
- cd <bacula-source>
- patch -p0 <2.4.1-migration.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-
-Index: src/dird/migrate.c
-===================================================================
---- src/dird/migrate.c (revision 7433)
-+++ src/dird/migrate.c (working copy)
-@@ -1,7 +1,7 @@
- /*
- Bacula® - The Network Backup Solution
-
-- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
-+ Copyright (C) 2004-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.
-@@ -274,6 +274,21 @@
- return true;
- }
-
-+ if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) {
-+ Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to migrate. ERR=%s"),
-+ edit_int64(jcr->previous_jr.JobId, ed1),
-+ db_strerror(jcr->db));
-+ set_jcr_job_status(jcr, JS_Terminated);
-+ migration_cleanup(jcr, jcr->JobStatus);
-+ return true;
-+ }
-+ /* Make sure this job was not already migrated */
-+ if (jcr->previous_jr.JobType != JT_BACKUP) {
-+ set_jcr_job_status(jcr, JS_Terminated);
-+ migration_cleanup(jcr, jcr->JobStatus);
-+ return true;
-+ }
-+
- /* Print Job Start message */
- Jmsg(jcr, M_INFO, 0, _("Start Migration JobId %s, Job=%s\n"),
- edit_uint64(jcr->JobId, ed1), jcr->Job);
+++ /dev/null
-
- This patch causes the SD to try at least once to mount a Volume
- that is not in an Autochanger before asking the operator to
- intervene. Without it, the user must issue a mount command for
- every File based volume that is needed.
-
- Apply to 2.4.1 with the following:
-
- cd <bacula-source>
- patch -p0 <2.4.1-mount.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/stored/mount.c
-===================================================================
---- src/stored/mount.c (revision 7378)
-+++ src/stored/mount.c (working copy)
-@@ -142,7 +142,7 @@
- } else {
- autochanger = false;
- VolCatInfo.Slot = 0;
-- ask = true;
-+ ask = retry >= 2;
- }
- Dmsg1(150, "autoload_dev returns %d\n", autochanger);
- /*
+++ /dev/null
-
- This patch removes an unfortunate piece of debug code that crept into
- the 2.4.1 release and causes it to purposely, but incorrectly seg fault
- whenever a volume name error occurs. Typically this may happen if a
- non-bacula tape is mounted at startup or at the end of volume during
- restore.
-
- Apply the patch with:
-
- cd <bacula-source>
- patch -p0 <2.4.1-sd-crash.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-
-Index: src/stored/acquire.c
-===================================================================
---- src/stored/acquire.c (revision 7405)
-+++ src/stored/acquire.c (working copy)
-@@ -266,7 +266,6 @@
- dev->close();
- }
- dev->set_load();
-- ASSERT(0);
- /* Fall through */
- default:
- Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
+++ /dev/null
-
- This patch corrects a problem of manual mounting of volumes,
- where Bacula will accept an incorrect volume for restore.
- Apply it to version 2.4.1 with:
-
- cd <bacula-source>
- patch -p0 <2.4.1-wrong-volume.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-
-Index: src/stored/mount.c
-===================================================================
---- src/stored/mount.c (revision 7422)
-+++ src/stored/mount.c (working copy)
-@@ -20,7 +20,7 @@
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
-- Bacula® is a registered trademark of John Walker.
-+ Bacula® is a registered trademark of Kern Sibbald.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
-@@ -113,7 +113,9 @@
- ask = true; /* ask operator to mount tape */
- do_find = true; /* re-find a volume after unload */
- }
-- do_swapping(true /*writing*/);
-+ do_unload();
-+ do_swapping(true /*is_writing*/);
-+ do_load(true /*is_writing*/);
-
- if (do_find && !find_a_volume()) {
- goto no_lock_bail_out;
-@@ -500,12 +502,30 @@
- return dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE);
- }
-
--void DCR::do_swapping(bool is_writing)
-+bool DCR::do_unload()
- {
- if (dev->must_unload()) {
- Dmsg1(100, "must_unload release %s\n", dev->print_name());
- release_volume();
- }
-+ return false;
-+}
-+
-+bool DCR::do_load(bool is_writing)
-+{
-+ if (dev->must_load()) {
-+ Dmsg1(100, "Must load %s\n", dev->print_name());
-+ if (autoload_device(this, is_writing, NULL) > 0) {
-+ dev->clear_load();
-+ return true;
-+ }
-+ return false;
-+ }
-+ return true;
-+}
-+
-+void DCR::do_swapping(bool is_writing)
-+{
- /*
- * See if we are asked to swap the Volume from another device
- * if so, unload the other device here, and attach the
-@@ -522,17 +542,12 @@
- }
- if (dev->vol) {
- dev->vol->clear_swapping();
-+ Dmsg1(100, "=== set in_use vol=%s\n", dev->vol->vol_name);
- dev->vol->set_in_use();
- dev->VolHdr.VolumeName[0] = 0; /* don't yet have right Volume */
- }
- dev->swap_dev = NULL;
- }
-- if (dev->must_load()) {
-- Dmsg1(100, "Must load %s\n", dev->print_name());
-- if (autoload_device(this, is_writing, NULL) > 0) {
-- dev->clear_load();
-- }
-- }
- }
-
-
-Index: src/stored/dev.h
-===================================================================
---- src/stored/dev.h (revision 7422)
-+++ src/stored/dev.h (working copy)
-@@ -542,6 +542,8 @@
- int check_volume_label(bool &ask, bool &autochanger);
- void release_volume();
- void do_swapping(bool is_writing);
-+ bool do_unload();
-+ bool do_load(bool is_writing);
- bool is_tape_position_ok();
- };
-
-Index: src/stored/acquire.c
-===================================================================
---- src/stored/acquire.c (revision 7422)
-+++ src/stored/acquire.c (working copy)
-@@ -20,7 +20,7 @@
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
-- Bacula® is a registered trademark of John Walker.
-+ Bacula® is a registered trademark of Kern Sibbald.
- The licensor of Bacula is the Free Software Foundation Europe
- (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
- Switzerland, email:ftf@fsfeurope.org.
-@@ -38,6 +38,7 @@
-
- /* Forward referenced functions */
- static void attach_dcr_to_dev(DCR *dcr);
-+static void set_dcr_from_vol(DCR *dcr, VOL_LIST *vol);
-
-
- /*********************************************************************
-@@ -88,15 +89,9 @@
- jcr->NumReadVolumes, jcr->CurReadVolume);
- goto get_out; /* should not happen */
- }
-- /*
-- * Note, if we want to be able to work from a .bsr file only
-- * for disaster recovery, we must "simulate" reading the catalog
-- */
-- bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
-- bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
-- bstrncpy(dcr->media_type, vol->MediaType, sizeof(dcr->media_type));
-- dcr->VolCatInfo.Slot = vol->Slot;
-- dcr->VolCatInfo.InChanger = vol->Slot > 0;
-+ set_dcr_from_vol(dcr, vol);
-+
-+ Dmsg2(100, "Want Vol=%s Slot=%d\n", vol->VolumeName, vol->Slot);
-
- /*
- * If the MediaType requested for this volume is not the
-@@ -174,20 +169,12 @@
-
- dev->clear_unload();
-
-- if (reserve_volume(dcr, dcr->VolumeName) == NULL) {
-- Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
-- dcr->dev->print_name());
-- Jmsg2(jcr, M_FATAL, 0, _("Could not reserve volume %s on %s\n"), dcr->VolumeName,
-- dcr->dev->print_name());
-- goto get_out;
-- }
- if (dev->vol && dev->vol->is_swapping()) {
- dev->vol->set_slot(vol->Slot);
- Dmsg3(100, "swapping: slot=%d Vol=%s dev=%s\n", dev->vol->get_slot(),
- dev->vol->vol_name, dev->print_name());
- }
-
--
- init_device_wait_timers(dcr);
-
- tape_previously_mounted = dev->can_read() || dev->can_append() ||
-@@ -217,7 +204,10 @@
- goto get_out; /* error return */
- }
-
-- dcr->do_swapping(false/*is_writing*/);
-+ dcr->do_unload();
-+ dcr->do_swapping(false/*!is_writing*/);
-+ dcr->do_load(false /*!is_writing*/);
-+ set_dcr_from_vol(dcr, vol); /* refresh dcr with desired volume info */
-
- /*
- * This code ensures that the device is ready for
-@@ -239,10 +229,12 @@
- vol_label_status = read_dev_volume_label(dcr);
- switch (vol_label_status) {
- case VOL_OK:
-+ Dmsg0(50, "Got correct volume.\n");
- ok = true;
- dev->VolCatInfo = dcr->VolCatInfo; /* structure assignment */
- break; /* got it */
- case VOL_IO_ERROR:
-+ Dmsg0(50, "IO Error\n");
- /*
- * Send error message generated by read_dev_volume_label()
- * only we really had a tape mounted. This supresses superfluous
-@@ -253,13 +245,10 @@
- }
- goto default_path;
- case VOL_NAME_ERROR:
-+ Dmsg0(50, "Vol name error.\n");
- if (dev->is_volume_to_unload()) {
- goto default_path;
- }
--// if (tape_initially_mounted) {
-- tape_initially_mounted = false;
--// goto default_path;
--// }
- dev->set_unload(); /* force unload of unwanted tape */
- if (!unload_autochanger(dcr, -1)) {
- /* at least free the device so we can re-open with correct volume */
-@@ -270,6 +259,7 @@
- default:
- Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
- default_path:
-+ Dmsg0(50, "default path\n");
- tape_previously_mounted = true;
-
- /*
-@@ -289,15 +279,6 @@
- try_autochanger = false;
- continue; /* try reading volume mounted */
- }
-- /* Try closing and re-opening */
-- dev->close();
-- if (dev->open(dcr, OPEN_READ_ONLY) >= 0) {
-- continue;
-- }
-- if (!dev->poll) {
-- Jmsg3(jcr, M_WARNING, 0, _("Read open device %s Volume \"%s\" failed: ERR=%s\n"),
-- dev->print_name(), dcr->VolumeName, dev->bstrerror());
-- }
- }
-
- /* Mount a specific volume and no other */
-@@ -305,7 +286,7 @@
- if (!dir_ask_sysop_to_mount_volume(dcr, ST_READ)) {
- goto get_out; /* error return */
- }
-- try_autochanger = true; /* permit using autochanger again */
-+ try_autochanger = true; /* permit trying the autochanger again */
- continue; /* try reading again */
- } /* end switch */
- break;
-@@ -693,3 +674,16 @@
- }
- free(dcr);
- }
-+
-+static void set_dcr_from_vol(DCR *dcr, VOL_LIST *vol)
-+{
-+ /*
-+ * Note, if we want to be able to work from a .bsr file only
-+ * for disaster recovery, we must "simulate" reading the catalog
-+ */
-+ bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
-+ bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
-+ bstrncpy(dcr->media_type, vol->MediaType, sizeof(dcr->media_type));
-+ dcr->VolCatInfo.Slot = vol->Slot;
-+ dcr->VolCatInfo.InChanger = vol->Slot > 0;
-+}
+++ /dev/null
-
- This patch should clean up two problems with bat:
- 1. Eliminate print error output concerning job plotting
- 2. Eliminate the error messages where bat complains about being busy.
- It also backports some new trunk code.
- Apply it to Bacula version 2.4.2 with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-bat.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/qt-console/mainwin.h
-===================================================================
---- src/qt-console/mainwin.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/mainwin.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -107,9 +107,7 @@
- void runButtonClicked();
- void estimateButtonClicked();
- void browseButtonClicked();
--#ifdef HAVE_QWT
- void jobPlotButtonClicked();
--#endif
- void restoreButtonClicked();
- void undockWindowButton();
- void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
-Index: src/qt-console/fileset/fileset.h
-===================================================================
---- src/qt-console/fileset/fileset.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/fileset/fileset.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -62,6 +62,7 @@
- void createContextMenu();
- QString m_currentlyselected;
- bool m_populated;
-+ bool m_populating;
- bool m_checkcurwidget;
- };
-
-Index: src/qt-console/fileset/fileset.cpp
-===================================================================
---- src/qt-console/fileset/fileset.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/fileset/fileset.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -50,6 +50,7 @@
-
- /* mp_treeWidget, FileSet Tree Tree Widget inherited from ui_fileset.h */
- m_populated = false;
-+ m_populating = false;
- m_checkcurwidget = true;
- m_closeable = false;
- readSettings();
-@@ -70,6 +71,10 @@
- */
- void FileSet::populateTree()
- {
-+ if (m_populating)
-+ return;
-+ m_populating = true;
-+
- QTreeWidgetItem *filesetItem, *topItem;
-
- if (!m_console->preventInUseConnect())
-@@ -102,7 +107,7 @@
- " FROM FileSet"
- " WHERE ";
- query += " FileSet='" + filesetName + "'";
-- query += " ORDER BY FileSet";
-+ query += " ORDER BY CreateTime DESC LIMIT 1";
-
- QStringList results;
- if (mainWin->m_sqlDebug) {
-@@ -135,7 +140,7 @@
- for (int cnter=0; cnter<headerlist.size(); cnter++) {
- mp_treeWidget->resizeColumnToContents(cnter);
- }
--
-+ m_populating = false;
- }
-
- /*
-Index: src/qt-console/clients/clients.cpp
-===================================================================
---- src/qt-console/clients/clients.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/clients/clients.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -51,6 +51,7 @@
-
- /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */
- m_populated = false;
-+ m_populating = false;
- m_checkcurwidget = true;
- m_closeable = false;
- /* add context sensitive menu items specific to this classto the page
-@@ -70,6 +71,9 @@
- */
- void Clients::populateTree()
- {
-+ if (m_populating)
-+ return;
-+ m_populating = true;
- QTreeWidgetItem *clientItem, *topItem;
-
- if (!m_console->preventInUseConnect())
-@@ -135,6 +139,7 @@
- for(int cnter=0; cnter<headerlist.size(); cnter++) {
- mp_treeWidget->resizeColumnToContents(cnter);
- }
-+ m_populating = false;
- }
-
- /*
-Index: src/qt-console/clients/clients.h
-===================================================================
---- src/qt-console/clients/clients.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/clients/clients.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -62,6 +62,7 @@
- void createContextMenu();
- QString m_currentlyselected;
- bool m_populated;
-+ bool m_populating;
- bool m_checkcurwidget;
- };
-
-Index: src/qt-console/storage/storage.cpp
-===================================================================
---- src/qt-console/storage/storage.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/storage/storage.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -52,6 +52,7 @@
-
- /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_storage.h */
- m_populated = false;
-+ m_populating = false;
- m_checkcurwidget = true;
- m_closeable = false;
- m_currentStorage = "";
-@@ -71,6 +72,9 @@
- */
- void Storage::populateTree()
- {
-+ if (m_populating)
-+ return;
-+ m_populating = true;
- QTreeWidgetItem *storageItem, *topItem;
-
- if (!m_console->preventInUseConnect())
-@@ -135,6 +139,7 @@
- for(int cnter=0; cnter<headerlist.size(); cnter++) {
- mp_treeWidget->resizeColumnToContents(cnter);
- }
-+ m_populating = false;
- }
-
- /*
-Index: src/qt-console/storage/storage.h
-===================================================================
---- src/qt-console/storage/storage.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/storage/storage.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -66,6 +66,7 @@
- QString m_currentStorage;
- int m_currentAutoChanger;
- bool m_populated;
-+ bool m_populating;
- bool m_checkcurwidget;
- };
-
-Index: src/qt-console/medialist/medialist.h
-===================================================================
---- src/qt-console/medialist/medialist.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/medialist/medialist.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -66,10 +66,13 @@
- private:
- void createContextMenu();
- void setStatusColor(QTreeWidgetItem *, QString &, int &);
-+ void writeExpandedSettings();
- QString m_currentVolumeName;
- QString m_currentVolumeId;
- bool m_populated;
-+ bool m_populating;
- bool m_checkcurwidget;
-+ QTreeWidgetItem *m_topItem;
- };
-
- #endif /* _MEDIALIST_H_ */
-Index: src/qt-console/medialist/medialist.cpp
-===================================================================
---- src/qt-console/medialist/medialist.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/medialist/medialist.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -54,6 +54,7 @@
-
- /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
- m_populated = false;
-+ m_populating = false;
- m_checkcurwidget = true;
- m_closeable = false;
- /* add context sensitive menu items specific to this classto the page
-@@ -64,6 +65,8 @@
-
- MediaList::~MediaList()
- {
-+ if (m_populated)
-+ writeExpandedSettings();
- }
-
- /*
-@@ -72,7 +75,10 @@
- */
- void MediaList::populateTree()
- {
-- QTreeWidgetItem *mediatreeitem, *pooltreeitem, *topItem;
-+ QTreeWidgetItem *mediatreeitem, *pooltreeitem;
-+ if (m_populating)
-+ return;
-+ m_populating = true;
-
- if (!m_console->preventInUseConnect())
- return;
-@@ -85,23 +91,31 @@
- int statusIndex = headerlist.indexOf("Status");
-
- m_checkcurwidget = false;
-+ if (m_populated)
-+ writeExpandedSettings();
- mp_treeWidget->clear();
- m_checkcurwidget = true;
- mp_treeWidget->setColumnCount(headerlist.count());
-- topItem = new QTreeWidgetItem(mp_treeWidget);
-- topItem->setText(0, "Pools");
-- topItem->setData(0, Qt::UserRole, 0);
-- topItem->setExpanded(true);
-+ m_topItem = new QTreeWidgetItem(mp_treeWidget);
-+ m_topItem->setText(0, "Pools");
-+ m_topItem->setData(0, Qt::UserRole, 0);
-+ m_topItem->setExpanded(true);
-
- mp_treeWidget->setHeaderLabels(headerlist);
-
-+ QSettings settings(m_console->m_dir->name(), "bat");
-+ settings.beginGroup("MediaListTreeExpanded");
- QString query;
-
- foreach (QString pool_listItem, m_console->pool_list) {
-- pooltreeitem = new QTreeWidgetItem(topItem);
-+ pooltreeitem = new QTreeWidgetItem(m_topItem);
- pooltreeitem->setText(0, pool_listItem);
- pooltreeitem->setData(0, Qt::UserRole, 1);
-- pooltreeitem->setExpanded(true);
-+ if(settings.contains(pool_listItem)) {
-+ pooltreeitem->setExpanded(settings.value(pool_listItem).toBool());
-+ } else {
-+ pooltreeitem->setExpanded(true);
-+ }
-
- query = "SELECT Media.VolumeName AS Media, "
- " Media.MediaId AS Id, Media.VolStatus AS VolStatus,"
-@@ -151,10 +165,12 @@
- } /* foreach resultline */
- } /* if results from query */
- } /* foreach pool_listItem */
-+ settings.endGroup();
- /* Resize the columns */
- for(int cnter=0; cnter<headerlist.count(); cnter++) {
- mp_treeWidget->resizeColumnToContents(cnter);
- }
-+ m_populating = false;
- }
-
- void MediaList::setStatusColor(QTreeWidgetItem *item, QString &field, int &index)
-@@ -362,3 +378,18 @@
- consoleCommand(cmd);
- populateTree();
- }
-+
-+/*
-+ * Write settings to save expanded states of the pools
-+ */
-+void MediaList::writeExpandedSettings()
-+{
-+ QSettings settings(m_console->m_dir->name(), "bat");
-+ settings.beginGroup("MediaListTreeExpanded");
-+ int childcount = m_topItem->childCount();
-+ for (int cnt=0; cnt<childcount; cnt++) {
-+ QTreeWidgetItem *poolitem = m_topItem->child(cnt);
-+ settings.setValue(poolitem->text(0), poolitem->isExpanded());
-+ }
-+ settings.endGroup();
-+}
-Index: src/qt-console/mainwin.cpp
-===================================================================
---- src/qt-console/mainwin.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/mainwin.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -441,14 +441,14 @@
- new prerestorePage();
- }
-
--#ifdef HAVE_QWT
- void MainWin::jobPlotButtonClicked()
- {
-+#ifdef HAVE_QWT
- JobPlotPass pass;
- pass.use = false;
- new JobPlot(NULL, pass);
-+#endif
- }
--#endif
-
- /*
- * The user just finished typing a line in the command line edit box
-Index: src/qt-console/jobs/jobs.h
-===================================================================
---- src/qt-console/jobs/jobs.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/jobs/jobs.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -66,6 +66,7 @@
- void createContextMenu();
- QString m_currentlyselected;
- bool m_populated;
-+ bool m_populating;
- bool m_checkcurwidget;
- int m_typeIndex;
- };
-Index: src/qt-console/jobs/jobs.cpp
-===================================================================
---- src/qt-console/jobs/jobs.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/jobs/jobs.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -49,6 +49,7 @@
-
- /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */
- m_populated = false;
-+ m_populating = false;
- m_checkcurwidget = true;
- m_closeable = false;
- /* add context sensitive menu items specific to this classto the page
-@@ -68,6 +69,9 @@
- */
- void Jobs::populateTree()
- {
-+ if (m_populating)
-+ return;
-+ m_populating = true;
- QTreeWidgetItem *jobsItem, *topItem;
-
- if (!m_console->preventInUseConnect())
-Index: src/qt-console/joblist/joblist.cpp
-===================================================================
---- src/qt-console/joblist/joblist.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/joblist/joblist.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -60,6 +60,7 @@
-
- m_resultCount = 0;
- m_populated = false;
-+ m_populating = false;
- m_closeable = false;
- if ((m_mediaName != "") || (m_clientName != "") || (m_jobName != "") || (m_filesetName != ""))
- m_closeable=true;
-@@ -106,6 +107,10 @@
- */
- void JobList::populateTable()
- {
-+ if (m_populating)
-+ return;
-+ m_populating = true;
-+
- QStringList results;
- QString resultline;
- QBrush blackBrush(Qt::black);
-@@ -293,6 +298,7 @@
- tr("The Jobs query returned no results.\n"
- "Press OK to continue?"), QMessageBox::Ok );
- }
-+ m_populating = false;
- }
-
- void JobList::setStatusColor(QTableWidgetItem *item, QString &field)
-@@ -574,9 +580,9 @@
- /*
- * Graph this table
- */
--#ifdef HAVE_QWT
- void JobList::graphTable()
- {
-+#ifdef HAVE_QWT
- JobPlotPass pass;
- pass.recordLimitCheck = limitCheckBox->checkState();
- pass.daysLimitCheck = daysCheckBox->checkState();
-@@ -592,8 +598,8 @@
- pass.use = true;
- QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
- new JobPlot(pageSelectorTreeWidgetItem, pass);
-+#endif
- }
--#endif
-
- /*
- * Save user settings associated with this page
-Index: src/qt-console/joblist/joblist.h
-===================================================================
---- src/qt-console/joblist/joblist.h (.../tags/Release-2.4.2/bacula) (revision 7468)
-+++ src/qt-console/joblist/joblist.h (.../branches/Branch-2.4/bacula) (revision 7468)
-@@ -67,9 +67,7 @@
- void preRestoreFromTime();
- void showLogForJob();
- void consoleCancelJob();
--#ifdef HAVE_QWT
- void graphTable();
--#endif
-
- private:
- void createConnections();
-@@ -85,6 +83,7 @@
- QString m_filesetName;
- QString m_currentJob;
- bool m_populated;
-+ bool m_populating;
- bool m_checkCurrentWidget;
- int m_purgedIndex;
- int m_typeIndex;
+++ /dev/null
-
- This patch causes that jobs not yet created are now removed from
- the work queue just after the cancel command.
-
- It can be applied to 2.4.2 (not to previous versions) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-cancel-non-running-jobs.patch
- ./configure <your-options>
- make
- ...
- make install
-
-Index: src/dird/job.c
-===================================================================
---- src/dird/job.c (révision 7681)
-+++ src/dird/job.c (copie de travail)
-@@ -354,10 +354,11 @@
- {
- BSOCK *sd, *fd;
- char ed1[50];
-+ int32_t old_status = jcr->JobStatus;
-
- set_jcr_job_status(jcr, JS_Canceled);
-
-- switch (jcr->JobStatus) {
-+ switch (old_status) {
- case JS_Created:
- case JS_WaitJobRes:
- case JS_WaitClientRes:
-
+++ /dev/null
-
- This patch fixes the seg faults that occur in the Director if an incorrect
- estimate command is given -- in particular a level specification without
- the value. This fixes bug #1140
- Apply this patch to Bacula 2.4.2 (and possibly earlier versions) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-estimate-cmd.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-
-Index: src/dird/ua_cmds.c
-===================================================================
---- src/dird/ua_cmds.c (revision 7469)
-+++ src/dird/ua_cmds.c (working copy)
-@@ -1079,17 +1079,31 @@
- strcasecmp(ua->argk[i], NT_("fd")) == 0) {
- if (ua->argv[i]) {
- client = GetClientResWithName(ua->argv[i]);
-+ if (!client) {
-+ ua->error_msg(_("Client \"%s\" not found.\n"), ua->argv[i]);
-+ return 1;
-+ }
- continue;
-+ } else {
-+ ua->error_msg(_("Client name missing.\n"));
-+ return 1;
- }
- }
- if (strcasecmp(ua->argk[i], NT_("job")) == 0) {
- if (ua->argv[i]) {
- job = GetJobResWithName(ua->argv[i]);
-- if (job && !acl_access_ok(ua, Job_ACL, job->name())) {
-+ if (!job) {
-+ ua->error_msg(_("Job \"%s\" not found.\n"), ua->argv[i]);
-+ return 1;
-+ }
-+ if (!acl_access_ok(ua, Job_ACL, job->name())) {
- ua->error_msg(_("No authorization for Job \"%s\"\n"), job->name());
- return 1;
- }
- continue;
-+ } else {
-+ ua->error_msg(_("Job name missing.\n"));
-+ return 1;
- }
- }
- if (strcasecmp(ua->argk[i], NT_("fileset")) == 0) {
-@@ -1100,15 +1114,25 @@
- return 1;
- }
- continue;
-+ } else {
-+ ua->error_msg(_("Fileset name missing.\n"));
-+ return 1;
- }
-+
- }
- if (strcasecmp(ua->argk[i], NT_("listing")) == 0) {
- listing = 1;
- continue;
- }
- if (strcasecmp(ua->argk[i], NT_("level")) == 0) {
-- if (!get_level_from_name(ua->jcr, ua->argv[i])) {
-- ua->error_msg(_("Level %s not valid.\n"), ua->argv[i]);
-+ if (ua->argv[i]) {
-+ if (!get_level_from_name(ua->jcr, ua->argv[i])) {
-+ ua->error_msg(_("Level \"%s\" not valid.\n"), ua->argv[i]);
-+ }
-+ continue;
-+ } else {
-+ ua->error_msg(_("Level value missing.\n"));
-+ return 1;
- }
- continue;
- }
+++ /dev/null
-
- Attempt to fix bug #1128 InChanger flag cleared during Migration
- job when reading from one autochanger and writing to another.
- Testing is needed.
- Apply this patch to Bacula version 2.4.2 with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-inchanger.patch
- ./configure <your options>
- make
- ...
- make install
-
-
-Index: src/dird/catreq.c
-===================================================================
---- src/dird/catreq.c (revision 7507)
-+++ src/dird/catreq.c (working copy)
-@@ -83,7 +83,7 @@
- jcr->MediaId = mr->MediaId;
- pm_strcpy(jcr->VolumeName, mr->VolumeName);
- bash_spaces(mr->VolumeName);
-- stat = bnet_fsend(sd, OK_media, mr->VolumeName, mr->VolJobs,
-+ stat = sd->fsend(OK_media, mr->VolumeName, mr->VolJobs,
- mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
- mr->VolMounts, mr->VolErrors, mr->VolWrites,
- edit_uint64(mr->MaxVolBytes, ed2),
-@@ -266,11 +266,22 @@
- }
- }
- Dmsg2(400, "Update media: BefVolJobs=%u After=%u\n", mr.VolJobs, sdmr.VolJobs);
-+
- /* Check if the volume has been written by the job,
- * and update the LastWritten field if needed */
- if (mr.VolBlocks != sdmr.VolBlocks) {
- mr.LastWritten = sdmr.LastWritten;
- }
-+
-+ /*
-+ * Update to point to the last device used to write the Volume.
-+ * However, do so only if we are writing the tape, i.e.
-+ * the number of VolWrites has increased.
-+ */
-+ if (jcr->wstore && jcr->wstore->StorageId && sdmr.VolWrites > mr.VolWrites) {
-+ mr.StorageId = jcr->wstore->StorageId;
-+ }
-+
- /* Copy updated values to original media record */
- mr.VolJobs = sdmr.VolJobs;
- mr.VolFiles = sdmr.VolFiles;
-@@ -285,14 +296,6 @@
- mr.VolWriteTime = sdmr.VolWriteTime;
- mr.VolParts = sdmr.VolParts;
- bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
-- /*
-- * Update to point to the last device used to write the Volume.
-- * However, do so only if we are writing the tape, i.e.
-- * the number of VolBlocks has increased.
-- */
-- if (jcr->wstore && jcr->wstore->StorageId && mr.VolBlocks != sdmr.VolBlocks) {
-- mr.StorageId = jcr->wstore->StorageId;
-- }
-
- Dmsg2(400, "db_update_media_record. Stat=%s Vol=%s\n", mr.VolStatus, mr.VolumeName);
- /*
-Index: src/dird/dird.c
-===================================================================
---- src/dird/dird.c (revision 7507)
-+++ src/dird/dird.c (working copy)
-@@ -914,6 +914,7 @@
- db_create_storage_record(NULL, db, &sr);
- store->StorageId = sr.StorageId; /* set storage Id */
- if (!sr.created) { /* if not created, update it */
-+ sr.AutoChanger = store->autochanger;
- db_update_storage_record(NULL, db, &sr);
- }
-
-Index: src/cats/sql_update.c
-===================================================================
---- src/cats/sql_update.c (revision 7507)
-+++ src/cats/sql_update.c (working copy)
-@@ -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.
-@@ -445,7 +445,8 @@
- db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
- {
- char ed1[50], ed2[50];
-- if (mr->InChanger != 0 && mr->Slot != 0) {
-+ if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0 &&
-+ mr->MediaId != 0) {
- Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE "
- "Slot=%d AND StorageId=%s AND MediaId!=%s",
- mr->Slot,
+++ /dev/null
-
- This patch should fix the race condition that leads to a Director
- crash at job end time when the job list is updated. This was reported
- in bug #1162.
-
- Apply this patch to Bacula version 2.4.2 (and earlier) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-jobend-crash.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/lib/jcr.c
-===================================================================
---- src/lib/jcr.c (revision 7627)
-+++ src/lib/jcr.c (working copy)
-@@ -110,6 +110,7 @@
- void term_last_jobs_list()
- {
- if (last_jobs) {
-+ lock_last_jobs_list();
- while (!last_jobs->empty()) {
- void *je = last_jobs->first();
- last_jobs->remove(je);
-@@ -117,6 +118,7 @@
- }
- delete last_jobs;
- last_jobs = NULL;
-+ unlock_last_jobs_list();
- }
- if (jcrs) {
- delete jcrs;
-@@ -128,6 +130,7 @@
- {
- struct s_last_job *je, job;
- uint32_t num;
-+ bool ok = true;
-
- Dmsg1(100, "read_last_jobs seek to %d\n", (int)addr);
- if (addr == 0 || lseek(fd, (off_t)addr, SEEK_SET) < 0) {
-@@ -140,11 +143,13 @@
- if (num > 4 * max_last_jobs) { /* sanity check */
- return false;
- }
-+ lock_last_jobs_list();
- for ( ; num; num--) {
- if (read(fd, &job, sizeof(job)) != sizeof(job)) {
- berrno be;
- Pmsg1(000, "Read job entry. ERR=%s\n", be.bstrerror());
-- return false;
-+ ok = false;
-+ break;
- }
- if (job.JobId > 0) {
- je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
-@@ -160,41 +165,48 @@
- }
- }
- }
-- return true;
-+ unlock_last_jobs_list();
-+ return ok;
- }
-
- uint64_t write_last_jobs_list(int fd, uint64_t addr)
- {
- struct s_last_job *je;
- uint32_t num;
-+ ssize_t stat;
-
- Dmsg1(100, "write_last_jobs seek to %d\n", (int)addr);
- if (lseek(fd, (off_t)addr, SEEK_SET) < 0) {
- return 0;
- }
- if (last_jobs) {
-+ lock_last_jobs_list();
- /* First record is number of entires */
- num = last_jobs->size();
- if (write(fd, &num, sizeof(num)) != sizeof(num)) {
- berrno be;
- Pmsg1(000, "Error writing num_items: ERR=%s\n", be.bstrerror());
-- return 0;
-+ goto bail_out;
- }
- foreach_dlist(je, last_jobs) {
- if (write(fd, je, sizeof(struct s_last_job)) != sizeof(struct s_last_job)) {
- berrno be;
- Pmsg1(000, "Error writing job: ERR=%s\n", be.bstrerror());
-- return 0;
-+ goto bail_out;
- }
- }
-+ unlock_last_jobs_list();
- }
- /* Return current address */
-- ssize_t stat = lseek(fd, 0, SEEK_CUR);
-+ stat = lseek(fd, 0, SEEK_CUR);
- if (stat < 0) {
- stat = 0;
- }
- return stat;
-
-+bail_out:
-+ unlock_last_jobs_list();
-+ return 0;
- }
-
- void lock_last_jobs_list()
-@@ -331,6 +343,7 @@
- last_job.end_time = time(NULL);
- /* Keep list of last jobs, but not Console where JobId==0 */
- if (last_job.JobId > 0) {
-+ lock_last_jobs_list();
- je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
- memcpy((char *)je, (char *)&last_job, sizeof(last_job));
- if (!last_jobs) {
-@@ -342,6 +355,7 @@
- last_jobs->remove(je);
- free(je);
- }
-+ unlock_last_jobs_list();
- }
- break;
- default:
+++ /dev/null
-
- This patch causes a message to be printed if the migration job finds that
- the target job has already been migrated:
-
- JobId %s already migrated probably by another Job. Migration stopped.
-
- It can be applied to 2.4.2 (not to previous versions) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-mig-message.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/dird/migrate.c
-===================================================================
---- src/dird/migrate.c (revision 7444)
-+++ src/dird/migrate.c (working copy)
-@@ -284,6 +284,8 @@
- }
- /* Make sure this job was not already migrated */
- if (jcr->previous_jr.JobType != JT_BACKUP) {
-+ Jmsg(jcr, M_INFO, 0, _("JobId %s already migrated probably by another Job. Migration stopped.\n"),
-+ edit_int64(jcr->previous_jr.JobId, ed1));
- set_jcr_job_status(jcr, JS_Terminated);
- migration_cleanup(jcr, jcr->JobStatus);
- return true;
+++ /dev/null
-
- This patch should correct bug #1159 where Migration does not properly
- respect the Migration Low Bytes directive.
-
- Apply it to Bacula version 2.4.2 (or possibly earlier) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-migrate-poolsize.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/dird/migrate.c
-===================================================================
---- src/dird/migrate.c (revision 7566)
-+++ src/dird/migrate.c (working copy)
-@@ -557,13 +557,16 @@
- " AND Job.Type='B'"
- " ORDER by Job.StartTime";
-
--/* Get tne number of bytes in the pool */
-+/* Get the number of bytes in the pool */
- const char *sql_pool_bytes =
-- "SELECT SUM(VolBytes) FROM Media,Pool WHERE"
-+ "SELECT SUM(JobBytes) FROM Job WHERE JobId IN"
-+ " (SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE"
-+ " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND"
- " VolStatus in ('Full','Used','Error','Append') AND Media.Enabled=1 AND"
-- " Media.PoolId=Pool.PoolId AND Pool.Name='%s'";
-+ " Job.Type='B' AND"
-+ " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId)";
-
--/* Get tne number of bytes in the Jobs */
-+/* Get the number of bytes in the Jobs */
- const char *sql_job_bytes =
- "SELECT SUM(JobBytes) FROM Job WHERE JobId IN (%s)";
-
+++ /dev/null
-
- This patch fixes migration SQL not to migrate a job that has not
- terminated, or in otherwords do not migrate a running job.
- This is a partial fix to bug #1164.
-
- Any prior patches to src/dird/migration must already be applied.
- Apply it to 2.4.2 with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-migration-deadlock.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/dird/migrate.c
-===================================================================
---- src/dird/migrate.c (revision 7729)
-+++ src/dird/migrate.c (working copy)
-@@ -554,7 +554,7 @@
- const char *sql_jobids_from_mediaid =
- "SELECT DISTINCT Job.JobId,Job.StartTime FROM JobMedia,Job"
- " WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId IN (%s)"
-- " AND Job.Type='B'"
-+ " AND Job.Type='B' AND Job.JobStatus = 'T'"
- " ORDER by Job.StartTime";
-
- /* Get the number of bytes in the pool */
-@@ -563,7 +563,7 @@
- " (SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE"
- " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND"
- " VolStatus in ('Full','Used','Error','Append') AND Media.Enabled=1 AND"
-- " Job.Type='B' AND"
-+ " Job.Type='B' AND Job.JobStatus = 'T' AND"
- " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId)";
-
- /* Get the number of bytes in the Jobs */
-@@ -582,7 +582,7 @@
- "SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE"
- " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND"
- " VolStatus in ('Full','Used','Error') AND Media.Enabled=1 AND"
-- " Job.Type='B' AND"
-+ " Job.Type='B' AND Job.JobStatus = 'T' AND"
- " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId"
- " AND Job.RealEndTime<='%s'";
-
+++ /dev/null
-
- This patch fixes an error when reading (restore, migration, Vbackup) and
- SD acquire.c must switch drives. The error message complained of a NULL
- volume name.
-
- Apply this patch to version 2.4.2 with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-null-vol.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/stored/acquire.c
-===================================================================
---- src/stored/acquire.c (revision 7500)
-+++ src/stored/acquire.c (working copy)
-@@ -111,10 +111,10 @@
- DIRSTORE *store;
- int stat;
-
-- Jmsg3(jcr, M_INFO, 0, _("Changing device. Want Media Type=\"%s\" have=\"%s\"\n"
-+ Jmsg3(jcr, M_INFO, 0, _("Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
- " device=%s\n"),
- dcr->media_type, dev->device->media_type, dev->print_name());
-- Dmsg3(50, "Changing device. Want Media Type=\"%s\" have=\"%s\"\n"
-+ Dmsg3(50, "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
- " device=%s\n",
- dcr->media_type, dev->device->media_type, dev->print_name());
-
-@@ -147,9 +147,9 @@
- dev = dcr->dev; /* get new device pointer */
- dev->dblock(BST_DOING_ACQUIRE);
- dcr->VolumeName[0] = 0;
-- Jmsg(jcr, M_INFO, 0, _("Media Type change. New device %s chosen.\n"),
-+ Jmsg(jcr, M_INFO, 0, _("Media Type change. New read device %s chosen.\n"),
- dev->print_name());
-- Dmsg1(50, "Media Type change. New device %s chosen.\n", dev->print_name());
-+ Dmsg1(50, "Media Type change. New read device %s chosen.\n", dev->print_name());
-
- bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
- bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
-@@ -430,11 +430,14 @@
- dcr->clear_reserved();
-
- if (dev->can_read()) {
-+ VOLUME_CAT_INFO *vol = &dev->VolCatInfo;
- dev->clear_read(); /* clear read bit */
-- Dmsg0(100, "dir_update_vol_info. Release0\n");
-- dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
-- volume_unused(dcr);
--
-+ Dmsg2(000, "dir_update_vol_info. label=%d Vol=%s\n",
-+ dev->is_labeled(), vol->VolCatName);
-+ if (dev->is_labeled() && vol->VolCatName[0] != 0) {
-+ dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
-+ volume_unused(dcr);
-+ }
- } else if (dev->num_writers > 0) {
- /*
- * Note if WEOT is set, we are at the end of the tape
+++ /dev/null
-
- This patch fixes a missing storage name problem, which as far
- as we can tell never created any problem.
- Apply the patch to version 2.4.2 (and previous versions) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-storename.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/dird/msgchan.c
-===================================================================
---- src/dird/msgchan.c (revision 7507)
-+++ src/dird/msgchan.c (working copy)
-@@ -229,6 +229,7 @@
- bash_spaces(pool_name);
- foreach_alist(storage, rstore) {
- Dmsg1(100, "Rstore=%s\n", storage->name());
-+ pm_strcpy(store_name, storage->name());
- bash_spaces(store_name);
- pm_strcpy(media_type, storage->media_type);
- bash_spaces(media_type);
+++ /dev/null
-
- This patch corrects a Verify InitCatalog problem where in certain cases
- a garbage filename may be entered in the verification database. This
- fixes bug #1143.
-
- Apply the patch to version 2.4.2 (and previous versions) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-verify.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/dird/fd_cmds.c
-===================================================================
---- src/dird/fd_cmds.c (revision 7469)
-+++ src/dird/fd_cmds.c (working copy)
-@@ -616,7 +616,6 @@
- char *p, *fn;
- char Digest[MAXSTRING]; /* either Verify opts or MD5/SHA1 digest */
-
-- jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
- if ((len = sscanf(fd->msg, "%ld %d %s", &file_index, &stream, Digest)) != 3) {
- Jmsg(jcr, M_FATAL, 0, _("<filed: bad attributes, expected 3 fields got %d\n"
- "msglen=%d msg=%s\n"), len, fd->msglen, fd->msg);
-@@ -641,7 +640,7 @@
- }
- }
- /* Any cached attr is flushed so we can reuse jcr->attr and jcr->ar */
-- fn = jcr->fname;
-+ fn = jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
- while (*p != 0) {
- *fn++ = *p++; /* copy filename */
- }
+++ /dev/null
-
- This patch fixes a case problem in an SQL command, and could potentially
- fix the DiskToCatalog problem reported in bug #1149.
- Apply the patch to version 2.4.2 (and previous versions) with:
-
- cd <bacula-source>
- patch -p0 <2.4.2-verifydisk.patch
- ./configure <your-options>
- make
- ...
- make install
-
-
-Index: src/cats/sql_get.c
-===================================================================
---- src/cats/sql_get.c (revision 7507)
-+++ src/cats/sql_get.c (working copy)
-@@ -109,7 +109,7 @@
- Mmsg(mdb->cmd,
- "SELECT FileId, LStat, MD5 FROM File,Job WHERE "
- "File.JobId=Job.JobId AND File.PathId=%s AND "
--"File.FilenameId=%s AND Job.Type='B' AND Job.JobSTATUS='T' AND "
-+"File.FilenameId=%s AND Job.Type='B' AND Job.JobStatus='T' AND "
- "ClientId=%s ORDER BY StartTime DESC LIMIT 1",
- edit_int64(fdbr->PathId, ed1),
- edit_int64(fdbr->FilenameId, ed2),
--- /dev/null
+Index: scripts/bacula.in
+===================================================================
+--- scripts/bacula.in (revision 7106)
++++ scripts/bacula.in (working copy)
+@@ -13,22 +13,20 @@
+ # easier to "steal" this code for the development
+ # environment where they are different.
+ #
+-BACFDCFG=@sysconfdir@
+-BACSDCFG=@sysconfdir@
+-BACDIRCFG=@sysconfdir@
++SCRIPTDIR=@scriptdir@
+
+ case "$1" in
+ start)
+- [ -x ${BACSDCFG}/bacula-ctl-sd ] && ${BACSDCFG}/bacula-ctl-sd $1 $2
+- [ -x ${BACFDCFG}/bacula-ctl-fd ] && ${BACFDCFG}/bacula-ctl-fd $1 $2
+- [ -x ${BACDIRCFG}/bacula-ctl-dir ] && ${BACDIRCFG}/bacula-ctl-dir $1 $2
++ [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
++ [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
++ [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
+ ;;
+
+ stop)
+ # Stop the FD first so that SD will fail jobs and update catalog
+- [ -x ${BACFDCFG}/bacula-ctl-fd ] && ${BACFDCFG}/bacula-ctl-fd $1 $2
+- [ -x ${BACSDCFG}/bacula-ctl-sd ] && ${BACSDCFG}/bacula-ctl-sd $1 $2
+- [ -x ${BACDIRCFG}/bacula-ctl-dir ] && ${BACDIRCFG}/bacula-ctl-dir $1 $2
++ [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd $1 $2
++ [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd $1 $2
++ [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir $1 $2
+ echo
+ sleep 6
+ ;;
+@@ -39,9 +37,9 @@
+ ;;
+
+ status)
+- [ -x ${BACSDCFG}/bacula-ctl-sd ] && ${BACSDCFG}/bacula-ctl-sd status
+- [ -x ${BACFDCFG}/bacula-ctl-fd ] && ${BACFDCFG}/bacula-ctl-fd status
+- [ -x ${BACDIRCFG}/bacula-ctl-dir ] && ${BACDIRCFG}/bacula-ctl-dir status
++ [ -x ${SCRIPTDIR}/bacula-ctl-sd ] && ${SCRIPTDIR}/bacula-ctl-sd status
++ [ -x ${SCRIPTDIR}/bacula-ctl-fd ] && ${SCRIPTDIR}/bacula-ctl-fd status
++ [ -x ${SCRIPTDIR}/bacula-ctl-dir ] && ${SCRIPTDIR}/bacula-ctl-dir status
+ ;;
+
+ *)
--- /dev/null
+Index: src/gnome2-console/console_conf.c
+===================================================================
+--- src/gnome2-console/console_conf.c (revision 7106)
++++ src/gnome2-console/console_conf.c (working copy)
+@@ -24,7 +24,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2000-2006 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.
+@@ -82,8 +82,8 @@
+ {"dirport", store_int, ITEM(dir_res.DIRport), 0, ITEM_DEFAULT, 9101},
+ {"address", store_str, ITEM(dir_res.address), 0, ITEM_REQUIRED, 0},
+ {"password", store_password, ITEM(dir_res.password), 0, 0, 0},
+- {"tlsenable", store_bit, ITEM(dir_res.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(dir_res.tls_require), 1, 0, 0},
++ {"tlsenable", store_bool, ITEM(dir_res.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(dir_res.tls_require), 1, 0, 0},
+ {"tlscacertificatefile", store_dir, ITEM(dir_res.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(dir_res.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(dir_res.tls_certfile), 0, 0, 0},
+@@ -95,8 +95,8 @@
+ {"name", store_name, ITEM(con_res.hdr.name), 0, ITEM_REQUIRED, 0},
+ {"description", store_str, ITEM(con_res.hdr.desc), 0, 0, 0},
+ {"password", store_password, ITEM(con_res.password), 0, ITEM_REQUIRED, 0},
+- {"tlsenable", store_bit, ITEM(con_res.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(con_res.tls_require), 1, 0, 0},
++ {"tlsenable", store_bool, ITEM(con_res.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(con_res.tls_require), 1, 0, 0},
+ {"tlscacertificatefile", store_dir, ITEM(con_res.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(con_res.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(con_res.tls_certfile), 0, 0, 0},
+Index: src/gnome2-console/console_conf.h
+===================================================================
+--- src/gnome2-console/console_conf.h (revision 7106)
++++ src/gnome2-console/console_conf.h (working copy)
+@@ -8,7 +8,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
++ Copyright (C) 2002-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.
+@@ -66,8 +66,8 @@
+ int DIRport; /* UA server port */
+ char *address; /* UA server address */
+ char *password; /* UA server password */
+- int tls_enable; /* Enable TLS */
+- int tls_require; /* Require TLS */
++ bool tls_enable; /* Enable TLS */
++ bool tls_require; /* Require TLS */
+ char *tls_ca_certfile; /* TLS CA Certificate File */
+ char *tls_ca_certdir; /* TLS CA Certificate Directory */
+ char *tls_certfile; /* TLS Client Certificate File */
+@@ -84,8 +84,8 @@
+ struct CONRES {
+ RES hdr;
+ char *password; /* UA server password */
+- int tls_enable; /* Enable TLS on all connections */
+- int tls_require; /* Require TLS on all connections */
++ bool tls_enable; /* Enable TLS on all connections */
++ bool tls_require; /* Require TLS on all connections */
+ char *tls_ca_certfile; /* TLS CA Certificate File */
+ char *tls_ca_certdir; /* TLS CA Certificate Directory */
+ char *tls_certfile; /* TLS Client Certificate File */
+Index: src/wx-console/console_conf.c
+===================================================================
+--- src/wx-console/console_conf.c (revision 7106)
++++ src/wx-console/console_conf.c (working copy)
+@@ -100,12 +100,12 @@
+ {"rcfile", store_dir, ITEM(res_cons.rc_file), 0, 0, 0},
+ {"historyfile", store_dir, ITEM(res_cons.hist_file), 0, 0, 0},
+ {"password", store_password, ITEM(res_cons.password), 0, ITEM_REQUIRED, 0},
+- {"tlsenable", store_bit, ITEM(res_cons.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(res_cons.tls_require), 1, 0, 0},
+ {"tlscacertificatefile", store_dir, ITEM(res_cons.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(res_cons.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(res_cons.tls_certfile), 0, 0, 0},
+ {"tlskey", store_dir, ITEM(res_cons.tls_keyfile), 0, 0, 0},
++ {"tlsenable", store_bool, ITEM(res_cons.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(res_cons.tls_require), 1, 0, 0},
+ {NULL, NULL, {0}, 0, 0, 0}
+ };
+
+@@ -117,12 +117,12 @@
+ {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
+ {"address", store_str, ITEM(res_dir.address), 0, 0, 0},
+ {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
+- {"tlsenable", store_bit, ITEM(res_dir.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(res_dir.tls_require), 1, 0, 0},
+ {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
+ {"tlskey", store_dir, ITEM(res_dir.tls_keyfile), 0, 0, 0},
++ {"tlsenable", store_bool, ITEM(res_dir.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(res_dir.tls_require), 1, 0, 0},
+ {NULL, NULL, {0}, 0, 0, 0}
+ };
+
+Index: src/wx-console/console_conf.h
+===================================================================
+--- src/wx-console/console_conf.h (revision 7106)
++++ src/wx-console/console_conf.h (working copy)
+@@ -4,7 +4,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2000-2006 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.
+@@ -63,14 +63,13 @@
+ char *rc_file; /* startup file */
+ char *hist_file; /* command history file */
+ char *password; /* UA server password */
+- int tls_enable; /* Enable TLS on all connections */
+- int tls_require; /* Require TLS on all connections */
+ char *tls_ca_certfile; /* TLS CA Certificate File */
+ char *tls_ca_certdir; /* TLS CA Certificate Directory */
+ char *tls_certfile; /* TLS Client Certificate File */
+ char *tls_keyfile; /* TLS Client Key File */
+-
+ TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
++ bool tls_enable; /* Enable TLS on all connections */
++ bool tls_require; /* Require TLS on all connections */
+ };
+
+ /* Director */
+@@ -79,14 +78,13 @@
+ int DIRport; /* UA server port */
+ char *address; /* UA server address */
+ char *password; /* UA server password */
+- int tls_enable; /* Enable TLS on all connections */
+- int tls_require; /* Require TLS on all connections */
+ char *tls_ca_certfile; /* TLS CA Certificate File */
+ char *tls_ca_certdir; /* TLS CA Certificate Directory */
+ char *tls_certfile; /* TLS Client Certificate File */
+ char *tls_keyfile; /* TLS Client Key File */
+-
+ TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
++ bool tls_enable; /* Enable TLS on all connections */
++ bool tls_require; /* Require TLS on all connections */
+ };
+
+
+Index: src/stored/stored_conf.c
+===================================================================
+--- src/stored/stored_conf.c (revision 7106)
++++ src/stored/stored_conf.c (working copy)
+@@ -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.
+@@ -77,9 +77,9 @@
+ {"scriptsdirectory", store_dir, ITEM(res_store.scripts_directory), 0, 0, 0},
+ {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
+ {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+- {"tlsenable", store_bit, ITEM(res_store.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(res_store.tls_require), 1, 0, 0},
+- {"tlsverifypeer", store_bit, ITEM(res_store.tls_verify_peer), 1, ITEM_DEFAULT, 1},
++ {"tlsenable", store_bool, ITEM(res_store.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(res_store.tls_require), 1, 0, 0},
++ {"tlsverifypeer", store_bool, ITEM(res_store.tls_verify_peer), 1, ITEM_DEFAULT, 1},
+ {"tlscacertificatefile", store_dir, ITEM(res_store.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(res_store.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(res_store.tls_certfile), 0, 0, 0},
+@@ -96,10 +96,10 @@
+ {"name", store_name, ITEM(res_dir.hdr.name), 0, ITEM_REQUIRED, 0},
+ {"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0},
+ {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
+- {"monitor", store_bit, ITEM(res_dir.monitor), 1, ITEM_DEFAULT, 0},
+- {"tlsenable", store_bit, ITEM(res_dir.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(res_dir.tls_require), 1, 0, 0},
+- {"tlsverifypeer", store_bit, ITEM(res_dir.tls_verify_peer), 1, ITEM_DEFAULT, 1},
++ {"monitor", store_bool, ITEM(res_dir.monitor), 1, ITEM_DEFAULT, 0},
++ {"tlsenable", store_bool, ITEM(res_dir.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(res_dir.tls_require), 1, 0, 0},
++ {"tlsverifypeer", store_bool, ITEM(res_dir.tls_verify_peer), 1, ITEM_DEFAULT, 1},
+ {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
+@@ -137,7 +137,7 @@
+ {"checklabels", store_bit, ITEM(res_dev.cap_bits), CAP_CHECKLABELS, ITEM_DEFAULT, 0},
+ {"requiresmount", store_bit, ITEM(res_dev.cap_bits), CAP_REQMOUNT, ITEM_DEFAULT, 0},
+ {"offlineonunmount", store_bit, ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 0},
+- {"autoselect", store_bit, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
++ {"autoselect", store_bool, ITEM(res_dev.autoselect), 1, ITEM_DEFAULT, 1},
+ {"changerdevice", store_strname,ITEM(res_dev.changer_name), 0, 0, 0},
+ {"changercommand", store_strname,ITEM(res_dev.changer_command), 0, 0, 0},
+ {"alertcommand", store_strname,ITEM(res_dev.alert_command), 0, 0, 0},
+@@ -177,9 +177,6 @@
+ };
+
+
+-// {"mountanonymousvolumes", store_bit, ITEM(res_dev.cap_bits), CAP_ANONVOLS, ITEM_DEFAULT, 0},
+-
+-
+ /* Message resource */
+ extern RES_ITEM msgs_items[];
+
+Index: src/stored/stored_conf.h
+===================================================================
+--- src/stored/stored_conf.h (revision 7106)
++++ src/stored/stored_conf.h (working copy)
+@@ -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.
+@@ -126,9 +126,9 @@
+ char *spool_directory; /* Spool file directory */
+ int dev_type; /* device type */
+ int label_type; /* label type */
+- int autoselect; /* Automatically select from AutoChanger */
++ bool autoselect; /* Automatically select from AutoChanger */
+ uint32_t drive_index; /* Autochanger drive index */
+- uint32_t cap_bits; /* Capabilities of this device */
++ int cap_bits; /* Capabilities of this device */
+ utime_t max_changer_wait; /* Changer timeout */
+ utime_t max_rewind_wait; /* maximum secs to wait for rewind */
+ utime_t max_open_wait; /* maximum secs to wait for open */
+Index: src/console/console_conf.c
+===================================================================
+--- src/console/console_conf.c (revision 7106)
++++ src/console/console_conf.c (working copy)
+@@ -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.
+@@ -88,8 +88,8 @@
+ {"rcfile", store_dir, ITEM(res_cons.rc_file), 0, 0, 0},
+ {"historyfile", store_dir, ITEM(res_cons.hist_file), 0, 0, 0},
+ {"password", store_password, ITEM(res_cons.password), 0, ITEM_REQUIRED, 0},
+- {"tlsenable", store_bit, ITEM(res_cons.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(res_cons.tls_require), 1, 0, 0},
++ {"tlsenable", store_bool, ITEM(res_cons.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(res_cons.tls_require), 1, 0, 0},
+ {"tlscacertificatefile", store_dir, ITEM(res_cons.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(res_cons.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(res_cons.tls_certfile), 0, 0, 0},
+@@ -107,8 +107,8 @@
+ {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
+ {"address", store_str, ITEM(res_dir.address), 0, 0, 0},
+ {"password", store_password, ITEM(res_dir.password), 0, ITEM_REQUIRED, 0},
+- {"tlsenable", store_bit, ITEM(res_dir.tls_enable), 1, 0, 0},
+- {"tlsrequire", store_bit, ITEM(res_dir.tls_require), 1, 0, 0},
++ {"tlsenable", store_bool, ITEM(res_dir.tls_enable), 1, 0, 0},
++ {"tlsrequire", store_bool, ITEM(res_dir.tls_require), 1, 0, 0},
+ {"tlscacertificatefile", store_dir, ITEM(res_dir.tls_ca_certfile), 0, 0, 0},
+ {"tlscacertificatedir", store_dir, ITEM(res_dir.tls_ca_certdir), 0, 0, 0},
+ {"tlscertificate", store_dir, ITEM(res_dir.tls_certfile), 0, 0, 0},
+Index: src/console/console_conf.h
+===================================================================
+--- src/console/console_conf.h (revision 7106)
++++ src/console/console_conf.h (working copy)
+@@ -64,16 +64,15 @@
+ char *rc_file; /* startup file */
+ char *hist_file; /* command history file */
+ char *password; /* UA server password */
+- int tls_enable; /* Enable TLS on all connections */
+- int tls_require; /* Require TLS on all connections */
+ char *tls_ca_certfile; /* TLS CA Certificate File */
+ char *tls_ca_certdir; /* TLS CA Certificate Directory */
+ char *tls_certfile; /* TLS Client Certificate File */
+ char *tls_keyfile; /* TLS Client Key File */
+ char *director; /* bind to director */
+ utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
+-
+ TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
++ bool tls_enable; /* Enable TLS on all connections */
++ bool tls_require; /* Require TLS on all connections */
+ };
+
+ /* Director */
+@@ -82,15 +81,14 @@
+ int DIRport; /* UA server port */
+ char *address; /* UA server address */
+ char *password; /* UA server password */
+- int tls_enable; /* Enable TLS */
+- int tls_require; /* Require TLS */
+ char *tls_ca_certfile; /* TLS CA Certificate File */
+ char *tls_ca_certdir; /* TLS CA Certificate Directory */
+ char *tls_certfile; /* TLS Client Certificate File */
+ char *tls_keyfile; /* TLS Client Key File */
+ utime_t heartbeat_interval; /* Interval to send heartbeats to Dir */
+-
+ TLS_CONTEXT *tls_ctx; /* Shared TLS Context */
++ bool tls_enable; /* Enable TLS */
++ bool tls_require; /* Require TLS */
+ };
+
+
+Index: src/tray-monitor/tray_conf.c
+===================================================================
+--- src/tray-monitor/tray_conf.c (revision 7106)
++++ src/tray-monitor/tray_conf.c (working copy)
+@@ -82,7 +82,7 @@
+ static RES_ITEM mon_items[] = {
+ {"name", store_name, ITEM(res_monitor.hdr.name), 0, ITEM_REQUIRED, 0},
+ {"description", store_str, ITEM(res_monitor.hdr.desc), 0, 0, 0},
+- {"requiressl", store_bit, ITEM(res_monitor.require_ssl), 1, ITEM_DEFAULT, 0},
++ {"requiressl", store_bool, ITEM(res_monitor.require_ssl), 1, ITEM_DEFAULT, 0},
+ {"password", store_password, ITEM(res_monitor.password), 0, ITEM_REQUIRED, 0},
+ {"refreshinterval", store_time,ITEM(res_monitor.RefreshInterval), 0, ITEM_DEFAULT, 5},
+ {"fdconnecttimeout", store_time,ITEM(res_monitor.FDConnectTimeout), 0, ITEM_DEFAULT, 60 * 30},
+@@ -96,7 +96,7 @@
+ {"description", store_str, ITEM(res_dir.hdr.desc), 0, 0, 0},
+ {"dirport", store_int, ITEM(res_dir.DIRport), 0, ITEM_DEFAULT, 9101},
+ {"address", store_str, ITEM(res_dir.address), 0, 0, 0},
+- {"enablessl", store_bit, ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
++ {"enablessl", store_bool, ITEM(res_dir.enable_ssl), 1, ITEM_DEFAULT, 0},
+ {NULL, NULL, {0}, 0, 0, 0}
+ };
+
+@@ -112,7 +112,7 @@
+ {"address", store_str, ITEM(res_client.address), 0, ITEM_REQUIRED, 0},
+ {"fdport", store_pint, ITEM(res_client.FDport), 0, ITEM_DEFAULT, 9102},
+ {"password", store_password, ITEM(res_client.password), 0, ITEM_REQUIRED, 0},
+- {"enablessl", store_bit, ITEM(res_client.enable_ssl), 1, ITEM_DEFAULT, 0},
++ {"enablessl", store_bool, ITEM(res_client.enable_ssl), 1, ITEM_DEFAULT, 0},
+ {NULL, NULL, {0}, 0, 0, 0}
+ };
+
+@@ -128,7 +128,7 @@
+ {"sdaddress", store_str, ITEM(res_store.address), 0, 0, 0},
+ {"password", store_password, ITEM(res_store.password), 0, ITEM_REQUIRED, 0},
+ {"sdpassword", store_password, ITEM(res_store.password), 0, 0, 0},
+- {"enablessl", store_bit, ITEM(res_store.enable_ssl), 1, ITEM_DEFAULT, 0},
++ {"enablessl", store_bool, ITEM(res_store.enable_ssl), 1, ITEM_DEFAULT, 0},
+ {NULL, NULL, {0}, 0, 0, 0}
+ };
+
+Index: src/tray-monitor/tray_conf.h
+===================================================================
+--- src/tray-monitor/tray_conf.h (revision 7106)
++++ src/tray-monitor/tray_conf.h (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
++ Copyright (C) 2004-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.
+@@ -67,7 +67,7 @@
+ RES hdr;
+ int DIRport; /* UA server port */
+ char *address; /* UA server address */
+- int enable_ssl; /* Use SSL */
++ bool enable_ssl; /* Use SSL */
+ };
+
+ /*
+@@ -95,7 +95,7 @@
+ int FDport; /* Where File daemon listens */
+ char *address;
+ char *password;
+- int enable_ssl; /* Use SSL */
++ bool enable_ssl; /* Use SSL */
+ };
+
+ /*
+@@ -108,7 +108,7 @@
+ int SDport; /* port where Directors connect */
+ char *address;
+ char *password;
+- int enable_ssl; /* Use SSL */
++ bool enable_ssl; /* Use SSL */
+ };
+
+ struct CONFONTRES {
--- /dev/null
+
+ This patch should fix (not tested) the recycling bug #1106 when using
+ two autochangers. There is a much smaller chance that it also fixes
+ bug #1103 where a volume is recycled when it is full.
+
+ Apply the patch to version 2.4.0 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.0-recycle.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/dird/autoprune.c
+===================================================================
+--- src/dird/autoprune.c (revision 7178)
++++ src/dird/autoprune.c (working copy)
+@@ -96,7 +96,7 @@
+ POOL_MEM query(PM_MESSAGE);
+ UAContext *ua;
+ bool ok = false;
+- char ed1[50], ed2[100];
++ char ed1[50], ed2[100], ed3[50];
+ POOL_DBR spr;
+
+ Dmsg1(050, "Prune volumes PoolId=%d\n", jcr->jr.PoolId);
+@@ -138,10 +138,18 @@
+ * RecyclePoolId is the current pool or the scratch pool
+ */
+ const char *select = "SELECT DISTINCT MediaId,LastWritten FROM Media WHERE "
+- "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' "
++ "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' %s"
+ "ORDER BY LastWritten ASC,MediaId";
+
+- Mmsg(query, select, ed1, ed2, mr->MediaType);
++ if (InChanger) {
++ char changer[100];
++ /* Ensure it is in this autochanger */
++ bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
++ edit_int64(mr->StorageId, ed3));
++ Mmsg(query, select, ed1, ed2, mr->MediaType, changer);
++ } else {
++ Mmsg(query, select, ed1, ed2, mr->MediaType, "");
++ }
+
+ Dmsg1(050, "query=%s\n", query.c_str());
+ if (!db_get_query_dbids(ua->jcr, ua->db, query, ids)) {
+Index: src/dird/recycle.c
+===================================================================
+--- src/dird/recycle.c (revision 7178)
++++ src/dird/recycle.c (working copy)
+@@ -83,12 +83,19 @@
+ const char *select =
+ "SELECT MediaId,LastWritten FROM Media "
+ "WHERE PoolId=%s AND Recycle=1 AND VolStatus='Purged' "
+- "AND Enabled=1 AND MediaType='%s' "
++ "AND Enabled=1 AND MediaType='%s' %s"
+ "ORDER BY LastWritten ASC,MediaId LIMIT 1";
+
+ Dmsg0(100, "Enter recycle_oldest_purged_volume\n");
+ oldest.MediaId = 0;
+- Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType);
++ if (InChanger) {
++ char changer[100];
++ bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
++ edit_int64(mr->StorageId, ed1));
++ Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, changer);
++ } else {
++ Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, "");
++ }
+
+ if (!db_sql_query(jcr->db, query, oldest_handler, (void *)&oldest)) {
+ Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
--- /dev/null
+
+ This patch should fix bug #1094 where jobs that wrote bytes and are rescheduled
+ do not keep any Pool overrides that were specified in the Schedule Run
+ directives. The patch also simplifies the resource lock inc/dec.
+
+ Apply it to 2.4.0 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.0-reschedule.patch
+ ./configure <your options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/jobq.c
+===================================================================
+--- src/dird/jobq.c (revision 7178)
++++ src/dird/jobq.c (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2003-2007 Free Software Foundation Europe e.V.
++ Copyright (C) 2003-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.
+@@ -56,9 +56,10 @@
+
+ static int start_server(jobq_t *jq);
+ static bool acquire_resources(JCR *jcr);
++static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je);
++static void dec_read_store(JCR *jcr);
++static void dec_write_store(JCR *jcr);
+
+-
+-
+ /*
+ * Initialize a job queue
+ *
+@@ -357,8 +358,8 @@
+ pthread_t id;
+
+ /*
+- * if any threads are idle, wake one --
+- * actually we do a broadcast because on /lib/tls
++ * if any threads are idle, wake one.
++ * Actually we do a broadcast because on /lib/tls
+ * these signals seem to get lost from time to time.
+ */
+ if (jq->idle_workers > 0) {
+@@ -477,87 +478,17 @@
+ * put into the ready queue.
+ */
+ if (jcr->acquired_resource_locks) {
+- if (jcr->rstore) {
+- jcr->rstore->NumConcurrentJobs--;
+- Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
+- }
+- if (jcr->wstore) {
+- jcr->wstore->NumConcurrentJobs--;
+- Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
+- }
++ dec_read_store(jcr);
++ dec_write_store(jcr);
+ jcr->client->NumConcurrentJobs--;
+ jcr->job->NumConcurrentJobs--;
+ jcr->acquired_resource_locks = false;
+ }
+
+- /*
+- * Reschedule the job if necessary and requested
+- */
+- if (jcr->job->RescheduleOnError &&
+- jcr->JobStatus != JS_Terminated &&
+- jcr->JobStatus != JS_Canceled &&
+- jcr->JobType == JT_BACKUP &&
+- (jcr->job->RescheduleTimes == 0 ||
+- jcr->reschedule_count < jcr->job->RescheduleTimes)) {
+- char dt[50], dt2[50];
++ if (reschedule_job(jcr, jq, je)) {
++ continue; /* go look for more work */
++ }
+
+- /*
+- * Reschedule this job by cleaning it up, but
+- * reuse the same JobId if possible.
+- */
+- time_t now = time(NULL);
+- jcr->reschedule_count++;
+- jcr->sched_time = now + jcr->job->RescheduleInterval;
+- bstrftime(dt, sizeof(dt), now);
+- bstrftime(dt2, sizeof(dt2), jcr->sched_time);
+- Dmsg4(2300, "Rescheduled Job %s to re-run in %d seconds.(now=%u,then=%u)\n", jcr->Job,
+- (int)jcr->job->RescheduleInterval, now, jcr->sched_time);
+- Jmsg(jcr, M_INFO, 0, _("Rescheduled Job %s at %s to re-run in %d seconds (%s).\n"),
+- jcr->Job, dt, (int)jcr->job->RescheduleInterval, dt2);
+- dird_free_jcr_pointers(jcr); /* partial cleanup old stuff */
+- jcr->JobStatus = -1;
+- set_jcr_job_status(jcr, JS_WaitStartTime);
+- jcr->SDJobStatus = 0;
+- if (jcr->JobBytes == 0) {
+- Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count());
+- V(jq->mutex);
+- jobq_add(jq, jcr); /* queue the job to run again */
+- P(jq->mutex);
+- free_jcr(jcr); /* release jcr */
+- free(je); /* free the job entry */
+- continue; /* look for another job to run */
+- }
+- /*
+- * Something was actually backed up, so we cannot reuse
+- * the old JobId or there will be database record
+- * conflicts. We now create a new job, copying the
+- * appropriate fields.
+- */
+- JCR *njcr = new_jcr(sizeof(JCR), dird_free_jcr);
+- set_jcr_defaults(njcr, jcr->job);
+- njcr->reschedule_count = jcr->reschedule_count;
+- njcr->sched_time = jcr->sched_time;
+- njcr->JobLevel = jcr->JobLevel;
+- njcr->JobStatus = -1;
+- set_jcr_job_status(njcr, jcr->JobStatus);
+- if (jcr->rstore) {
+- copy_rstorage(njcr, jcr->rstorage, _("previous Job"));
+- } else {
+- free_rstorage(njcr);
+- }
+- if (jcr->wstore) {
+- copy_wstorage(njcr, jcr->wstorage, _("previous Job"));
+- } else {
+- free_wstorage(njcr);
+- }
+- njcr->messages = jcr->messages;
+- Dmsg0(2300, "Call to run new job\n");
+- V(jq->mutex);
+- run_job(njcr); /* This creates a "new" job */
+- free_jcr(njcr); /* release "new" jcr */
+- P(jq->mutex);
+- Dmsg0(2300, "Back from running new job.\n");
+- }
+ /* Clean up and release old jcr */
+ Dmsg2(2300, "====== Termination job=%d use_cnt=%d\n", jcr->JobId, jcr->use_count());
+ jcr->SDJobStatus = 0;
+@@ -671,6 +602,91 @@
+ }
+
+ /*
++ * Returns true if cleanup done and we should look for more work
++ */
++static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
++{
++ /*
++ * Reschedule the job if necessary and requested
++ */
++ if (jcr->job->RescheduleOnError &&
++ jcr->JobStatus != JS_Terminated &&
++ jcr->JobStatus != JS_Canceled &&
++ jcr->JobType == JT_BACKUP &&
++ (jcr->job->RescheduleTimes == 0 ||
++ jcr->reschedule_count < jcr->job->RescheduleTimes)) {
++ char dt[50], dt2[50];
++
++ /*
++ * Reschedule this job by cleaning it up, but
++ * reuse the same JobId if possible.
++ */
++ time_t now = time(NULL);
++ jcr->reschedule_count++;
++ jcr->sched_time = now + jcr->job->RescheduleInterval;
++ bstrftime(dt, sizeof(dt), now);
++ bstrftime(dt2, sizeof(dt2), jcr->sched_time);
++ Dmsg4(2300, "Rescheduled Job %s to re-run in %d seconds.(now=%u,then=%u)\n", jcr->Job,
++ (int)jcr->job->RescheduleInterval, now, jcr->sched_time);
++ Jmsg(jcr, M_INFO, 0, _("Rescheduled Job %s at %s to re-run in %d seconds (%s).\n"),
++ jcr->Job, dt, (int)jcr->job->RescheduleInterval, dt2);
++ dird_free_jcr_pointers(jcr); /* partial cleanup old stuff */
++ jcr->JobStatus = -1;
++ set_jcr_job_status(jcr, JS_WaitStartTime);
++ jcr->SDJobStatus = 0;
++ if (jcr->JobBytes == 0) {
++ Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count());
++ V(jq->mutex);
++ jobq_add(jq, jcr); /* queue the job to run again */
++ P(jq->mutex);
++ free_jcr(jcr); /* release jcr */
++ free(je); /* free the job entry */
++ return true; /* we already cleaned up */
++ }
++ /*
++ * Something was actually backed up, so we cannot reuse
++ * the old JobId or there will be database record
++ * conflicts. We now create a new job, copying the
++ * appropriate fields.
++ */
++ JCR *njcr = new_jcr(sizeof(JCR), dird_free_jcr);
++ set_jcr_defaults(njcr, jcr->job);
++ njcr->reschedule_count = jcr->reschedule_count;
++ njcr->sched_time = jcr->sched_time;
++ njcr->JobLevel = jcr->JobLevel;
++ njcr->pool = jcr->pool;
++ njcr->run_pool_override = jcr->run_pool_override;
++ njcr->full_pool = jcr->full_pool;
++ njcr->run_full_pool_override = jcr->run_full_pool_override;
++ njcr->inc_pool = jcr->inc_pool;
++ njcr->run_inc_pool_override = jcr->run_inc_pool_override;
++ njcr->diff_pool = jcr->diff_pool;
++ njcr->JobStatus = -1;
++ set_jcr_job_status(njcr, jcr->JobStatus);
++ if (jcr->rstore) {
++ copy_rstorage(njcr, jcr->rstorage, _("previous Job"));
++ } else {
++ free_rstorage(njcr);
++ }
++ if (jcr->wstore) {
++ copy_wstorage(njcr, jcr->wstorage, _("previous Job"));
++ } else {
++ free_wstorage(njcr);
++ }
++ njcr->messages = jcr->messages;
++ njcr->spool_data = jcr->spool_data;
++ njcr->write_part_after_job = jcr->write_part_after_job;
++ Dmsg0(2300, "Call to run new job\n");
++ V(jq->mutex);
++ run_job(njcr); /* This creates a "new" job */
++ free_jcr(njcr); /* release "new" jcr */
++ P(jq->mutex);
++ Dmsg0(2300, "Back from running new job.\n");
++ }
++ return false;
++}
++
++/*
+ * See if we can acquire all the necessary resources for the job (JCR)
+ *
+ * Returns: true if successful
+@@ -681,11 +697,19 @@
+ bool skip_this_jcr = false;
+
+ jcr->acquired_resource_locks = false;
++ if (jcr->rstore == jcr->wstore) { /* deadlock */
++ Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
++ " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
++ jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
++ set_jcr_job_status(jcr, JS_Canceled);
++ return false;
++ }
+ if (jcr->rstore) {
+ Dmsg1(200, "Rstore=%s\n", jcr->rstore->name());
+ if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) {
++// jcr->rstore->NumConcurrentReadJobs++;
+ jcr->rstore->NumConcurrentJobs++;
+- Dmsg0(200, "Set rncj=1\n");
++ Dmsg1(200, "Inc rncj=%d\n", jcr->rstore->NumConcurrentJobs);
+ } else {
+ Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs);
+ set_jcr_job_status(jcr, JS_WaitStoreRes);
+@@ -695,25 +719,11 @@
+
+ if (jcr->wstore) {
+ Dmsg1(200, "Wstore=%s\n", jcr->wstore->name());
+- if (jcr->rstore == jcr->wstore) { /* deadlock */
+- jcr->rstore->NumConcurrentJobs--; /* back out rstore */
+- Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n"
+- " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"),
+- jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source);
+- set_jcr_job_status(jcr, JS_Canceled);
+- return false;
+- }
+- if (jcr->wstore->NumConcurrentJobs == 0 &&
+- jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
+- /* Simple case, first job */
+- jcr->wstore->NumConcurrentJobs = 1;
+- Dmsg0(200, "Set wncj=1\n");
+- } else if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
++ if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
+ jcr->wstore->NumConcurrentJobs++;
+ Dmsg1(200, "Inc wncj=%d\n", jcr->wstore->NumConcurrentJobs);
+ } else if (jcr->rstore) {
+- jcr->rstore->NumConcurrentJobs--; /* back out rstore */
+- Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
++ dec_read_store(jcr);
+ skip_this_jcr = true;
+ } else {
+ Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs);
+@@ -729,14 +739,8 @@
+ jcr->client->NumConcurrentJobs++;
+ } else {
+ /* Back out previous locks */
+- if (jcr->wstore) {
+- jcr->wstore->NumConcurrentJobs--;
+- Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
+- }
+- if (jcr->rstore) {
+- jcr->rstore->NumConcurrentJobs--;
+- Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
+- }
++ dec_write_store(jcr);
++ dec_read_store(jcr);
+ set_jcr_job_status(jcr, JS_WaitClientRes);
+ return false;
+ }
+@@ -744,14 +748,8 @@
+ jcr->job->NumConcurrentJobs++;
+ } else {
+ /* Back out previous locks */
+- if (jcr->wstore) {
+- jcr->wstore->NumConcurrentJobs--;
+- Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
+- }
+- if (jcr->rstore) {
+- jcr->rstore->NumConcurrentJobs--;
+- Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
+- }
++ dec_write_store(jcr);
++ dec_read_store(jcr);
+ jcr->client->NumConcurrentJobs--;
+ set_jcr_job_status(jcr, JS_WaitJobRes);
+ return false;
+@@ -760,3 +758,23 @@
+ jcr->acquired_resource_locks = true;
+ return true;
+ }
++
++static void dec_read_store(JCR *jcr)
++{
++ if (jcr->rstore) {
++// jcr->rstore->NumConcurrentReadJobs--; /* back out rstore */
++ jcr->rstore->NumConcurrentJobs--; /* back out rstore */
++ Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs);
++// ASSERT(jcr->rstore->NumConcurrentReadJobs >= 0);
++ ASSERT(jcr->rstore->NumConcurrentJobs >= 0);
++ }
++}
++
++static void dec_write_store(JCR *jcr)
++{
++ if (jcr->wstore) {
++ jcr->wstore->NumConcurrentJobs--;
++ Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs);
++ ASSERT(jcr->wstore->NumConcurrentJobs >= 0);
++ }
++}
--- /dev/null
+
+ This patch should fix a volume locking deadlock condition in the
+ Storage daemon as reported in bug #1100.
+
+ Apply it to version 2.4.0 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.0-sd-deadlock.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/stored/mount.c
+===================================================================
+--- src/stored/mount.c (revision 7204)
++++ src/stored/mount.c (working copy)
+@@ -179,9 +179,13 @@
+ }
+ Dmsg2(150, "Ask=%d autochanger=%d\n", ask, autochanger);
+
+- if (ask && !dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
+- Dmsg0(150, "Error return ask_sysop ...\n");
+- goto bail_out; /* error return */
++ if (ask) {
++ unlock_volumes();
++ if (!dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
++ Dmsg0(150, "Error return ask_sysop ...\n");
++ goto no_lock_bail_out; /* error return */
++ }
++ lock_volumes();
+ }
+ if (job_canceled(jcr)) {
+ goto bail_out;
--- /dev/null
+
+ This patch should fix bug #1118 where bat does not restore correctly
+ if multiple pools were used. Bat actually works correctly, but the default
+ Pool is taken from the Job resource, and for multiple pools the default
+ should be Any. This patch makes Any the default restore pool.
+ Apply it to version 2.4.1 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.1-bat-restore.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/qt-console/restore/prerestore.cpp
+===================================================================
+--- src/qt-console/restore/prerestore.cpp (revision 7414)
++++ src/qt-console/restore/prerestore.cpp (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2007-20087 Free Software Foundation Europe e.V.
++ Copyright (C) 2007-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.
+@@ -20,7 +20,7 @@
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+- Bacula® is a registered trademark of John Walker.
++ Bacula® is a registered trademark of Kern Sibbald.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+@@ -146,7 +146,7 @@
+ cmd += " fileset=\"" + filesetCombo->currentText() + "\"";
+ cmd += " client=\"" + clientCombo->currentText() + "\"";
+ if (selectJobRadio->isChecked()) {
+- if (poolCombo->currentText() != "Any" ){
++ if (poolCombo->currentText() != tr("Any") ){
+ cmd += " pool=\"" + poolCombo->currentText() + "\"";
+ }
+ cmd += " storage=\"" + storageCombo->currentText() + "\"";
+@@ -171,12 +171,10 @@
+ Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data());
+ }
+ m_console->write_dir(cmd.toUtf8().data());
+-// consoleCommand(cmd);
+
+ /* Note, do not turn notifier back on here ... */
+ if (selectFilesRadio->isChecked()) {
+ setConsoleCurrent();
+-// new restorePage();
+ closeStackPage();
+ } else {
+ closeStackPage();
+@@ -210,7 +208,7 @@
+ if (m_console->get_job_defaults(job_defs)) {
+ filesetCombo->setCurrentIndex(filesetCombo->findText(job_defs.fileset_name, Qt::MatchExactly));
+ clientCombo->setCurrentIndex(clientCombo->findText(job_defs.client_name, Qt::MatchExactly));
+- poolCombo->setCurrentIndex(poolCombo->findText(job_defs.pool_name, Qt::MatchExactly));
++ poolCombo->setCurrentIndex(poolCombo->findText(tr("Any"), Qt::MatchExactly));
+ storageCombo->setCurrentIndex(storageCombo->findText(job_defs.store_name, Qt::MatchExactly));
+ }
+ }
--- /dev/null
+
+ This patch should help prevent jobs from being migrated twice if
+ you happen to run two migration jobs at the same time. This should
+ fix or improve the problem reported in bug #1129.
+ Apply it to version 2.4.1 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.1-migration.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 7433)
++++ src/dird/migrate.c (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
++ Copyright (C) 2004-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.
+@@ -274,6 +274,21 @@
+ return true;
+ }
+
++ if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) {
++ Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to migrate. ERR=%s"),
++ edit_int64(jcr->previous_jr.JobId, ed1),
++ db_strerror(jcr->db));
++ set_jcr_job_status(jcr, JS_Terminated);
++ migration_cleanup(jcr, jcr->JobStatus);
++ return true;
++ }
++ /* Make sure this job was not already migrated */
++ if (jcr->previous_jr.JobType != JT_BACKUP) {
++ set_jcr_job_status(jcr, JS_Terminated);
++ migration_cleanup(jcr, jcr->JobStatus);
++ return true;
++ }
++
+ /* Print Job Start message */
+ Jmsg(jcr, M_INFO, 0, _("Start Migration JobId %s, Job=%s\n"),
+ edit_uint64(jcr->JobId, ed1), jcr->Job);
--- /dev/null
+
+ This patch causes the SD to try at least once to mount a Volume
+ that is not in an Autochanger before asking the operator to
+ intervene. Without it, the user must issue a mount command for
+ every File based volume that is needed.
+
+ Apply to 2.4.1 with the following:
+
+ cd <bacula-source>
+ patch -p0 <2.4.1-mount.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/stored/mount.c
+===================================================================
+--- src/stored/mount.c (revision 7378)
++++ src/stored/mount.c (working copy)
+@@ -142,7 +142,7 @@
+ } else {
+ autochanger = false;
+ VolCatInfo.Slot = 0;
+- ask = true;
++ ask = retry >= 2;
+ }
+ Dmsg1(150, "autoload_dev returns %d\n", autochanger);
+ /*
--- /dev/null
+
+ This patch removes an unfortunate piece of debug code that crept into
+ the 2.4.1 release and causes it to purposely, but incorrectly seg fault
+ whenever a volume name error occurs. Typically this may happen if a
+ non-bacula tape is mounted at startup or at the end of volume during
+ restore.
+
+ Apply the patch with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.1-sd-crash.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/stored/acquire.c
+===================================================================
+--- src/stored/acquire.c (revision 7405)
++++ src/stored/acquire.c (working copy)
+@@ -266,7 +266,6 @@
+ dev->close();
+ }
+ dev->set_load();
+- ASSERT(0);
+ /* Fall through */
+ default:
+ Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
--- /dev/null
+
+ This patch corrects a problem of manual mounting of volumes,
+ where Bacula will accept an incorrect volume for restore.
+ Apply it to version 2.4.1 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.1-wrong-volume.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/stored/mount.c
+===================================================================
+--- src/stored/mount.c (revision 7422)
++++ src/stored/mount.c (working copy)
+@@ -20,7 +20,7 @@
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+- Bacula® is a registered trademark of John Walker.
++ Bacula® is a registered trademark of Kern Sibbald.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+@@ -113,7 +113,9 @@
+ ask = true; /* ask operator to mount tape */
+ do_find = true; /* re-find a volume after unload */
+ }
+- do_swapping(true /*writing*/);
++ do_unload();
++ do_swapping(true /*is_writing*/);
++ do_load(true /*is_writing*/);
+
+ if (do_find && !find_a_volume()) {
+ goto no_lock_bail_out;
+@@ -500,12 +502,30 @@
+ return dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE);
+ }
+
+-void DCR::do_swapping(bool is_writing)
++bool DCR::do_unload()
+ {
+ if (dev->must_unload()) {
+ Dmsg1(100, "must_unload release %s\n", dev->print_name());
+ release_volume();
+ }
++ return false;
++}
++
++bool DCR::do_load(bool is_writing)
++{
++ if (dev->must_load()) {
++ Dmsg1(100, "Must load %s\n", dev->print_name());
++ if (autoload_device(this, is_writing, NULL) > 0) {
++ dev->clear_load();
++ return true;
++ }
++ return false;
++ }
++ return true;
++}
++
++void DCR::do_swapping(bool is_writing)
++{
+ /*
+ * See if we are asked to swap the Volume from another device
+ * if so, unload the other device here, and attach the
+@@ -522,17 +542,12 @@
+ }
+ if (dev->vol) {
+ dev->vol->clear_swapping();
++ Dmsg1(100, "=== set in_use vol=%s\n", dev->vol->vol_name);
+ dev->vol->set_in_use();
+ dev->VolHdr.VolumeName[0] = 0; /* don't yet have right Volume */
+ }
+ dev->swap_dev = NULL;
+ }
+- if (dev->must_load()) {
+- Dmsg1(100, "Must load %s\n", dev->print_name());
+- if (autoload_device(this, is_writing, NULL) > 0) {
+- dev->clear_load();
+- }
+- }
+ }
+
+
+Index: src/stored/dev.h
+===================================================================
+--- src/stored/dev.h (revision 7422)
++++ src/stored/dev.h (working copy)
+@@ -542,6 +542,8 @@
+ int check_volume_label(bool &ask, bool &autochanger);
+ void release_volume();
+ void do_swapping(bool is_writing);
++ bool do_unload();
++ bool do_load(bool is_writing);
+ bool is_tape_position_ok();
+ };
+
+Index: src/stored/acquire.c
+===================================================================
+--- src/stored/acquire.c (revision 7422)
++++ src/stored/acquire.c (working copy)
+@@ -20,7 +20,7 @@
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+- Bacula® is a registered trademark of John Walker.
++ Bacula® is a registered trademark of Kern Sibbald.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+@@ -38,6 +38,7 @@
+
+ /* Forward referenced functions */
+ static void attach_dcr_to_dev(DCR *dcr);
++static void set_dcr_from_vol(DCR *dcr, VOL_LIST *vol);
+
+
+ /*********************************************************************
+@@ -88,15 +89,9 @@
+ jcr->NumReadVolumes, jcr->CurReadVolume);
+ goto get_out; /* should not happen */
+ }
+- /*
+- * Note, if we want to be able to work from a .bsr file only
+- * for disaster recovery, we must "simulate" reading the catalog
+- */
+- bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
+- bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
+- bstrncpy(dcr->media_type, vol->MediaType, sizeof(dcr->media_type));
+- dcr->VolCatInfo.Slot = vol->Slot;
+- dcr->VolCatInfo.InChanger = vol->Slot > 0;
++ set_dcr_from_vol(dcr, vol);
++
++ Dmsg2(100, "Want Vol=%s Slot=%d\n", vol->VolumeName, vol->Slot);
+
+ /*
+ * If the MediaType requested for this volume is not the
+@@ -174,20 +169,12 @@
+
+ dev->clear_unload();
+
+- if (reserve_volume(dcr, dcr->VolumeName) == NULL) {
+- Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
+- dcr->dev->print_name());
+- Jmsg2(jcr, M_FATAL, 0, _("Could not reserve volume %s on %s\n"), dcr->VolumeName,
+- dcr->dev->print_name());
+- goto get_out;
+- }
+ if (dev->vol && dev->vol->is_swapping()) {
+ dev->vol->set_slot(vol->Slot);
+ Dmsg3(100, "swapping: slot=%d Vol=%s dev=%s\n", dev->vol->get_slot(),
+ dev->vol->vol_name, dev->print_name());
+ }
+
+-
+ init_device_wait_timers(dcr);
+
+ tape_previously_mounted = dev->can_read() || dev->can_append() ||
+@@ -217,7 +204,10 @@
+ goto get_out; /* error return */
+ }
+
+- dcr->do_swapping(false/*is_writing*/);
++ dcr->do_unload();
++ dcr->do_swapping(false/*!is_writing*/);
++ dcr->do_load(false /*!is_writing*/);
++ set_dcr_from_vol(dcr, vol); /* refresh dcr with desired volume info */
+
+ /*
+ * This code ensures that the device is ready for
+@@ -239,10 +229,12 @@
+ vol_label_status = read_dev_volume_label(dcr);
+ switch (vol_label_status) {
+ case VOL_OK:
++ Dmsg0(50, "Got correct volume.\n");
+ ok = true;
+ dev->VolCatInfo = dcr->VolCatInfo; /* structure assignment */
+ break; /* got it */
+ case VOL_IO_ERROR:
++ Dmsg0(50, "IO Error\n");
+ /*
+ * Send error message generated by read_dev_volume_label()
+ * only we really had a tape mounted. This supresses superfluous
+@@ -253,13 +245,10 @@
+ }
+ goto default_path;
+ case VOL_NAME_ERROR:
++ Dmsg0(50, "Vol name error.\n");
+ if (dev->is_volume_to_unload()) {
+ goto default_path;
+ }
+-// if (tape_initially_mounted) {
+- tape_initially_mounted = false;
+-// goto default_path;
+-// }
+ dev->set_unload(); /* force unload of unwanted tape */
+ if (!unload_autochanger(dcr, -1)) {
+ /* at least free the device so we can re-open with correct volume */
+@@ -270,6 +259,7 @@
+ default:
+ Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
+ default_path:
++ Dmsg0(50, "default path\n");
+ tape_previously_mounted = true;
+
+ /*
+@@ -289,15 +279,6 @@
+ try_autochanger = false;
+ continue; /* try reading volume mounted */
+ }
+- /* Try closing and re-opening */
+- dev->close();
+- if (dev->open(dcr, OPEN_READ_ONLY) >= 0) {
+- continue;
+- }
+- if (!dev->poll) {
+- Jmsg3(jcr, M_WARNING, 0, _("Read open device %s Volume \"%s\" failed: ERR=%s\n"),
+- dev->print_name(), dcr->VolumeName, dev->bstrerror());
+- }
+ }
+
+ /* Mount a specific volume and no other */
+@@ -305,7 +286,7 @@
+ if (!dir_ask_sysop_to_mount_volume(dcr, ST_READ)) {
+ goto get_out; /* error return */
+ }
+- try_autochanger = true; /* permit using autochanger again */
++ try_autochanger = true; /* permit trying the autochanger again */
+ continue; /* try reading again */
+ } /* end switch */
+ break;
+@@ -693,3 +674,16 @@
+ }
+ free(dcr);
+ }
++
++static void set_dcr_from_vol(DCR *dcr, VOL_LIST *vol)
++{
++ /*
++ * Note, if we want to be able to work from a .bsr file only
++ * for disaster recovery, we must "simulate" reading the catalog
++ */
++ bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
++ bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
++ bstrncpy(dcr->media_type, vol->MediaType, sizeof(dcr->media_type));
++ dcr->VolCatInfo.Slot = vol->Slot;
++ dcr->VolCatInfo.InChanger = vol->Slot > 0;
++}
--- /dev/null
+
+ This patch should clean up two problems with bat:
+ 1. Eliminate print error output concerning job plotting
+ 2. Eliminate the error messages where bat complains about being busy.
+ It also backports some new trunk code.
+ Apply it to Bacula version 2.4.2 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-bat.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/qt-console/mainwin.h
+===================================================================
+--- src/qt-console/mainwin.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/mainwin.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -107,9 +107,7 @@
+ void runButtonClicked();
+ void estimateButtonClicked();
+ void browseButtonClicked();
+-#ifdef HAVE_QWT
+ void jobPlotButtonClicked();
+-#endif
+ void restoreButtonClicked();
+ void undockWindowButton();
+ void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
+Index: src/qt-console/fileset/fileset.h
+===================================================================
+--- src/qt-console/fileset/fileset.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/fileset/fileset.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -62,6 +62,7 @@
+ void createContextMenu();
+ QString m_currentlyselected;
+ bool m_populated;
++ bool m_populating;
+ bool m_checkcurwidget;
+ };
+
+Index: src/qt-console/fileset/fileset.cpp
+===================================================================
+--- src/qt-console/fileset/fileset.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/fileset/fileset.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -50,6 +50,7 @@
+
+ /* mp_treeWidget, FileSet Tree Tree Widget inherited from ui_fileset.h */
+ m_populated = false;
++ m_populating = false;
+ m_checkcurwidget = true;
+ m_closeable = false;
+ readSettings();
+@@ -70,6 +71,10 @@
+ */
+ void FileSet::populateTree()
+ {
++ if (m_populating)
++ return;
++ m_populating = true;
++
+ QTreeWidgetItem *filesetItem, *topItem;
+
+ if (!m_console->preventInUseConnect())
+@@ -102,7 +107,7 @@
+ " FROM FileSet"
+ " WHERE ";
+ query += " FileSet='" + filesetName + "'";
+- query += " ORDER BY FileSet";
++ query += " ORDER BY CreateTime DESC LIMIT 1";
+
+ QStringList results;
+ if (mainWin->m_sqlDebug) {
+@@ -135,7 +140,7 @@
+ for (int cnter=0; cnter<headerlist.size(); cnter++) {
+ mp_treeWidget->resizeColumnToContents(cnter);
+ }
+-
++ m_populating = false;
+ }
+
+ /*
+Index: src/qt-console/clients/clients.cpp
+===================================================================
+--- src/qt-console/clients/clients.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/clients/clients.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -51,6 +51,7 @@
+
+ /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */
+ m_populated = false;
++ m_populating = false;
+ m_checkcurwidget = true;
+ m_closeable = false;
+ /* add context sensitive menu items specific to this classto the page
+@@ -70,6 +71,9 @@
+ */
+ void Clients::populateTree()
+ {
++ if (m_populating)
++ return;
++ m_populating = true;
+ QTreeWidgetItem *clientItem, *topItem;
+
+ if (!m_console->preventInUseConnect())
+@@ -135,6 +139,7 @@
+ for(int cnter=0; cnter<headerlist.size(); cnter++) {
+ mp_treeWidget->resizeColumnToContents(cnter);
+ }
++ m_populating = false;
+ }
+
+ /*
+Index: src/qt-console/clients/clients.h
+===================================================================
+--- src/qt-console/clients/clients.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/clients/clients.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -62,6 +62,7 @@
+ void createContextMenu();
+ QString m_currentlyselected;
+ bool m_populated;
++ bool m_populating;
+ bool m_checkcurwidget;
+ };
+
+Index: src/qt-console/storage/storage.cpp
+===================================================================
+--- src/qt-console/storage/storage.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/storage/storage.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -52,6 +52,7 @@
+
+ /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_storage.h */
+ m_populated = false;
++ m_populating = false;
+ m_checkcurwidget = true;
+ m_closeable = false;
+ m_currentStorage = "";
+@@ -71,6 +72,9 @@
+ */
+ void Storage::populateTree()
+ {
++ if (m_populating)
++ return;
++ m_populating = true;
+ QTreeWidgetItem *storageItem, *topItem;
+
+ if (!m_console->preventInUseConnect())
+@@ -135,6 +139,7 @@
+ for(int cnter=0; cnter<headerlist.size(); cnter++) {
+ mp_treeWidget->resizeColumnToContents(cnter);
+ }
++ m_populating = false;
+ }
+
+ /*
+Index: src/qt-console/storage/storage.h
+===================================================================
+--- src/qt-console/storage/storage.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/storage/storage.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -66,6 +66,7 @@
+ QString m_currentStorage;
+ int m_currentAutoChanger;
+ bool m_populated;
++ bool m_populating;
+ bool m_checkcurwidget;
+ };
+
+Index: src/qt-console/medialist/medialist.h
+===================================================================
+--- src/qt-console/medialist/medialist.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/medialist/medialist.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -66,10 +66,13 @@
+ private:
+ void createContextMenu();
+ void setStatusColor(QTreeWidgetItem *, QString &, int &);
++ void writeExpandedSettings();
+ QString m_currentVolumeName;
+ QString m_currentVolumeId;
+ bool m_populated;
++ bool m_populating;
+ bool m_checkcurwidget;
++ QTreeWidgetItem *m_topItem;
+ };
+
+ #endif /* _MEDIALIST_H_ */
+Index: src/qt-console/medialist/medialist.cpp
+===================================================================
+--- src/qt-console/medialist/medialist.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/medialist/medialist.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -54,6 +54,7 @@
+
+ /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */
+ m_populated = false;
++ m_populating = false;
+ m_checkcurwidget = true;
+ m_closeable = false;
+ /* add context sensitive menu items specific to this classto the page
+@@ -64,6 +65,8 @@
+
+ MediaList::~MediaList()
+ {
++ if (m_populated)
++ writeExpandedSettings();
+ }
+
+ /*
+@@ -72,7 +75,10 @@
+ */
+ void MediaList::populateTree()
+ {
+- QTreeWidgetItem *mediatreeitem, *pooltreeitem, *topItem;
++ QTreeWidgetItem *mediatreeitem, *pooltreeitem;
++ if (m_populating)
++ return;
++ m_populating = true;
+
+ if (!m_console->preventInUseConnect())
+ return;
+@@ -85,23 +91,31 @@
+ int statusIndex = headerlist.indexOf("Status");
+
+ m_checkcurwidget = false;
++ if (m_populated)
++ writeExpandedSettings();
+ mp_treeWidget->clear();
+ m_checkcurwidget = true;
+ mp_treeWidget->setColumnCount(headerlist.count());
+- topItem = new QTreeWidgetItem(mp_treeWidget);
+- topItem->setText(0, "Pools");
+- topItem->setData(0, Qt::UserRole, 0);
+- topItem->setExpanded(true);
++ m_topItem = new QTreeWidgetItem(mp_treeWidget);
++ m_topItem->setText(0, "Pools");
++ m_topItem->setData(0, Qt::UserRole, 0);
++ m_topItem->setExpanded(true);
+
+ mp_treeWidget->setHeaderLabels(headerlist);
+
++ QSettings settings(m_console->m_dir->name(), "bat");
++ settings.beginGroup("MediaListTreeExpanded");
+ QString query;
+
+ foreach (QString pool_listItem, m_console->pool_list) {
+- pooltreeitem = new QTreeWidgetItem(topItem);
++ pooltreeitem = new QTreeWidgetItem(m_topItem);
+ pooltreeitem->setText(0, pool_listItem);
+ pooltreeitem->setData(0, Qt::UserRole, 1);
+- pooltreeitem->setExpanded(true);
++ if(settings.contains(pool_listItem)) {
++ pooltreeitem->setExpanded(settings.value(pool_listItem).toBool());
++ } else {
++ pooltreeitem->setExpanded(true);
++ }
+
+ query = "SELECT Media.VolumeName AS Media, "
+ " Media.MediaId AS Id, Media.VolStatus AS VolStatus,"
+@@ -151,10 +165,12 @@
+ } /* foreach resultline */
+ } /* if results from query */
+ } /* foreach pool_listItem */
++ settings.endGroup();
+ /* Resize the columns */
+ for(int cnter=0; cnter<headerlist.count(); cnter++) {
+ mp_treeWidget->resizeColumnToContents(cnter);
+ }
++ m_populating = false;
+ }
+
+ void MediaList::setStatusColor(QTreeWidgetItem *item, QString &field, int &index)
+@@ -362,3 +378,18 @@
+ consoleCommand(cmd);
+ populateTree();
+ }
++
++/*
++ * Write settings to save expanded states of the pools
++ */
++void MediaList::writeExpandedSettings()
++{
++ QSettings settings(m_console->m_dir->name(), "bat");
++ settings.beginGroup("MediaListTreeExpanded");
++ int childcount = m_topItem->childCount();
++ for (int cnt=0; cnt<childcount; cnt++) {
++ QTreeWidgetItem *poolitem = m_topItem->child(cnt);
++ settings.setValue(poolitem->text(0), poolitem->isExpanded());
++ }
++ settings.endGroup();
++}
+Index: src/qt-console/mainwin.cpp
+===================================================================
+--- src/qt-console/mainwin.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/mainwin.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -441,14 +441,14 @@
+ new prerestorePage();
+ }
+
+-#ifdef HAVE_QWT
+ void MainWin::jobPlotButtonClicked()
+ {
++#ifdef HAVE_QWT
+ JobPlotPass pass;
+ pass.use = false;
+ new JobPlot(NULL, pass);
++#endif
+ }
+-#endif
+
+ /*
+ * The user just finished typing a line in the command line edit box
+Index: src/qt-console/jobs/jobs.h
+===================================================================
+--- src/qt-console/jobs/jobs.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/jobs/jobs.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -66,6 +66,7 @@
+ void createContextMenu();
+ QString m_currentlyselected;
+ bool m_populated;
++ bool m_populating;
+ bool m_checkcurwidget;
+ int m_typeIndex;
+ };
+Index: src/qt-console/jobs/jobs.cpp
+===================================================================
+--- src/qt-console/jobs/jobs.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/jobs/jobs.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -49,6 +49,7 @@
+
+ /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */
+ m_populated = false;
++ m_populating = false;
+ m_checkcurwidget = true;
+ m_closeable = false;
+ /* add context sensitive menu items specific to this classto the page
+@@ -68,6 +69,9 @@
+ */
+ void Jobs::populateTree()
+ {
++ if (m_populating)
++ return;
++ m_populating = true;
+ QTreeWidgetItem *jobsItem, *topItem;
+
+ if (!m_console->preventInUseConnect())
+Index: src/qt-console/joblist/joblist.cpp
+===================================================================
+--- src/qt-console/joblist/joblist.cpp (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/joblist/joblist.cpp (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -60,6 +60,7 @@
+
+ m_resultCount = 0;
+ m_populated = false;
++ m_populating = false;
+ m_closeable = false;
+ if ((m_mediaName != "") || (m_clientName != "") || (m_jobName != "") || (m_filesetName != ""))
+ m_closeable=true;
+@@ -106,6 +107,10 @@
+ */
+ void JobList::populateTable()
+ {
++ if (m_populating)
++ return;
++ m_populating = true;
++
+ QStringList results;
+ QString resultline;
+ QBrush blackBrush(Qt::black);
+@@ -293,6 +298,7 @@
+ tr("The Jobs query returned no results.\n"
+ "Press OK to continue?"), QMessageBox::Ok );
+ }
++ m_populating = false;
+ }
+
+ void JobList::setStatusColor(QTableWidgetItem *item, QString &field)
+@@ -574,9 +580,9 @@
+ /*
+ * Graph this table
+ */
+-#ifdef HAVE_QWT
+ void JobList::graphTable()
+ {
++#ifdef HAVE_QWT
+ JobPlotPass pass;
+ pass.recordLimitCheck = limitCheckBox->checkState();
+ pass.daysLimitCheck = daysCheckBox->checkState();
+@@ -592,8 +598,8 @@
+ pass.use = true;
+ QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
+ new JobPlot(pageSelectorTreeWidgetItem, pass);
++#endif
+ }
+-#endif
+
+ /*
+ * Save user settings associated with this page
+Index: src/qt-console/joblist/joblist.h
+===================================================================
+--- src/qt-console/joblist/joblist.h (.../tags/Release-2.4.2/bacula) (revision 7468)
++++ src/qt-console/joblist/joblist.h (.../branches/Branch-2.4/bacula) (revision 7468)
+@@ -67,9 +67,7 @@
+ void preRestoreFromTime();
+ void showLogForJob();
+ void consoleCancelJob();
+-#ifdef HAVE_QWT
+ void graphTable();
+-#endif
+
+ private:
+ void createConnections();
+@@ -85,6 +83,7 @@
+ QString m_filesetName;
+ QString m_currentJob;
+ bool m_populated;
++ bool m_populating;
+ bool m_checkCurrentWidget;
+ int m_purgedIndex;
+ int m_typeIndex;
--- /dev/null
+
+ This patch causes that jobs not yet created are now removed from
+ the work queue just after the cancel command.
+
+ It can be applied to 2.4.2 (not to previous versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-cancel-non-running-jobs.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+Index: src/dird/job.c
+===================================================================
+--- src/dird/job.c (révision 7681)
++++ src/dird/job.c (copie de travail)
+@@ -354,10 +354,11 @@
+ {
+ BSOCK *sd, *fd;
+ char ed1[50];
++ int32_t old_status = jcr->JobStatus;
+
+ set_jcr_job_status(jcr, JS_Canceled);
+
+- switch (jcr->JobStatus) {
++ switch (old_status) {
+ case JS_Created:
+ case JS_WaitJobRes:
+ case JS_WaitClientRes:
+
--- /dev/null
+
+ This patch fixes the seg faults that occur in the Director if an incorrect
+ estimate command is given -- in particular a level specification without
+ the value. This fixes bug #1140
+ Apply this patch to Bacula 2.4.2 (and possibly earlier versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-estimate-cmd.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/dird/ua_cmds.c
+===================================================================
+--- src/dird/ua_cmds.c (revision 7469)
++++ src/dird/ua_cmds.c (working copy)
+@@ -1079,17 +1079,31 @@
+ strcasecmp(ua->argk[i], NT_("fd")) == 0) {
+ if (ua->argv[i]) {
+ client = GetClientResWithName(ua->argv[i]);
++ if (!client) {
++ ua->error_msg(_("Client \"%s\" not found.\n"), ua->argv[i]);
++ return 1;
++ }
+ continue;
++ } else {
++ ua->error_msg(_("Client name missing.\n"));
++ return 1;
+ }
+ }
+ if (strcasecmp(ua->argk[i], NT_("job")) == 0) {
+ if (ua->argv[i]) {
+ job = GetJobResWithName(ua->argv[i]);
+- if (job && !acl_access_ok(ua, Job_ACL, job->name())) {
++ if (!job) {
++ ua->error_msg(_("Job \"%s\" not found.\n"), ua->argv[i]);
++ return 1;
++ }
++ if (!acl_access_ok(ua, Job_ACL, job->name())) {
+ ua->error_msg(_("No authorization for Job \"%s\"\n"), job->name());
+ return 1;
+ }
+ continue;
++ } else {
++ ua->error_msg(_("Job name missing.\n"));
++ return 1;
+ }
+ }
+ if (strcasecmp(ua->argk[i], NT_("fileset")) == 0) {
+@@ -1100,15 +1114,25 @@
+ return 1;
+ }
+ continue;
++ } else {
++ ua->error_msg(_("Fileset name missing.\n"));
++ return 1;
+ }
++
+ }
+ if (strcasecmp(ua->argk[i], NT_("listing")) == 0) {
+ listing = 1;
+ continue;
+ }
+ if (strcasecmp(ua->argk[i], NT_("level")) == 0) {
+- if (!get_level_from_name(ua->jcr, ua->argv[i])) {
+- ua->error_msg(_("Level %s not valid.\n"), ua->argv[i]);
++ if (ua->argv[i]) {
++ if (!get_level_from_name(ua->jcr, ua->argv[i])) {
++ ua->error_msg(_("Level \"%s\" not valid.\n"), ua->argv[i]);
++ }
++ continue;
++ } else {
++ ua->error_msg(_("Level value missing.\n"));
++ return 1;
+ }
+ continue;
+ }
--- /dev/null
+
+ Attempt to fix bug #1128 InChanger flag cleared during Migration
+ job when reading from one autochanger and writing to another.
+ Testing is needed.
+ Apply this patch to Bacula version 2.4.2 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-inchanger.patch
+ ./configure <your options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/catreq.c
+===================================================================
+--- src/dird/catreq.c (revision 7507)
++++ src/dird/catreq.c (working copy)
+@@ -83,7 +83,7 @@
+ jcr->MediaId = mr->MediaId;
+ pm_strcpy(jcr->VolumeName, mr->VolumeName);
+ bash_spaces(mr->VolumeName);
+- stat = bnet_fsend(sd, OK_media, mr->VolumeName, mr->VolJobs,
++ stat = sd->fsend(OK_media, mr->VolumeName, mr->VolJobs,
+ mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
+ mr->VolMounts, mr->VolErrors, mr->VolWrites,
+ edit_uint64(mr->MaxVolBytes, ed2),
+@@ -266,11 +266,22 @@
+ }
+ }
+ Dmsg2(400, "Update media: BefVolJobs=%u After=%u\n", mr.VolJobs, sdmr.VolJobs);
++
+ /* Check if the volume has been written by the job,
+ * and update the LastWritten field if needed */
+ if (mr.VolBlocks != sdmr.VolBlocks) {
+ mr.LastWritten = sdmr.LastWritten;
+ }
++
++ /*
++ * Update to point to the last device used to write the Volume.
++ * However, do so only if we are writing the tape, i.e.
++ * the number of VolWrites has increased.
++ */
++ if (jcr->wstore && jcr->wstore->StorageId && sdmr.VolWrites > mr.VolWrites) {
++ mr.StorageId = jcr->wstore->StorageId;
++ }
++
+ /* Copy updated values to original media record */
+ mr.VolJobs = sdmr.VolJobs;
+ mr.VolFiles = sdmr.VolFiles;
+@@ -285,14 +296,6 @@
+ mr.VolWriteTime = sdmr.VolWriteTime;
+ mr.VolParts = sdmr.VolParts;
+ bstrncpy(mr.VolStatus, sdmr.VolStatus, sizeof(mr.VolStatus));
+- /*
+- * Update to point to the last device used to write the Volume.
+- * However, do so only if we are writing the tape, i.e.
+- * the number of VolBlocks has increased.
+- */
+- if (jcr->wstore && jcr->wstore->StorageId && mr.VolBlocks != sdmr.VolBlocks) {
+- mr.StorageId = jcr->wstore->StorageId;
+- }
+
+ Dmsg2(400, "db_update_media_record. Stat=%s Vol=%s\n", mr.VolStatus, mr.VolumeName);
+ /*
+Index: src/dird/dird.c
+===================================================================
+--- src/dird/dird.c (revision 7507)
++++ src/dird/dird.c (working copy)
+@@ -914,6 +914,7 @@
+ db_create_storage_record(NULL, db, &sr);
+ store->StorageId = sr.StorageId; /* set storage Id */
+ if (!sr.created) { /* if not created, update it */
++ sr.AutoChanger = store->autochanger;
+ db_update_storage_record(NULL, db, &sr);
+ }
+
+Index: src/cats/sql_update.c
+===================================================================
+--- src/cats/sql_update.c (revision 7507)
++++ src/cats/sql_update.c (working copy)
+@@ -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.
+@@ -445,7 +445,8 @@
+ db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
+ {
+ char ed1[50], ed2[50];
+- if (mr->InChanger != 0 && mr->Slot != 0) {
++ if (mr->InChanger != 0 && mr->Slot != 0 && mr->StorageId != 0 &&
++ mr->MediaId != 0) {
+ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE "
+ "Slot=%d AND StorageId=%s AND MediaId!=%s",
+ mr->Slot,
--- /dev/null
+
+ This patch should fix the race condition that leads to a Director
+ crash at job end time when the job list is updated. This was reported
+ in bug #1162.
+
+ Apply this patch to Bacula version 2.4.2 (and earlier) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-jobend-crash.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/lib/jcr.c
+===================================================================
+--- src/lib/jcr.c (revision 7627)
++++ src/lib/jcr.c (working copy)
+@@ -110,6 +110,7 @@
+ void term_last_jobs_list()
+ {
+ if (last_jobs) {
++ lock_last_jobs_list();
+ while (!last_jobs->empty()) {
+ void *je = last_jobs->first();
+ last_jobs->remove(je);
+@@ -117,6 +118,7 @@
+ }
+ delete last_jobs;
+ last_jobs = NULL;
++ unlock_last_jobs_list();
+ }
+ if (jcrs) {
+ delete jcrs;
+@@ -128,6 +130,7 @@
+ {
+ struct s_last_job *je, job;
+ uint32_t num;
++ bool ok = true;
+
+ Dmsg1(100, "read_last_jobs seek to %d\n", (int)addr);
+ if (addr == 0 || lseek(fd, (off_t)addr, SEEK_SET) < 0) {
+@@ -140,11 +143,13 @@
+ if (num > 4 * max_last_jobs) { /* sanity check */
+ return false;
+ }
++ lock_last_jobs_list();
+ for ( ; num; num--) {
+ if (read(fd, &job, sizeof(job)) != sizeof(job)) {
+ berrno be;
+ Pmsg1(000, "Read job entry. ERR=%s\n", be.bstrerror());
+- return false;
++ ok = false;
++ break;
+ }
+ if (job.JobId > 0) {
+ je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
+@@ -160,41 +165,48 @@
+ }
+ }
+ }
+- return true;
++ unlock_last_jobs_list();
++ return ok;
+ }
+
+ uint64_t write_last_jobs_list(int fd, uint64_t addr)
+ {
+ struct s_last_job *je;
+ uint32_t num;
++ ssize_t stat;
+
+ Dmsg1(100, "write_last_jobs seek to %d\n", (int)addr);
+ if (lseek(fd, (off_t)addr, SEEK_SET) < 0) {
+ return 0;
+ }
+ if (last_jobs) {
++ lock_last_jobs_list();
+ /* First record is number of entires */
+ num = last_jobs->size();
+ if (write(fd, &num, sizeof(num)) != sizeof(num)) {
+ berrno be;
+ Pmsg1(000, "Error writing num_items: ERR=%s\n", be.bstrerror());
+- return 0;
++ goto bail_out;
+ }
+ foreach_dlist(je, last_jobs) {
+ if (write(fd, je, sizeof(struct s_last_job)) != sizeof(struct s_last_job)) {
+ berrno be;
+ Pmsg1(000, "Error writing job: ERR=%s\n", be.bstrerror());
+- return 0;
++ goto bail_out;
+ }
+ }
++ unlock_last_jobs_list();
+ }
+ /* Return current address */
+- ssize_t stat = lseek(fd, 0, SEEK_CUR);
++ stat = lseek(fd, 0, SEEK_CUR);
+ if (stat < 0) {
+ stat = 0;
+ }
+ return stat;
+
++bail_out:
++ unlock_last_jobs_list();
++ return 0;
+ }
+
+ void lock_last_jobs_list()
+@@ -331,6 +343,7 @@
+ last_job.end_time = time(NULL);
+ /* Keep list of last jobs, but not Console where JobId==0 */
+ if (last_job.JobId > 0) {
++ lock_last_jobs_list();
+ je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
+ memcpy((char *)je, (char *)&last_job, sizeof(last_job));
+ if (!last_jobs) {
+@@ -342,6 +355,7 @@
+ last_jobs->remove(je);
+ free(je);
+ }
++ unlock_last_jobs_list();
+ }
+ break;
+ default:
--- /dev/null
+
+ This patch causes a message to be printed if the migration job finds that
+ the target job has already been migrated:
+
+ JobId %s already migrated probably by another Job. Migration stopped.
+
+ It can be applied to 2.4.2 (not to previous versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-mig-message.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 7444)
++++ src/dird/migrate.c (working copy)
+@@ -284,6 +284,8 @@
+ }
+ /* Make sure this job was not already migrated */
+ if (jcr->previous_jr.JobType != JT_BACKUP) {
++ Jmsg(jcr, M_INFO, 0, _("JobId %s already migrated probably by another Job. Migration stopped.\n"),
++ edit_int64(jcr->previous_jr.JobId, ed1));
+ set_jcr_job_status(jcr, JS_Terminated);
+ migration_cleanup(jcr, jcr->JobStatus);
+ return true;
--- /dev/null
+
+ This patch should correct bug #1159 where Migration does not properly
+ respect the Migration Low Bytes directive.
+
+ Apply it to Bacula version 2.4.2 (or possibly earlier) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-migrate-poolsize.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 7566)
++++ src/dird/migrate.c (working copy)
+@@ -557,13 +557,16 @@
+ " AND Job.Type='B'"
+ " ORDER by Job.StartTime";
+
+-/* Get tne number of bytes in the pool */
++/* Get the number of bytes in the pool */
+ const char *sql_pool_bytes =
+- "SELECT SUM(VolBytes) FROM Media,Pool WHERE"
++ "SELECT SUM(JobBytes) FROM Job WHERE JobId IN"
++ " (SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE"
++ " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND"
+ " VolStatus in ('Full','Used','Error','Append') AND Media.Enabled=1 AND"
+- " Media.PoolId=Pool.PoolId AND Pool.Name='%s'";
++ " Job.Type='B' AND"
++ " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId)";
+
+-/* Get tne number of bytes in the Jobs */
++/* Get the number of bytes in the Jobs */
+ const char *sql_job_bytes =
+ "SELECT SUM(JobBytes) FROM Job WHERE JobId IN (%s)";
+
--- /dev/null
+
+ This patch fixes migration SQL not to migrate a job that has not
+ terminated, or in otherwords do not migrate a running job.
+ This is a partial fix to bug #1164.
+
+ Any prior patches to src/dird/migration must already be applied.
+ Apply it to 2.4.2 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-migration-deadlock.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 7729)
++++ src/dird/migrate.c (working copy)
+@@ -554,7 +554,7 @@
+ const char *sql_jobids_from_mediaid =
+ "SELECT DISTINCT Job.JobId,Job.StartTime FROM JobMedia,Job"
+ " WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId IN (%s)"
+- " AND Job.Type='B'"
++ " AND Job.Type='B' AND Job.JobStatus = 'T'"
+ " ORDER by Job.StartTime";
+
+ /* Get the number of bytes in the pool */
+@@ -563,7 +563,7 @@
+ " (SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE"
+ " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND"
+ " VolStatus in ('Full','Used','Error','Append') AND Media.Enabled=1 AND"
+- " Job.Type='B' AND"
++ " Job.Type='B' AND Job.JobStatus = 'T' AND"
+ " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId)";
+
+ /* Get the number of bytes in the Jobs */
+@@ -582,7 +582,7 @@
+ "SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE"
+ " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND"
+ " VolStatus in ('Full','Used','Error') AND Media.Enabled=1 AND"
+- " Job.Type='B' AND"
++ " Job.Type='B' AND Job.JobStatus = 'T' AND"
+ " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId"
+ " AND Job.RealEndTime<='%s'";
+
--- /dev/null
+
+ This patch fixes an error when reading (restore, migration, Vbackup) and
+ SD acquire.c must switch drives. The error message complained of a NULL
+ volume name.
+
+ Apply this patch to version 2.4.2 with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-null-vol.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/stored/acquire.c
+===================================================================
+--- src/stored/acquire.c (revision 7500)
++++ src/stored/acquire.c (working copy)
+@@ -111,10 +111,10 @@
+ DIRSTORE *store;
+ int stat;
+
+- Jmsg3(jcr, M_INFO, 0, _("Changing device. Want Media Type=\"%s\" have=\"%s\"\n"
++ Jmsg3(jcr, M_INFO, 0, _("Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
+ " device=%s\n"),
+ dcr->media_type, dev->device->media_type, dev->print_name());
+- Dmsg3(50, "Changing device. Want Media Type=\"%s\" have=\"%s\"\n"
++ Dmsg3(50, "Changing read device. Want Media Type=\"%s\" have=\"%s\"\n"
+ " device=%s\n",
+ dcr->media_type, dev->device->media_type, dev->print_name());
+
+@@ -147,9 +147,9 @@
+ dev = dcr->dev; /* get new device pointer */
+ dev->dblock(BST_DOING_ACQUIRE);
+ dcr->VolumeName[0] = 0;
+- Jmsg(jcr, M_INFO, 0, _("Media Type change. New device %s chosen.\n"),
++ Jmsg(jcr, M_INFO, 0, _("Media Type change. New read device %s chosen.\n"),
+ dev->print_name());
+- Dmsg1(50, "Media Type change. New device %s chosen.\n", dev->print_name());
++ Dmsg1(50, "Media Type change. New read device %s chosen.\n", dev->print_name());
+
+ bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
+ bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
+@@ -430,11 +430,14 @@
+ dcr->clear_reserved();
+
+ if (dev->can_read()) {
++ VOLUME_CAT_INFO *vol = &dev->VolCatInfo;
+ dev->clear_read(); /* clear read bit */
+- Dmsg0(100, "dir_update_vol_info. Release0\n");
+- dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
+- volume_unused(dcr);
+-
++ Dmsg2(000, "dir_update_vol_info. label=%d Vol=%s\n",
++ dev->is_labeled(), vol->VolCatName);
++ if (dev->is_labeled() && vol->VolCatName[0] != 0) {
++ dir_update_volume_info(dcr, false, false); /* send Volume info to Director */
++ volume_unused(dcr);
++ }
+ } else if (dev->num_writers > 0) {
+ /*
+ * Note if WEOT is set, we are at the end of the tape
--- /dev/null
+
+ This patch fixes a missing storage name problem, which as far
+ as we can tell never created any problem.
+ Apply the patch to version 2.4.2 (and previous versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-storename.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/msgchan.c
+===================================================================
+--- src/dird/msgchan.c (revision 7507)
++++ src/dird/msgchan.c (working copy)
+@@ -229,6 +229,7 @@
+ bash_spaces(pool_name);
+ foreach_alist(storage, rstore) {
+ Dmsg1(100, "Rstore=%s\n", storage->name());
++ pm_strcpy(store_name, storage->name());
+ bash_spaces(store_name);
+ pm_strcpy(media_type, storage->media_type);
+ bash_spaces(media_type);
--- /dev/null
+
+ This patch corrects a Verify InitCatalog problem where in certain cases
+ a garbage filename may be entered in the verification database. This
+ fixes bug #1143.
+
+ Apply the patch to version 2.4.2 (and previous versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-verify.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/fd_cmds.c
+===================================================================
+--- src/dird/fd_cmds.c (revision 7469)
++++ src/dird/fd_cmds.c (working copy)
+@@ -616,7 +616,6 @@
+ char *p, *fn;
+ char Digest[MAXSTRING]; /* either Verify opts or MD5/SHA1 digest */
+
+- jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
+ if ((len = sscanf(fd->msg, "%ld %d %s", &file_index, &stream, Digest)) != 3) {
+ Jmsg(jcr, M_FATAL, 0, _("<filed: bad attributes, expected 3 fields got %d\n"
+ "msglen=%d msg=%s\n"), len, fd->msglen, fd->msg);
+@@ -641,7 +640,7 @@
+ }
+ }
+ /* Any cached attr is flushed so we can reuse jcr->attr and jcr->ar */
+- fn = jcr->fname;
++ fn = jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen);
+ while (*p != 0) {
+ *fn++ = *p++; /* copy filename */
+ }
--- /dev/null
+
+ This patch fixes a case problem in an SQL command, and could potentially
+ fix the DiskToCatalog problem reported in bug #1149.
+ Apply the patch to version 2.4.2 (and previous versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.2-verifydisk.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/cats/sql_get.c
+===================================================================
+--- src/cats/sql_get.c (revision 7507)
++++ src/cats/sql_get.c (working copy)
+@@ -109,7 +109,7 @@
+ Mmsg(mdb->cmd,
+ "SELECT FileId, LStat, MD5 FROM File,Job WHERE "
+ "File.JobId=Job.JobId AND File.PathId=%s AND "
+-"File.FilenameId=%s AND Job.Type='B' AND Job.JobSTATUS='T' AND "
++"File.FilenameId=%s AND Job.Type='B' AND Job.JobStatus='T' AND "
+ "ClientId=%s ORDER BY StartTime DESC LIMIT 1",
+ edit_int64(fdbr->PathId, ed1),
+ edit_int64(fdbr->FilenameId, ed2),