From 4bab62b752f322c777fb019de52112f6cb53d8cb Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 8 Apr 2006 14:27:35 +0000 Subject: [PATCH] - Tweak license to include Microsoft restrictions. - Move mysql.reconnect to after real_connect(). Thanks to Frank Sweetser for the patch. - Disallow a backslash in a File = directive (Windows junk) unless the string is quoted. - Apply Eric's patch to ua_label.c so that daemon protocol is not translated. - Add NT_ definition for strings that should not be translated. - Apply NT_() to ua_label.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2888 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/LICENSE | 18 ++++++++++++++-- bacula/kes-1.39 | 11 ++++++++++ bacula/patches/1.38.7-mysql.patch | 34 +++++++++++++++++++++++++++++++ bacula/src/baconfig.h | 2 ++ bacula/src/cats/mysql.c | 2 +- bacula/src/dird/inc_conf.c | 34 +++++++++++++++++-------------- bacula/src/dird/ua_label.c | 14 ++++++------- bacula/src/stored/btape.c | 2 +- bacula/src/version.h | 6 +++--- 9 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 bacula/patches/1.38.7-mysql.patch diff --git a/bacula/LICENSE b/bacula/LICENSE index 029ef03d39..56a74ef734 100644 --- a/bacula/LICENSE +++ b/bacula/LICENSE @@ -7,7 +7,7 @@ License: For the most part, Bacula is licensed under the GPL version 2 and any code that is Copyright Kern Sibbald and John Walker or Copyright Kern Sibbald (after November 2004) with the GPL -indication is so licensed, but with the following four additions: +indication is so licensed, but with the following five additions: Linking: Bacula may be linked with any libraries permitted under the GPL, @@ -51,7 +51,7 @@ the copyright license set forth in this Agreement. Code falling under the above conditions will be marked as follows: - Copyright (C) 2000-2005 Kern Sibbald + Copyright (C) 2000-2006 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -68,6 +68,20 @@ Code falling under the above conditions will be marked as follows: Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Windows: +Certain source code used to build the Windows version of the Bacula +File daemon is copyrighted and or trademarked by Microsoft and may +contain Microsoft intellectual property (examples: Microsoft VC++, the +source to the VSS libraries, the Microsoft C runtime libraries). As +such we cannot and do not distribute that software. The compiler is +available for purchase, and Microsoft provides a free version of the +compiler. The source code and libraries are available for download from +Microsoft public Web servers. We have documented in the src/win32 +directory how we build the Windows File daemon and many users have +succeeded in doing so themselves. Our intention is to respect as +closely as possible Open Source practices while maintaining full +respect for proprietary and copyrighted code. + ===================================== The entire GPL is reproduced in the manuals distributed with the diff --git a/bacula/kes-1.39 b/bacula/kes-1.39 index f751dd15ee..5f893ad471 100644 --- a/bacula/kes-1.39 +++ b/bacula/kes-1.39 @@ -2,6 +2,17 @@ Kern Sibbald General: +08Apr06 +- Tweak license to include Microsoft restrictions. +- Move mysql.reconnect to after real_connect(). Thanks to + Frank Sweetser for the patch. +- Disallow a backslash in a File = directive (Windows junk) + unless the string is quoted. +- Apply Eric's patch to ua_label.c so that daemon protocol + is not translated. +- Add NT_ definition for strings that should not be translated. +- Apply NT_() to ua_label.c + - Remove timed wait for VSS on Win2K3 as it is not yet implemented. - Correct bacula.in script to reference bacula-ctl-xx in the diff --git a/bacula/patches/1.38.7-mysql.patch b/bacula/patches/1.38.7-mysql.patch new file mode 100644 index 0000000000..43e18a1353 --- /dev/null +++ b/bacula/patches/1.38.7-mysql.patch @@ -0,0 +1,34 @@ + +This patch (thanks to Frank Sweetser) should fix the timeout problem +users are experiencing with MySQL versions greater than 5.0.13. +It can be applied to Bacula version 1.38.7 (and possibly 1.38.5 and 1.38.6) +with: + + cd + patch -p0 <1.38.7-mysql.patch + make + make install + +Index: src/cats/mysql.c +=================================================================== +RCS file: /cvsroot/bacula/bacula/src/cats/mysql.c,v +retrieving revision 1.37.2.2 +diff -u -r1.37.2.2 mysql.c +--- src/cats/mysql.c 4 Mar 2006 11:10:17 -0000 1.37.2.2 ++++ src/cats/mysql.c 7 Apr 2006 14:10:23 -0000 +@@ -132,7 +132,6 @@ + mysql_server_init(0, NULL, NULL); + #endif + mysql_init(&(mdb->mysql)); +- mdb->mysql.reconnect = 1; /* so connection does not timeout */ + Dmsg0(50, "mysql_init done\n"); + /* If connection fails, try at 5 sec intervals for 30 seconds. */ + for (int retry=0; retry < 6; retry++) { +@@ -153,6 +152,7 @@ + bmicrosleep(5,0); + } + ++ mdb->mysql.reconnect = 1; /* so connection does not timeout */ + Dmsg0(50, "mysql_real_connect done\n"); + Dmsg3(50, "db_user=%s db_name=%s db_password=%s\n", mdb->db_user, mdb->db_name, + mdb->db_password==NULL?"(NULL)":mdb->db_password); diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 0e1ce65627..5a11d78f6e 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -95,6 +95,8 @@ #define setlocale(p, d) #endif #endif /* ENABLE_NLS */ +/* Use the following for strings not to be translated */ +#define NT_(s) (s) /* This should go away! ****FIXME***** */ #define MAXSTRING 500 diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index 61fda9a6f5..0ff62087f8 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -132,7 +132,6 @@ db_open_database(JCR *jcr, B_DB *mdb) mysql_server_init(0, NULL, NULL); #endif mysql_init(&(mdb->mysql)); - mdb->mysql.reconnect = 1; /* so connection does not timeout */ Dmsg0(50, "mysql_init done\n"); /* If connection fails, try at 5 sec intervals for 30 seconds. */ for (int retry=0; retry < 6; retry++) { @@ -153,6 +152,7 @@ db_open_database(JCR *jcr, B_DB *mdb) bmicrosleep(5,0); } + mdb->mysql.reconnect = 1; /* so connection does not timeout */ Dmsg0(50, "mysql_real_connect done\n"); Dmsg3(50, "db_user=%s db_name=%s db_password=%s\n", mdb->db_user, mdb->db_name, mdb->db_password==NULL?"(NULL)":mdb->db_password); diff --git a/bacula/src/dird/inc_conf.c b/bacula/src/dird/inc_conf.c index 38adb0b838..a157577119 100644 --- a/bacula/src/dird/inc_conf.c +++ b/bacula/src/dird/inc_conf.c @@ -531,21 +531,25 @@ static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass) /* Pickup Filename string */ switch (token) { - case T_IDENTIFIER: - case T_UNQUOTED_STRING: - case T_QUOTED_STRING: - if (res_all.res_fs.have_MD5) { - MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len); - } - incexe = &res_incexe; - if (incexe->name_list.size() == 0) { - incexe->name_list.init(10, true); - } - incexe->name_list.append(bstrdup(lc->str)); - Dmsg1(900, "Add to name_list %s\n", lc->str); - break; - default: - scan_err1(lc, _("Expected a filename, got: %s"), lc->str); + case T_IDENTIFIER: + case T_UNQUOTED_STRING: + if (strchr(lc->str, '\\')) { + scan_err1(lc, _("Backslash found. Use forward slashes or quote the string.: %s\n"), lc->str); + /* NOT REACHED */ + } + case T_QUOTED_STRING: + if (res_all.res_fs.have_MD5) { + MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len); + } + incexe = &res_incexe; + if (incexe->name_list.size() == 0) { + incexe->name_list.init(10, true); + } + incexe->name_list.append(bstrdup(lc->str)); + Dmsg1(900, "Add to name_list %s\n", lc->str); + break; + default: + scan_err1(lc, _("Expected a filename, got: %s"), lc->str); } } scan_to_eol(lc); diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index f94121061a..285c7902fe 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -736,16 +736,16 @@ static char *get_volume_name_from_SD(UAContext *ua, int Slot, int drive) bstrncpy(dev_name, store->dev_name(), sizeof(dev_name)); bash_spaces(dev_name); /* Ask for autochanger list of volumes */ - bnet_fsend(sd, _("readlabel %s Slot=%d drive=%d\n"), dev_name, Slot, drive); + bnet_fsend(sd, NT_("readlabel %s Slot=%d drive=%d\n"), dev_name, Slot, drive); Dmsg1(100, "Sent: %s", sd->msg); /* Get Volume name in this Slot */ while (bnet_recv(sd) >= 0) { bsendmsg(ua, "%s", sd->msg); Dmsg1(100, "Got: %s", sd->msg); - if (strncmp(sd->msg, "3001 Volume=", 12) == 0) { + if (strncmp(sd->msg, NT_("3001 Volume="), 12) == 0) { VolName = (char *)malloc(sd->msglen); - if (sscanf(sd->msg, "3001 Volume=%s Slot=%d", VolName, &rtn_slot) == 2) { + if (sscanf(sd->msg, NT_("3001 Volume=%s Slot=%d"), VolName, &rtn_slot) == 2) { break; } free(VolName); @@ -778,7 +778,7 @@ static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan) bstrncpy(dev_name, store->dev_name(), sizeof(dev_name)); bash_spaces(dev_name); /* Ask for autochanger list of volumes */ - bnet_fsend(sd, _("autochanger list %s \n"), dev_name); + bnet_fsend(sd, NT_("autochanger list %s \n"), dev_name); /* Read and organize list of Volumes */ while (bnet_recv(sd) >= 0) { @@ -890,7 +890,7 @@ static int get_num_slots_from_SD(UAContext *ua) bstrncpy(dev_name, store->dev_name(), sizeof(dev_name)); bash_spaces(dev_name); /* Ask for autochanger number of slots */ - bnet_fsend(sd, _("autochanger slots %s\n"), dev_name); + bnet_fsend(sd, NT_("autochanger slots %s\n"), dev_name); while (bnet_recv(sd) >= 0) { if (sscanf(sd->msg, "slots=%d\n", &slots) == 1) { @@ -922,10 +922,10 @@ int get_num_drives_from_SD(UAContext *ua) bstrncpy(dev_name, store->dev_name(), sizeof(dev_name)); bash_spaces(dev_name); /* Ask for autochanger number of slots */ - bnet_fsend(sd, _("autochanger drives %s\n"), dev_name); + bnet_fsend(sd, NT_("autochanger drives %s\n"), dev_name); while (bnet_recv(sd) >= 0) { - if (sscanf(sd->msg, "drives=%d\n", &drives) == 1) { + if (sscanf(sd->msg, NT_("drives=%d\n"), &drives) == 1) { break; } else { bsendmsg(ua, "%s", sd->msg); diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index c8979749be..cf39e9b0ab 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -138,7 +138,7 @@ int get_cmd(const char *prompt); /********************************************************************* * - * Main Bacula Pool Creation Program + * Bacula tape testing program * */ int main(int margc, char *margv[]) diff --git a/bacula/src/version.h b/bacula/src/version.h index 30a5341135..8ba38bde0c 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "1.39.6" -#define BDATE "24 March 2006" -#define LSMDATE "24Mar06" +#define VERSION "1.39.7" +#define BDATE "08 April 2006" +#define LSMDATE "08Apr06" /* Debug flags */ #undef DEBUG -- 2.39.5