From f40e20068e235c93e142ad16c6dff2bfdd9f464d Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 4 Aug 2007 16:46:32 +0000 Subject: [PATCH] kes Remove fnmatch() in SD that permitted wild card specifications. This fixes bug #914. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5282 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/dircmd.c | 4 ++-- bacula/src/stored/job.c | 4 ++-- bacula/src/stored/match_bsr.c | 4 ++-- bacula/src/stored/reserve.c | 6 +++--- bacula/src/version.h | 4 ++-- bacula/technotes-2.1 | 3 +++ 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index cb99f95bef..205fe140df 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -563,7 +563,7 @@ static DCR *find_device(JCR *jcr, POOL_MEM &devname, int drive) unbash_spaces(devname); foreach_res(device, R_DEVICE) { /* Find resource, and make sure we were able to open it */ - if (fnmatch(device->hdr.name, devname.c_str(), 0) == 0) { + if (strcmp(device->hdr.name, devname.c_str()) == 0) { if (!device->dev) { device->dev = init_dev(jcr, device); } @@ -581,7 +581,7 @@ static DCR *find_device(JCR *jcr, POOL_MEM &devname, int drive) if (!found) { foreach_res(changer, R_AUTOCHANGER) { /* Find resource, and make sure we were able to open it */ - if (fnmatch(devname.c_str(), changer->hdr.name, 0) == 0) { + if (strcmp(devname.c_str(), changer->hdr.name) == 0) { /* Try each device in this AutoChanger */ foreach_alist(device, changer->device) { Dmsg1(100, "Try changer device %s\n", device->hdr.name); diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 8215000b83..f3d08a1685 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -265,7 +265,7 @@ bool query_cmd(JCR *jcr) unbash_spaces(dev_name); foreach_res(device, R_DEVICE) { /* Find resource, and make sure we were able to open it */ - if (fnmatch(dev_name.c_str(), device->hdr.name, 0) == 0) { + if (strcmp(dev_name.c_str(), device->hdr.name) == 0) { if (!device->dev) { device->dev = init_dev(jcr, device); } @@ -283,7 +283,7 @@ bool query_cmd(JCR *jcr) } foreach_res(changer, R_AUTOCHANGER) { /* Find resource, and make sure we were able to open it */ - if (fnmatch(dev_name.c_str(), changer->hdr.name, 0) == 0) { + if (strcmp(dev_name.c_str(), changer->hdr.name) == 0) { if (!changer->device || changer->device->size() == 0) { continue; /* no devices */ } diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index ae54260f43..e8dbdc2fdd 100644 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -433,7 +433,7 @@ static int match_client(BSR *bsr, BSR_CLIENT *client, SESSION_LABEL *sessrec, bo if (!client) { return 1; /* no specification matches all */ } - if (fnmatch(client->ClientName, sessrec->ClientName, 0) == 0) { + if (strcmp(client->ClientName, sessrec->ClientName) == 0) { return 1; } if (client->next) { @@ -447,7 +447,7 @@ static int match_job(BSR *bsr, BSR_JOB *job, SESSION_LABEL *sessrec, bool done) if (!job) { return 1; /* no specification matches all */ } - if (fnmatch(job->Job, sessrec->Job, 0) == 0) { + if (strcmp(job->Job, sessrec->Job) == 0) { return 1; } if (job->next) { diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 9f140ab0fd..349aa29592 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -796,7 +796,7 @@ static bool is_vol_in_autochanger(RCTX &rctx, VOLRES *vol) AUTOCHANGER *changer = vol->dev->device->changer_res; /* Find resource, and make sure we were able to open it */ - if (fnmatch(rctx.device_name, changer->hdr.name, 0) == 0) { + if (strcmp(rctx.device_name, changer->hdr.name) == 0) { Dmsg2(dbglvl, "jid=%u Found changer device %s\n", (int)rctx.jcr->JobId, vol->dev->device->hdr.name); return true; @@ -988,7 +988,7 @@ int search_res_for_device(RCTX &rctx) foreach_res(changer, R_AUTOCHANGER) { Dmsg2(dbglvl, "jid=%u Try match changer res=%s\n", (int)rctx.jcr->JobId, changer->hdr.name); /* Find resource, and make sure we were able to open it */ - if (fnmatch(rctx.device_name, changer->hdr.name, 0) == 0) { + if (strcmp(rctx.device_name, changer->hdr.name) == 0) { /* Try each device in this AutoChanger */ foreach_alist(rctx.device, changer->device) { Dmsg2(dbglvl, "jid=%u Try changer device %s\n", (int)rctx.jcr->JobId, @@ -1017,7 +1017,7 @@ int search_res_for_device(RCTX &rctx) foreach_res(rctx.device, R_DEVICE) { Dmsg2(dbglvl, "jid=%u Try match res=%s\n", (int)rctx.jcr->JobId, rctx.device->hdr.name); /* Find resource, and make sure we were able to open it */ - if (fnmatch(rctx.device_name, rctx.device->hdr.name, 0) == 0) { + if (strcmp(rctx.device_name, rctx.device->hdr.name) == 0) { stat = reserve_device(rctx); if (stat != 1) { /* try another device */ continue; diff --git a/bacula/src/version.h b/bacula/src/version.h index 2674f5bf87..4715735305 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.29" -#define BDATE "31 July 2007" -#define LSMDATE "31Jul07" +#define BDATE "04 August 2007" +#define LSMDATE "04Aug07" #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 89cd8d4e14..0fae8c96de 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,9 @@ Technical notes on version 2.1 General: +04Aug07 +kes Remove fnmatch() in SD that permitted wild card specifications. + This fixes bug #914. 31Jul07 kes Fix %g in filename returned by SQL for browse tree reported by Dirk. -- 2.39.5