From: Kern Sibbald Date: Fri, 11 May 2007 14:37:19 +0000 (+0000) Subject: kes Fix non-ssl build so that it works (add JCR *jcr to crypto structures). X-Git-Tag: Release-7.0.0~6386 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4f904dc3dfb1364b1e65982c099f49c1c0c49e45;p=bacula%2Fbacula kes Fix non-ssl build so that it works (add JCR *jcr to crypto structures). kes Fix sign extended editing of %p. kes Clean out a little old #ifdefing in cats/mysql.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4745 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index df58a9a080..645dbb4385 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -159,7 +159,8 @@ db_open_database(JCR *jcr, B_DB *mdb) #ifdef xHAVE_EMBEDDED_MYSQL // mysql_server_init(0, NULL, NULL); #endif - mysql_init(&(mdb->mysql)); + mysql_init(&mdb->mysql); + Dmsg0(50, "mysql_init done\n"); /* If connection fails, try at 5 sec intervals for 30 seconds. */ for (int retry=0; retry < 6; retry++) { @@ -200,9 +201,6 @@ db_open_database(JCR *jcr, B_DB *mdb) return 0; } -#ifdef HAVE_THREAD_SAFE_MYSQL - my_thread_init(); -#endif Dmsg3(100, "opendb ref=%d connected=%d db=%p\n", mdb->ref_count, mdb->connected, mdb->db); @@ -220,16 +218,14 @@ db_close_database(JCR *jcr, B_DB *mdb) P(mutex); sql_free_result(mdb); mdb->ref_count--; -#if defined(HAVE_THREAD_SAFE_MYSQL) - my_thread_end(); -#endif Dmsg3(100, "closedb ref=%d connected=%d db=%p\n", mdb->ref_count, mdb->connected, mdb->db); if (mdb->ref_count == 0) { qdchain(&mdb->bq); - if (mdb->connected && mdb->db) { + if (mdb->connected) { Dmsg1(100, "close db=%p\n", mdb->db); - mysql_close(&(mdb->mysql)); + mysql_close(&mdb->mysql); + #ifdef xHAVE_EMBEDDED_MYSQL // mysql_server_end(); #endif diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index bd0be764f8..5e6a233421 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -802,14 +802,14 @@ void dird_free_jcr(JCR *jcr) pthread_cond_destroy(&jcr->term_wait); jcr->term_wait_inited = false; } + if (jcr->db_batch && jcr->db_batch != jcr->db) { + db_close_database(jcr, jcr->db_batch); + } + jcr->db_batch = NULL; if (jcr->db) { db_close_database(jcr, jcr->db); jcr->db = NULL; } - if (jcr->db_batch) { - db_close_database(jcr, jcr->db_batch); - jcr->db_batch = NULL; - } if (jcr->stime) { Dmsg0(200, "Free JCR stime\n"); free_pool_memory(jcr->stime); diff --git a/bacula/src/lib/bsnprintf.c b/bacula/src/lib/bsnprintf.c index 07b94bb135..1785759a0e 100644 --- a/bacula/src/lib/bsnprintf.c +++ b/bacula/src/lib/bsnprintf.c @@ -327,8 +327,14 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args) break; case 'p': flags |= DP_F_UNSIGNED; - strvalue = va_arg(args, char *); - currlen = fmtint(buffer, currlen, maxlen, (long)strvalue, 16, min, max, flags); + if (sizeof(char *) == 4) { + value = va_arg(args, uint32_t); + } else if (sizeof(char *) == 8) { + value = va_arg(args, uint64_t); + } else { + value = (uint64_t)va_arg(args, char *); + } + currlen = fmtint(buffer, currlen, maxlen, value, 16, min, max, flags); break; case 'n': if (cflags == DP_C_INT16) { diff --git a/bacula/src/lib/crypto.c b/bacula/src/lib/crypto.c index 77aa7bcff5..3e81e068fa 100644 --- a/bacula/src/lib/crypto.c +++ b/bacula/src/lib/crypto.c @@ -1455,6 +1455,7 @@ int cleanup_crypto (void) /* Message Digest Structure */ struct Digest { crypto_digest_t type; + JCR *jcr; union { SHA1Context sha1; MD5Context md5; @@ -1463,6 +1464,7 @@ struct Digest { /* Dummy Signature Structure */ struct Signature { + JCR *jcr; }; DIGEST *crypto_digest_new(JCR *jcr, crypto_digest_t type) diff --git a/bacula/src/version.h b/bacula/src/version.h index 085613c739..12824010b9 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.8" -#define BDATE "09 May 2007" -#define LSMDATE "09May07" +#define BDATE "11 May 2007" +#define LSMDATE "11May07" #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 f007b39e2d..70e59fac5b 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,10 @@ Technical notes on version 2.1 General: +11May07 +kes Fix non-ssl build so that it works (add JCR *jcr to crypto structures). +kes Fix sign extended editing of %p. +kes Clean out a little old #ifdefing in cats/mysql.c 10May07 kes If time diff between DIR and FD is more than 600 seconds convert INFO message to WARNING.