From 5e5db5c6113217be0cee9f80437c59f849ffc0b7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 22 Apr 2007 15:19:41 +0000 Subject: [PATCH] kes Make bat have 'make install' target. kes Warn during install if old gnome-console binary found. kes Warn during install if old wx-console binary found. kes Add -8 option to bsmtp command line to add content type utf-8. Fixes bug #809. (Character coding problem in bsmtp). kes If < is found in target (from, to, cc) then do not enclose the target in < > in bsmtp. Fixes bug #772 (malformed address). kes When printing certain items in dbcheck, stop after 300000. Fixes bug #822. (dbcheck loops). kes Incorrect status in Dir after waiting for mount with poll set. Fixes bug #825. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4592 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/configure.in | 2 + bacula/configure | 4 +- bacula/kernstodo | 29 +++++++-- bacula/src/qt-console/{bat.pro => bat.pro.in} | 16 ++++- bacula/src/stored/askdir.c | 4 +- bacula/src/tools/bsmtp.c | 64 +++++++++++++------ bacula/src/tools/dbcheck.c | 28 +++++--- bacula/src/version.h | 4 +- bacula/technotes-2.1 | 12 ++++ 9 files changed, 124 insertions(+), 39 deletions(-) rename bacula/src/qt-console/{bat.pro => bat.pro.in} (79%) diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index fbebd39b17..9c68e8b77d 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2044,6 +2044,8 @@ AC_OUTPUT([autoconf/Make.common \ src/console/bconsole.conf \ src/gnome2-console/Makefile \ src/gnome2-console/bgnome-console.conf \ + src/qt-console/bat.conf \ + src/qt-console/bat.pro \ src/wx-console/Makefile \ src/wx-console/bwx-console.conf \ src/tray-monitor/Makefile \ diff --git a/bacula/configure b/bacula/configure index 7c484bece7..2f05d3fdfe 100755 --- a/bacula/configure +++ b/bacula/configure @@ -33853,7 +33853,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then exit 1 fi -ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/bgnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/bgnome-console.conf src/wx-console/Makefile src/wx-console/bwx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile po/Makefile.in $PFILES" +ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/bgnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/bgnome-console.conf src/qt-console/bat.conf src/qt-console/bat.pro src/wx-console/Makefile src/wx-console/bwx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile po/Makefile.in $PFILES" ac_config_commands="$ac_config_commands default" @@ -34454,6 +34454,8 @@ do "src/console/bconsole.conf") CONFIG_FILES="$CONFIG_FILES src/console/bconsole.conf" ;; "src/gnome2-console/Makefile") CONFIG_FILES="$CONFIG_FILES src/gnome2-console/Makefile" ;; "src/gnome2-console/bgnome-console.conf") CONFIG_FILES="$CONFIG_FILES src/gnome2-console/bgnome-console.conf" ;; + "src/qt-console/bat.conf") CONFIG_FILES="$CONFIG_FILES src/qt-console/bat.conf" ;; + "src/qt-console/bat.pro") CONFIG_FILES="$CONFIG_FILES src/qt-console/bat.pro" ;; "src/wx-console/Makefile") CONFIG_FILES="$CONFIG_FILES src/wx-console/Makefile" ;; "src/wx-console/bwx-console.conf") CONFIG_FILES="$CONFIG_FILES src/wx-console/bwx-console.conf" ;; "src/tray-monitor/Makefile") CONFIG_FILES="$CONFIG_FILES src/tray-monitor/Makefile" ;; diff --git a/bacula/kernstodo b/bacula/kernstodo index c7303824c3..3a55d440ec 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -43,6 +43,27 @@ Document: Priority: +- Look at using posix_fadvise(2) for backups -- see bug #751. + Possibly add the code at findlib/bfile.c:795 + +/* TCP socket options */ +#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */ +#define TCP_MAXSEG 2 /* Limit MSS */ +#define TCP_CORK 3 /* Never send partially complete segments */ +#define TCP_KEEPIDLE 4 /* Start keeplives after this period */ +#define TCP_KEEPINTVL 5 /* Interval between keepalives */ +#define TCP_KEEPCNT 6 /* Number of keepalives before death */ +#define TCP_SYNCNT 7 /* Number of SYN retransmits */ +#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */ +#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */ +#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */ +#define TCP_INFO 11 /* Information about this connection. */ +#define TCP_QUICKACK 12 /* Block/reenable quick acks */ +#define TCP_CONGESTION 13 /* Congestion control algorithm */ + +- Fix bnet_connect() code to set a timer and to use time to + measure the time. + - the director seg faulted when I omitted the pool directive from a job resource. I was experimenting and thought it redundant that I had specified Pool, Full Backup Pool. and Differential Backup Pool. but @@ -78,14 +99,10 @@ started the director. 02-Feb 11:00 btape: Fatal Error because: Bacula interrupted by signal 11: Segmentation violation Kaboom! btape, btape got signal 11. Attempting traceback. -- Why the heck doesn't bacula drop root priviledges before connecting to - the DB? - Ensure that moving a purged Volume in ua_purge.c to the RecyclePool does the right thing. - Why doesn't @"xxx abc" work in a conf file? - Figure out some way to "automatically" backup conf changes. -- Look at using posix_fadvise(2) for backups -- see bug #751. - Possibly add the code at findlib/bfile.c:795 - Add the OS version back to the Win32 client info. - Restarted jobs have a NULL in the from field. - Modify SD status command to indicate when the SD is writing @@ -1688,3 +1705,7 @@ Block Position: 0 === Done +- Why the heck doesn't bacula drop root priviledges before connecting to + the DB? + + diff --git a/bacula/src/qt-console/bat.pro b/bacula/src/qt-console/bat.pro.in similarity index 79% rename from bacula/src/qt-console/bat.pro rename to bacula/src/qt-console/bat.pro.in index d5de17896c..6371b5d86d 100644 --- a/bacula/src/qt-console/bat.pro +++ b/bacula/src/qt-console/bat.pro.in @@ -1,8 +1,19 @@ ###################################################################### -# Version $Id$ +# Version $Id: bat.pro 4588 2007-04-22 01:50:10Z bartleyd2 $ # +# !!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# +# Edit only bat.pro.in -- bat.pro is built by the ./configure program +# +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# CONFIG += qt debug +bins.path = /$(DESTDIR)@sbindir@ +bins.files = ./bat +confs.path = /$(DESTDIR)@sysconfdir@ +confs.files = ./bat.conf + TEMPLATE = app TARGET = bat DEPENDPATH += . @@ -76,3 +87,6 @@ SOURCES += storage/storage.cpp ## Fileset HEADERS += fileset/fileset.h SOURCES += fileset/fileset.cpp + +INSTALLS += bins +INSTALLS += confs diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 1e0d8c9346..d64ab163b7 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -585,7 +585,7 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr) if (dev->poll) { Dmsg1(400, "Poll timeout in mount vol on device %s\n", dev->print_name()); Dmsg1(400, "Blocked=%s\n", dev->print_blocked()); - return true; + goto bail_out; } if (stat == W_TIMEOUT) { @@ -607,6 +607,8 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr) Dmsg1(400, "Someone woke me for device %s\n", dev->print_name()); break; } + +bail_out: set_jcr_job_status(jcr, JS_Running); dir_send_job_status(jcr); Dmsg0(400, "leave dir_ask_sysop_to_mount_volume\n"); diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index 06cd97ba27..05851b869f 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -1,21 +1,7 @@ -/* - Derived from a SMTPclient: - - SMTPclient -- simple SMTP client - - Copyright (C) 1997 Ralf S. Engelschall, All Rights Reserved. - rse@engelschall.com - www.engelschall.com - - Kern Sibbald, July 2001 - - Version $Id$ - - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2006 Free Software Foundation Europe e.V. + Copyright (C) 2001-2007 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. @@ -39,6 +25,20 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + Derived from a SMTPclient: + + SMTPclient -- simple SMTP client + + Copyright (C) 1997 Ralf S. Engelschall, All Rights Reserved. + rse@engelschall.com + www.engelschall.com + + Kern Sibbald, July 2001 + + Version $Id$ + + */ #include "bacula.h" @@ -68,6 +68,7 @@ static const char *mailhost = NULL; static char *reply_addr = NULL; static int mailport = 25; static char my_hostname[MAXSTRING]; +static bool content_utf8 = false; /* @@ -130,6 +131,7 @@ static void usage() fprintf(stderr, _("\n" "Usage: %s [-f from] [-h mailhost] [-s subject] [-c copy] [recipient ...]\n" +" -8 set charset utf-8\n" " -c set the Cc: field\n" " -dnn set debug level to nn\n" " -f set the From: field\n" @@ -172,8 +174,11 @@ int main (int argc, char *argv[]) my_name_is(argc, argv, "bsmtp"); maxlines = 0; - while ((ch = getopt(argc, argv, "c:d:f:h:r:s:l:?")) != -1) { + while ((ch = getopt(argc, argv, "8c:d:f:h:r:s:l:?")) != -1) { switch (ch) { + case '8': + content_utf8 = true; + break; case 'c': Dmsg1(20, "cc=%s\n", optarg); cc_addr = optarg; @@ -364,19 +369,33 @@ hp: #endif /* - * Send SMTP headers + * Send SMTP headers. Note, if any of the strings have a < + * in them already, we do not enclose the string in < >, otherwise + * we do. */ get_response(); /* banner */ chat("helo %s\r\n", my_hostname); - chat("mail from:<%s>\r\n", from_addr); + if (strchr(from_addr, '<') == NULL) { + chat("mail from:<%s>\r\n", from_addr); + } else { + chat("mail from:%s\r\n", from_addr); + } for (i = 0; i < argc; i++) { Dmsg1(20, "rcpt to: %s\n", argv[i]); - chat("rcpt to:<%s>\r\n", argv[i]); + if (strchr(from_addr, '<') == NULL) { + chat("rcpt to:<%s>\r\n", argv[i]); + } else { + chat("rcpt to:%s\r\n", argv[i]); + } } if (cc_addr) { - chat("rcpt to:<%s>\r\n", cc_addr); + if (strchr(from_addr, '<') == NULL) { + chat("rcpt to:<%s>\r\n", cc_addr); + } else { + chat("rcpt to:%s\r\n", cc_addr); + } } Dmsg0(20, "Data\n"); chat("data\r\n"); @@ -434,6 +453,11 @@ hp: Dmsg1(10, "Cc: %s\r\n", cc_addr); } + if (content_utf8) { + fprintf(sfp, "Content-Type: text/plain; charset=UTF-8\r\n"); + Dmsg0(10, "Content-Type: text/plain; charset=UTF-8\r\n"); + } + /* Add RFC822 date */ (void)localtime_r(&now, &tm); #if defined(HAVE_WIN32) diff --git a/bacula/src/tools/dbcheck.c b/bacula/src/tools/dbcheck.c index 4e5eee8aab..149bd5e981 100644 --- a/bacula/src/tools/dbcheck.c +++ b/bacula/src/tools/dbcheck.c @@ -1,13 +1,3 @@ -/* - * - * Program to check a Bacula database for consistency and to - * make repairs - * - * Kern E. Sibbald, August 2002 - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution @@ -35,6 +25,16 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Program to check a Bacula database for consistency and to + * make repairs + * + * Kern E. Sibbald, August 2002 + * + * Version $Id$ + * + */ #include "bacula.h" #include "cats/cats.h" @@ -732,6 +732,8 @@ static void eliminate_orphaned_jobmedia_records() if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned JobMedia records.\n"), id_list.num_ids); delete_id_list("DELETE FROM JobMedia WHERE JobMediaId=%s", &id_list); + } else { + break; /* get out if not updating db */ } if (!make_id_list(query, &id_list)) { exit(1); @@ -773,6 +775,8 @@ static void eliminate_orphaned_file_records() if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned File records.\n"), id_list.num_ids); delete_id_list("DELETE FROM File WHERE FileId=%s", &id_list); + } else { + break; /* get out if not updating db */ } if (!make_id_list(query, &id_list)) { exit(1); @@ -810,6 +814,8 @@ static void eliminate_orphaned_path_records() if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned Path records.\n"), id_list.num_ids); delete_id_list("DELETE FROM Path WHERE PathId=%s", &id_list); + } else { + break; /* get out if not updating db */ } if (!make_id_list(query, &id_list)) { exit(1); @@ -847,6 +853,8 @@ static void eliminate_orphaned_filename_records() if (fix && id_list.num_ids > 0) { printf(_("Deleting %d orphaned Filename records.\n"), id_list.num_ids); delete_id_list("DELETE FROM Filename WHERE FilenameId=%s", &id_list); + } else { + break; /* get out if not updating db */ } if (!make_id_list(query, &id_list)) { exit(1); diff --git a/bacula/src/version.h b/bacula/src/version.h index a7f8db42da..b21be432e5 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.8" -#define BDATE "21 April 2007" -#define LSMDATE "21Apr07" +#define BDATE "22 April 2007" +#define LSMDATE "22Apr07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index d49c9ecf5c..09e4beebab 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,18 @@ Technical notes on version 2.1 General: +22Apr07 +kes Make bat have 'make install' target. +kes Warn during install if old gnome-console binary found. +kes Warn during install if old wx-console binary found. +kes Add -8 option to bsmtp command line to add content type utf-8. + Fixes bug #809. (Character coding problem in bsmtp). +kes If < is found in target (from, to, cc) then do not enclose the + target in < > in bsmtp. Fixes bug #772 (malformed address). +kes When printing certain items in dbcheck, stop after 300000. + Fixes bug #822. (dbcheck loops). +kes Incorrect status in Dir after waiting for mount with poll set. + Fixes bug #825. 21Apr07 kes Extend idea of Prefer Mounted Volumes to mean a volume about to be mounted. -- 2.39.5