From: Kern Sibbald Date: Tue, 12 Sep 2006 18:54:42 +0000 (+0000) Subject: kes Make sure valid argument passed to str_to_utime() where Arno X-Git-Tag: Release-2.0.0~458 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0f44ff84d589fa84461806b87c730abc26be1d3b;p=bacula%2Fbacula kes Make sure valid argument passed to str_to_utime() where Arno had a seg fault. kes Apply Richard Mortimer's patch for bcopy, bextract, and bscan. I.e. part of two different patches. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3459 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index a3b8cab7f3..09954f15ac 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -66,6 +66,8 @@ For 1.39: .move transfer device=xxx fromslot=yyy toslot=zzz Low priority: +- Check to see if jcr->stime is lost during rescheduling of + jobs in jobq.c - Fix re-read of last block to check if job has actually written a block, and check if block was written by a different job (i.e. multiple simultaneous jobs writing). @@ -1684,4 +1686,3 @@ Block Position: 0 > to the slots keyword, you can apply the enable/disable to any or all volumes. - Restricted consoles start in the Default catalog even if it is not permitted. - diff --git a/bacula/src/lib/btime.c b/bacula/src/lib/btime.c index 7011b74a9d..0c9facb30d 100644 --- a/bacula/src/lib/btime.c +++ b/bacula/src/lib/btime.c @@ -105,6 +105,11 @@ utime_t str_to_utime(char *str) struct tm tm; time_t ttime; + /* Check for bad argument */ + if (!str || *str == 0) { + return 0; + } + if (sscanf(str, "%d-%d-%d %d:%d:%d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { return 0; diff --git a/bacula/src/stored/bcopy.c b/bacula/src/stored/bcopy.c index 9a11c37a3a..930003ebd7 100644 --- a/bacula/src/stored/bcopy.c +++ b/bacula/src/stored/bcopy.c @@ -149,6 +149,7 @@ int main (int argc, char *argv[]) parse_config(configfile); /* Setup and acquire input device for reading */ + Dmsg0(100, "About to setup input jcr\n"); in_jcr = setup_jcr("bcopy", argv[0], bsr, iVolumeName, 1); /* read device */ if (!in_jcr) { exit(1); @@ -160,6 +161,7 @@ int main (int argc, char *argv[]) } /* Setup output device for writing */ + Dmsg0(100, "About to setup output jcr\n"); out_jcr = setup_jcr("bcopy", argv[1], bsr, oVolumeName, 0); /* no acquire */ if (!out_jcr) { exit(1); @@ -168,6 +170,7 @@ int main (int argc, char *argv[]) if (!out_dev) { exit(1); } + Dmsg0(100, "About to acquire device for writing\n"); /* For we must now acquire the device for writing */ lock_device(out_dev); if (out_dev->open(out_jcr->dcr, OPEN_READ_WRITE) < 0) { @@ -274,7 +277,6 @@ static bool record_cb(DCR *in_dcr, DEV_RECORD *rec) /* Dummies to replace askdir.c */ -bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) { return 1;} bool dir_find_next_appendable_volume(DCR *dcr) { return 1;} bool dir_update_volume_info(DCR *dcr, bool relabel) { return 1; } bool dir_create_jobmedia_record(DCR *dcr) { return 1; } @@ -292,3 +294,12 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr) getchar(); return true; } + +bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) +{ + Dmsg0(100, "Fake dir_get_volume_info\n"); + bstrncpy(dcr->VolCatInfo.VolCatName, dcr->VolumeName, sizeof(dcr->VolCatInfo.VolCatName)); + dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr); + Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.VolCatParts); + return 1; +} diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index e64fe47136..9c7c0de1b7 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -458,7 +458,6 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) } /* Dummies to replace askdir.c */ -bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) { return 1;} bool dir_find_next_appendable_volume(DCR *dcr) { return 1;} bool dir_update_volume_info(DCR *dcr, bool relabel) { return 1; } bool dir_create_jobmedia_record(DCR *dcr) { return 1; } @@ -476,3 +475,12 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr) getchar(); return true; } + +bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) +{ + Dmsg0(100, "Fake dir_get_volume_info\n"); + bstrncpy(dcr->VolCatInfo.VolCatName, dcr->VolumeName, sizeof(dcr->VolCatInfo.VolCatName)); + dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr); + Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.VolCatParts); + return 1; +} diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index 7b4061554a..85e6c15899 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -1249,7 +1249,6 @@ static JCR *create_jcr(JOB_DBR *jr, DEV_RECORD *rec, uint32_t JobId) } /* Dummies to replace askdir.c */ -bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) { return 1;} bool dir_find_next_appendable_volume(DCR *dcr) { return 1;} bool dir_update_volume_info(DCR *dcr, bool relabel) { return 1; } bool dir_create_jobmedia_record(DCR *dcr) { return 1; } @@ -1269,3 +1268,12 @@ bool dir_ask_sysop_to_mount_volume(DCR *dcr) getchar(); return true; } + +bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) +{ + Dmsg0(100, "Fake dir_get_volume_info\n"); + bstrncpy(dcr->VolCatInfo.VolCatName, dcr->VolumeName, sizeof(dcr->VolCatInfo.VolCatName)); + dcr->VolCatInfo.VolCatParts = find_num_dvd_parts(dcr); + Dmsg2(500, "Vol=%s num_parts=%d\n", dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.VolCatParts); + return 1; +} diff --git a/bacula/src/version.h b/bacula/src/version.h index a5da7b5a1a..b2b8a8ebc8 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "1.39.23" -#define BDATE "10 September 2006" -#define LSMDATE "10Sep06" +#define BDATE "12 September 2006" +#define LSMDATE "12Sep06" #define BYEAR "2006" /* year for copyright messages in progs */ /* Debug flags */ diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 811d2e2bdd..2c334df639 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,11 @@ Technical notes on version 1.39 General: +12Sep06 +kes Make sure valid argument passed to str_to_utime() where Arno + had a seg fault. +kes Apply Richard Mortimer's patch for bcopy, bextract, and bscan. + I.e. part of two different patches. 11Sep06 kes Modify disk changer to simulate some of the error conditions of mtx-changer.