From: Kern Sibbald Date: Sat, 26 Jul 2014 08:20:19 +0000 (+0200) Subject: Attempt to avoid client==NULL X-Git-Tag: Release-7.0.5~15 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=95fc9b7cb42b896dc2aed8187ef5810e19d78307;p=bacula%2Fbacula Attempt to avoid client==NULL --- diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 25728b2c98..89109f2b28 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -464,7 +464,9 @@ bool do_backup(JCR *jcr) return false; } sd = jcr->store_bsock; - jcr->sd_calls_client = jcr->client->sd_calls_client; + if (jcr->client) { + jcr->sd_calls_client = jcr->client->sd_calls_client; + } /* * Note startup sequence of SD/FD is different depending on * whether the SD listens (normal) or the SD calls the FD. diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 9854699267..08c9fee330 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -437,6 +437,7 @@ static int cancel_inactive_job(UAContext *ua, JCR *jcr) JOB_DBR jr; int i; USTORE store; + CLIENT *client; if (!jcr->client) { memset(&cr, 0, sizeof(cr)); @@ -462,7 +463,15 @@ static int cancel_inactive_job(UAContext *ua, JCR *jcr) } if (acl_access_ok(ua, Client_ACL, cr.Name)) { - jcr->client = (CLIENT *)GetResWithName(R_CLIENT, cr.Name); + client = (CLIENT *)GetResWithName(R_CLIENT, cr.Name); + if (client) { + jcr->client = client; + } else { + Jmsg1(jcr, M_FATAL, 0, _("Client resource \"%s\" does not exist.\n"), cr.Name); + goto bail_out; + } + } else { + goto bail_out; } } @@ -1347,6 +1356,7 @@ void set_jcr_defaults(JCR *jcr, JOB *job) copy_rwstorage(jcr, job->pool->storage, _("Pool resource")); } jcr->client = job->client; + ASSERT2(jcr->client, "jcr->client==NULL!!!"); if (!jcr->client_name) { jcr->client_name = get_pool_memory(PM_NAME); }