From: Kern Sibbald Date: Sat, 26 Jan 2008 09:22:55 +0000 (+0000) Subject: Updates X-Git-Tag: Release-7.0.0~5106 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a358e831cd2ef459f5ffc5ac16c4fb5f4bfb4fa9;p=bacula%2Fbacula Updates git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6324 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/projects b/bacula/projects index ae4f8ed4af..08d472f6c7 100644 --- a/bacula/projects +++ b/bacula/projects @@ -1,9 +1,7 @@ Projects: Bacula Projects Roadmap - Status updated 18 August 2007 - After removing items completed in version - 2.2.0 and renumbering + Status updated 24 January 2008 Items Completed: diff --git a/bacula/src/filed/Makefile.in b/bacula/src/filed/Makefile.in index 89389671af..8009ff619d 100644 --- a/bacula/src/filed/Makefile.in +++ b/bacula/src/filed/Makefile.in @@ -29,9 +29,11 @@ dummy: # SVRSRCS = filed.c authenticate.c acl.c backup.c estimate.c \ + fd-plugins.c \ filed_conf.c heartbeat.c job.c pythonfd.c \ restore.c status.c verify.c verify_vol.c SVROBJS = filed.o authenticate.o acl.o backup.o estimate.o \ + fd-plugins.o \ filed_conf.o heartbeat.o job.o pythonfd.o \ restore.o status.o verify.o verify_vol.o diff --git a/bacula/src/filed/fd-plugins.c b/bacula/src/filed/fd-plugins.c index 5ab78a6109..bf657f9fa8 100644 --- a/bacula/src/filed/fd-plugins.c +++ b/bacula/src/filed/fd-plugins.c @@ -26,14 +26,17 @@ Switzerland, email:ftf@fsfeurope.org. */ /* - * Bacula File daemon core code for loading and running plugins. + * Main program to test loading and running Bacula plugins. + * Destined to become Bacula pluginloader, ... * * Kern Sibbald, October 2007 */ #include "bacula.h" +#include "jcr.h" #include "lib/plugin.h" #include "fd-plugins.h" +const int dbglvl = 0; const char *plugin_type = "-fd.so"; @@ -46,6 +49,12 @@ static bpError baculaJobMsg(bpContext *ctx, const char *file, int line, static bpError baculaDebugMsg(bpContext *ctx, const char *file, int line, int level, const char *msg); +void load_fd_plugins(const char *plugin_dir); +void new_plugins(JCR *jcr); +void free_plugins(JCR *jcr); +void plugin_event(JCR *jcr, bEventType event); + + /* Bacula info */ static bInfo binfo = { sizeof(bFuncs), @@ -64,14 +73,27 @@ static bFuncs bfuncs = { }; -void init_fd_plugins(const char *plugin_dir) + +void plugin_event(JCR *jcr, bEventType eventType) { + bEvent event; Plugin *plugin; + int i = 0; + + bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx; + Dmsg2(dbglvl, "plugin_ctx=%p JobId=%d\n", jcr->plugin_ctx, jcr->JobId); + event.eventType = eventType; + foreach_alist(plugin, plugin_list) { + plug_func(plugin)->handlePluginEvent(&plugin_ctx[i++], &event); + } +} +void load_fd_plugins(const char *plugin_dir) +{ if (!plugin_dir) { return; } - + plugin_list = New(alist(10, not_owned_by_alist)); load_plugins((void *)&binfo, (void *)&bfuncs, plugin_dir, plugin_type); @@ -80,9 +102,8 @@ void init_fd_plugins(const char *plugin_dir) /* * Create a new instance of each plugin for this Job */ -void new_fd_plugins(JCR *jcr) +void new_plugins(JCR *jcr) { - bpContext *ctx; Plugin *plugin; int i = 0; @@ -92,49 +113,48 @@ void new_fd_plugins(JCR *jcr) return; } - jcr->plugin_ctx = (bpContext **)malloc(sizeof(bpContext) * num); + jcr->plugin_ctx = (void *)malloc(sizeof(bpContext) * num); - ctx = jcr->plugin_ctx; + bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx; + Dmsg2(dbglvl, "plugin_ctx=%p JobId=%d\n", jcr->plugin_ctx, jcr->JobId); foreach_alist(plugin, plugin_list) { /* Start a new instance of each plugin */ - ctx[i].bContext = (void *)jcr; - ctx[i].pContext = NULL; - plug_func(plugin)->newPlugin(ctx[i++]); + plugin_ctx[i].bContext = (void *)jcr; + plugin_ctx[i].pContext = NULL; + plug_func(plugin)->newPlugin(&plugin_ctx[i++]); } } /* * Free the plugin instances for this Job */ -void free_fd_plugins(JCR *jcr) +void free_plugins(JCR *jcr) { - bpContext *ctx; Plugin *plugin; int i = 0; - ctx = jcr->plugin_ctx; - foreach_alist(plugin, jcr->plugin_list) { + bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx; + foreach_alist(plugin, plugin_list) { /* Free the plugin instance */ - plug_func(plugin)->freePlugin(ctx[i++]); + plug_func(plugin)->freePlugin(&plugin_ctx[i++]); } - free(ctx); + free(plugin_ctx); jcr->plugin_ctx = NULL; } -void term_fd_plugins() -{ - unload_plugins(); -} static bpError baculaGetValue(bpContext *ctx, bVariable var, void *value) { - printf("bacula: baculaGetValue var=%d\n", var); + JCR *jcr = (JCR *)(ctx->bContext); + Dmsg1(dbglvl, "bacula: baculaGetValue var=%d\n", var); if (!value) { return 1; } + Dmsg1(dbglvl, "Bacula: jcr=%p\n", jcr); switch (var) { case bVarJobId: - *((int *)value) = 100; + *((int *)value) = jcr->JobId; + Dmsg1(dbglvl, "Bacula: return bVarJobId=%d\n", jcr->JobId); break; case bVarFDName: *((char **)value) = "FD Name"; @@ -152,7 +172,7 @@ static bpError baculaGetValue(bpContext *ctx, bVariable var, void *value) static bpError baculaSetValue(bpContext *ctx, bVariable var, void *value) { - printf("bacula: baculaSetValue var=%d\n", var); + Dmsg1(dbglvl, "bacula: baculaSetValue var=%d\n", var); return 0; } @@ -163,7 +183,7 @@ static bpError baculaRegisterEvents(bpContext *ctx, ...) va_start(args, ctx); while ((event = va_arg(args, uint32_t))) { - printf("Plugin wants event=%u\n", event); + Dmsg1(dbglvl, "Plugin wants event=%u\n", event); } va_end(args); return 0; @@ -172,7 +192,7 @@ static bpError baculaRegisterEvents(bpContext *ctx, ...) static bpError baculaJobMsg(bpContext *ctx, const char *file, int line, int type, time_t mtime, const char *msg) { - printf("Job message: %s:%d type=%d time=%ld msg=%s\n", + Dmsg5(dbglvl, "Job message: %s:%d type=%d time=%ld msg=%s\n", file, line, type, mtime, msg); return 0; } @@ -180,7 +200,42 @@ static bpError baculaJobMsg(bpContext *ctx, const char *file, int line, static bpError baculaDebugMsg(bpContext *ctx, const char *file, int line, int level, const char *msg) { - printf("Debug message: %s:%d level=%d msg=%s\n", + Dmsg4(dbglvl, "Debug message: %s:%d level=%d msg=%s\n", file, line, level, msg); return 0; } + +#ifdef TEST_PROGRAM + +int main(int argc, char *argv[]) +{ + char plugin_dir[1000]; + JCR mjcr1, mjcr2; + JCR *jcr1 = &mjcr1; + JCR *jcr2 = &mjcr2; + + getcwd(plugin_dir, sizeof(plugin_dir)-1); + load_fd_plugins(plugin_dir); + + jcr1->JobId = 111; + new_plugins(jcr1); + + jcr2->JobId = 222; + new_plugins(jcr2); + + plugin_event(jcr1, bEventJobStart); + plugin_event(jcr1, bEventJobEnd); + plugin_event(jcr2, bEventJobStart); + free_plugins(jcr1); + plugin_event(jcr2, bEventJobEnd); + free_plugins(jcr2); + + unload_plugins(); + + Dmsg0(dbglvl, "bacula: OK ...\n"); + close_memory_pool(); + sm_dump(false); + return 0; +} + +#endif /* TEST_PROGRAM */ diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index ae237a62db..4e697c1b7b 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -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. @@ -269,13 +269,13 @@ void *handle_client_request(void *dirp) /* Run the after job */ run_scripts(jcr, jcr->RunScripts, "ClientAfterJob"); - if (jcr->JobId) { /* send EndJob if running a job */ + if (jcr->JobId) { /* send EndJob if running a job */ char ed1[50], ed2[50]; /* Send termination status back to Dir */ bnet_fsend(dir, EndJob, jcr->JobStatus, jcr->JobFiles, - edit_uint64(jcr->ReadBytes, ed1), - edit_uint64(jcr->JobBytes, ed2), jcr->Errors, jcr->VSS, - jcr->pki_encrypt); + edit_uint64(jcr->ReadBytes, ed1), + edit_uint64(jcr->JobBytes, ed2), jcr->Errors, jcr->VSS, + jcr->pki_encrypt); Dmsg1(110, "End FD msg: %s\n", dir->msg); } @@ -380,7 +380,7 @@ static int cancel_cmd(JCR *jcr) if (sscanf(dir->msg, "cancel Job=%127s", Job) == 1) { if (!(cjcr=get_jcr_by_full_name(Job))) { - bnet_fsend(dir, _("2901 Job %s not found.\n"), Job); + dir->fsend(_("2901 Job %s not found.\n"), Job); } else { if (cjcr->store_bsock) { cjcr->store_bsock->set_timed_out(); @@ -389,12 +389,12 @@ static int cancel_cmd(JCR *jcr) } set_jcr_job_status(cjcr, JS_Canceled); free_jcr(cjcr); - bnet_fsend(dir, _("2001 Job %s marked to be canceled.\n"), Job); + dir->fsend(_("2001 Job %s marked to be canceled.\n"), Job); } } else { - bnet_fsend(dir, _("2902 Error scanning cancel command.\n")); + dir->fsend(_("2902 Error scanning cancel command.\n")); } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return 1; } @@ -411,7 +411,7 @@ static int setdebug_cmd(JCR *jcr) Dmsg1(110, "setdebug_cmd: %s", dir->msg); if (sscanf(dir->msg, "setdebug=%d trace=%d", &level, &trace_flag) != 2 || level < 0) { pm_strcpy(jcr->errmsg, dir->msg); - bnet_fsend(dir, _("2991 Bad setdebug command: %s\n"), jcr->errmsg); + dir->fsend(_("2991 Bad setdebug command: %s\n"), jcr->errmsg); return 0; } debug_level = level; @@ -434,7 +434,7 @@ static int estimate_cmd(JCR *jcr) make_estimate(jcr); dir->fsend(OKest, jcr->num_files_examined, edit_uint64_with_commas(jcr->JobBytes, ed2)); - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return 1; } @@ -452,7 +452,7 @@ static int job_cmd(JCR *jcr) sd_auth_key) != 5) { pm_strcpy(jcr->errmsg, dir->msg); Jmsg(jcr, M_FATAL, 0, _("Bad Job Command: %s"), jcr->errmsg); - bnet_fsend(dir, BADjob); + dir->fsend(BADjob); free_pool_memory(sd_auth_key); return 0; } @@ -488,10 +488,10 @@ static int runbefore_cmd(JCR *jcr) free_memory(cmd); if (ok) { - bnet_fsend(dir, OKRunBefore); + dir->fsend(OKRunBefore); return 1; } else { - bnet_fsend(dir, _("2905 Bad RunBeforeJob command.\n")); + dir->fsend(_("2905 Bad RunBeforeJob command.\n")); return 0; } } @@ -502,11 +502,11 @@ static int runbeforenow_cmd(JCR *jcr) run_scripts(jcr, jcr->RunScripts, "ClientBeforeJob"); if (job_canceled(jcr)) { - bnet_fsend(dir, _("2905 Bad RunBeforeNow command.\n")); + dir->fsend(_("2905 Bad RunBeforeNow command.\n")); Dmsg0(100, "Back from run_scripts ClientBeforeJob now: FAILED\n"); return 0; } else { - bnet_fsend(dir, OKRunBeforeNow); + dir->fsend(OKRunBeforeNow); Dmsg0(100, "Back from run_scripts ClientBeforeJob now: OK\n"); return 1; } @@ -522,7 +522,7 @@ static int runafter_cmd(JCR *jcr) if (sscanf(dir->msg, runafter, msg) != 1) { pm_strcpy(jcr->errmsg, dir->msg); Jmsg1(jcr, M_FATAL, 0, _("Bad RunAfter command: %s\n"), jcr->errmsg); - bnet_fsend(dir, _("2905 Bad RunAfterJob command.\n")); + dir->fsend(_("2905 Bad RunAfterJob command.\n")); free_memory(msg); return 0; } @@ -537,7 +537,7 @@ static int runafter_cmd(JCR *jcr) jcr->RunScripts->append(cmd); free_pool_memory(msg); - return bnet_fsend(dir, OKRunAfter); + return dir->fsend(OKRunAfter); } static int runscript_cmd(JCR *jcr) @@ -557,7 +557,7 @@ static int runscript_cmd(JCR *jcr) msg) != 5) { pm_strcpy(jcr->errmsg, dir->msg); Jmsg1(jcr, M_FATAL, 0, _("Bad RunScript command: %s\n"), jcr->errmsg); - bnet_fsend(dir, _("2905 Bad RunScript command.\n")); + dir->fsend(_("2905 Bad RunScript command.\n")); free_runscript(cmd); free_memory(msg); return 0; @@ -572,7 +572,7 @@ static int runscript_cmd(JCR *jcr) jcr->RunScripts->append(cmd); free_pool_memory(msg); - return bnet_fsend(dir, OKRunScript); + return dir->fsend(OKRunScript); } @@ -838,7 +838,7 @@ static bool term_fileset(JCR *jcr) { FF_PKT *ff = jcr->ff; -#ifdef xxx +#ifdef xxx_DEBUG_CODE findFILESET *fileset = ff->fileset; int i, j, k; @@ -946,8 +946,9 @@ static void set_options(findFOPTS *fo, const char *opts) const char *p; char strip[100]; +// Commented out as it is not backward compatible - KES #ifdef HAVE_WIN32 - fo->flags |= FO_IGNORECASE; /* always ignorecase under windows */ +// fo->flags |= FO_IGNORECASE; /* always ignorecase under windows */ #endif for (p=opts; *p; p++) { @@ -1089,7 +1090,7 @@ static int fileset_cmd(JCR *jcr) if (!init_fileset(jcr)) { return 0; } - while (bnet_recv(dir) >= 0) { + while (dir->recv() >= 0) { strip_trailing_junk(dir->msg); Dmsg1(500, "Fileset: %s\n", dir->msg); add_fileset(jcr, dir->msg); @@ -1140,14 +1141,14 @@ static int bootstrap_cmd(JCR *jcr) * Suck up what he is sending to us so that he will then * read our error message. */ - while (bnet_recv(dir) >= 0) + while (dir->recv() >= 0) { } free_bootstrap(jcr); set_jcr_job_status(jcr, JS_ErrorTerminated); return 0; } - while (bnet_recv(dir) >= 0) { + while (dir->recv() >= 0) { Dmsg1(200, "filedmsg); fputs(dir->msg, bs); } @@ -1156,7 +1157,7 @@ static int bootstrap_cmd(JCR *jcr) * Note, do not free the bootstrap yet -- it needs to be * sent to the SD */ - return bnet_fsend(dir, OKbootstrap); + return dir->fsend(OKbootstrap); } @@ -1213,8 +1214,8 @@ static int level_cmd(JCR *jcr) */ for (int i=0; i<10; i++) { bt_start = get_current_btime(); - bnet_sig(dir, BNET_BTIME); /* poll for time */ - if (bnet_recv(dir) <= 0) { /* get response */ + dir->signal(BNET_BTIME); /* poll for time */ + if (dir->recv() <= 0) { /* get response */ goto bail_out; } if (sscanf(dir->msg, "btime %s", buf) != 1) { @@ -1245,7 +1246,7 @@ static int level_cmd(JCR *jcr) } Jmsg(jcr, type, 0, _("DIR and FD clocks differ by %d seconds, FD automatically compensating.\n"), adj); } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); Dmsg2(100, "adj = %d since_time=%d\n", (int)adj, (int)since_time); jcr->incremental = 1; /* set incremental or decremental backup */ @@ -1259,7 +1260,7 @@ static int level_cmd(JCR *jcr) if (buf) { free_memory(buf); } - return bnet_fsend(dir, OKlevel); + return dir->fsend(OKlevel); bail_out: pm_strcpy(jcr->errmsg, dir->msg); @@ -1366,13 +1367,13 @@ static int backup_cmd(JCR *jcr) goto cleanup; } - bnet_fsend(dir, OKbackup); + dir->fsend(OKbackup); Dmsg1(110, "bfiled>dird: %s", dir->msg); /* * Send Append Open Session to Storage daemon */ - bnet_fsend(sd, append_open); + sd->fsend(append_open); Dmsg1(110, ">stored: %s", sd->msg); /* * Expect to receive back the Ticket number @@ -1392,7 +1393,7 @@ static int backup_cmd(JCR *jcr) /* * Send Append data command to Storage daemon */ - bnet_fsend(sd, append_data, jcr->Ticket); + sd->fsend(append_data, jcr->Ticket); Dmsg1(110, ">stored: %s", sd->msg); /* @@ -1469,7 +1470,7 @@ static int backup_cmd(JCR *jcr) /* * Send Append End Data to Storage daemon */ - bnet_fsend(sd, append_end, jcr->Ticket); + sd->fsend(append_end, jcr->Ticket); /* Get end OK */ if (!response(jcr, sd, OK_end, "Append End")) { set_jcr_job_status(jcr, JS_ErrorTerminated); @@ -1479,7 +1480,7 @@ static int backup_cmd(JCR *jcr) /* * Send Append Close to Storage daemon */ - bnet_fsend(sd, append_close, jcr->Ticket); + sd->fsend(append_close, jcr->Ticket); while (bget_msg(sd) >= 0) { /* stop on signal or error */ if (sscanf(sd->msg, OK_close, &SDJobStatus) == 1) { ok = 1; @@ -1531,7 +1532,7 @@ static int verify_cmd(JCR *jcr) jcr->JobType = JT_VERIFY; if (sscanf(dir->msg, verifycmd, level) != 1) { - bnet_fsend(dir, _("2994 Bad verify command: %s\n"), dir->msg); + dir->fsend(_("2994 Bad verify command: %s\n"), dir->msg); return 0; } @@ -1546,11 +1547,11 @@ static int verify_cmd(JCR *jcr) } else if (strcasecmp(level, "disk_to_catalog") == 0) { jcr->JobLevel = L_VERIFY_DISK_TO_CATALOG; } else { - bnet_fsend(dir, _("2994 Bad verify level: %s\n"), dir->msg); + dir->fsend(_("2994 Bad verify level: %s\n"), dir->msg); return 0; } - bnet_fsend(dir, OKverify); + dir->fsend(OKverify); generate_daemon_event(jcr, "JobStart"); @@ -1571,25 +1572,25 @@ static int verify_cmd(JCR *jcr) /* * Send Close session command to Storage daemon */ - bnet_fsend(sd, read_close, jcr->Ticket); + sd->fsend(read_close, jcr->Ticket); Dmsg1(130, "bfiled>stored: %s", sd->msg); /* ****FIXME**** check response */ bget_msg(sd); /* get OK */ /* Inform Storage daemon that we are done */ - bnet_sig(sd, BNET_TERMINATE); + sd->signal(BNET_TERMINATE); break; case L_VERIFY_DISK_TO_CATALOG: do_verify(jcr); break; default: - bnet_fsend(dir, _("2994 Bad verify level: %s\n"), dir->msg); + dir->fsend(_("2994 Bad verify level: %s\n"), dir->msg); return 0; } - bnet_sig(dir, BNET_EOD); + dir->signal(BNET_EOD); return 0; /* return and terminate command loop */ } diff --git a/bacula/src/lib/address_conf.c b/bacula/src/lib/address_conf.c index 973ffe0a21..5932e89bd3 100644 --- a/bacula/src/lib/address_conf.c +++ b/bacula/src/lib/address_conf.c @@ -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. @@ -59,7 +59,7 @@ IPADDR::IPADDR(const IPADDR &src) : type(src.type) IPADDR::IPADDR(int af) : type(R_EMPTY) { #ifdef HAVE_IPV6 - if (!(af == AF_INET6 || af == AF_INET)) { + if (!(af == AF_INET6 || af == AF_INET)) { Emsg1(M_ERROR_TERM, 0, _("Only ipv4 and ipv6 are supported (%d)\n"), af); } #else diff --git a/bacula/src/lib/bsock.c b/bacula/src/lib/bsock.c index c019f2ed91..992d099113 100644 --- a/bacula/src/lib/bsock.c +++ b/bacula/src/lib/bsock.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 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. diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c index 2f2891a5b0..f83a3b9d87 100644 --- a/bacula/src/lib/bsys.c +++ b/bacula/src/lib/bsys.c @@ -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. diff --git a/bacula/src/lib/dlist.h b/bacula/src/lib/dlist.h index 9fceb99cd5..f5c0758dbf 100644 --- a/bacula/src/lib/dlist.h +++ b/bacula/src/lib/dlist.h @@ -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. diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index f5ef83bf97..0c79056a04 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2007 Free Software Foundation Europe e.V. + Copyright (C) 2001-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. @@ -298,8 +298,7 @@ int main (int argc, char *argv[]) if (update_db) { printf("Records added or updated in the catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n", num_media, num_pools, num_jobs, num_files); - } - else { + } else { printf("Records would have been added or updated in the catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n", num_media, num_pools, num_jobs, num_files); } @@ -973,7 +972,16 @@ static int create_pool_record(B_DB *db, POOL_DBR *pr) */ static int create_client_record(B_DB *db, CLIENT_DBR *cr) { + /* + * Note, update_db can temporarily be set false while + * updating the database, so we must ensure that ClientId is non-zero. + */ if (!update_db) { + cr->ClientId = 0; + if (!db_get_client_record(bjcr, db, cr)) { + Pmsg1(0, _("Could not get Client record. ERR=%s\n"), db_strerror(db)); + return 0; + } return 1; } if (!db_create_client_record(bjcr, db, cr)) { diff --git a/bacula/src/version.h b/bacula/src/version.h index db3137b2ea..9883f98195 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.8" -#define BDATE "10 January 2008" -#define LSMDATE "10Jan08" +#define BDATE "25 January 2008" +#define LSMDATE "25Jan08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 0b775c2e18..76b8887de4 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,10 @@ Technical notes on version 2.3 General: +25Jan08 +kes Apply patch from Martin to correct bug #1040, bscan sets existing + ClientId to zero. +kes Fixed important spelling error in doc -- bug #1045. 23Jan08 ebl Fix bextract to be able to extract non-portable Win32 data to Unix/Linux clients