From: Kern Sibbald Date: Thu, 10 Jun 2004 09:45:41 +0000 (+0000) Subject: Fix uninitialized stack variable + seg fault in label + PoolId in InChanger clear X-Git-Tag: Release-1.34.4~13 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d6423bb74a359ff8a561adaa495936999d5f0cf7;p=bacula%2Fbacula Fix uninitialized stack variable + seg fault in label + PoolId in InChanger clear git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1406 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 79772520f6..e2ead7b6f0 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1,5 +1,18 @@ Kern's ToDo List - 08 June 2004 + 10 June 2004 + +1.34.4 Items to do: +- Implement SIGHUP in Dir +- Implement fast tree insert (doubly linked list?) +- Implement "label slots=1,2... pool=yyy barcodes" +- Do tape alerts -- see tapealert.txt +- When restore started from console, report jobid. +- Feedback while the tree is being built. +- On Win95 + The error I when I installed 1.34.2 clients: + The BACULA-FD file is + linked to missing export KERNEL32.DLL:GetFileAttributesExA. + Documentation to do: (any release a little bit at a time) - Document query file format. @@ -39,28 +52,15 @@ For 1.33 Testing/Documentation: - If you use restore replace=never, the directory attributes for non-existent directories will not be restored properly. -1.34 Cleanup +Wish list: - Add multiple-media-types.txt - look at mxt-changer.html - Document a get out of jail procedure if everything breaks if you lost/broke the Catalog. - -1.34.3 Items: -- Add regression of btape "fill" - -For version 1.35: -- Implement "label slots=1,2... pool=yyy barcodes" - Make ? do a help command (no return needed). -- Do tape alerts -- see tapealert.txt - Implement restore directory. - Add All Local Partitions = yes to new style saves. - Document streams and how to implement them. -- On Win95 - The error I when I installed 1.34.2 clients: - The BACULA-FD file is - linked to missing export KERNEL32.DLL:GetFileAttributesExA. -- When restore started from console, report jobid. -- Feedback while the tree is being built. - Possibly implement "Ensure Full Backup = yes" looks for a failed full backup and upgrades the current backup if one exists. - Check that barcode reading and update slots scan works. @@ -1034,7 +1034,7 @@ Block Position: 0 ==== -=== Done in 1.35 +=== Done in 1.34.3 - To pass Include 1 or two letter commands I Name Include name - first record B Name Base name - repeat @@ -1059,3 +1059,5 @@ Block Position: 0 F Number Number of filenames to follow ... +- Add regression of btape "fill" + diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 7ffad52f60..a5364644a0 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -334,7 +334,7 @@ db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) /* * If we have a non-zero InChanger, ensure that no other Media - * record in this Pool has InChanger set on the same Slot. + * record has InChanger set on the same Slot. * * This routine assumes the database is already locked. */ @@ -342,8 +342,8 @@ void db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) { if (mr->InChanger != 0 && mr->Slot != 0) { - Mmsg(&mdb->cmd, "UPDATE Media SET InChanger=0 WHERE PoolId=%u " - "AND Slot=%d AND MediaId!=%u", mr->PoolId, mr->Slot, mr->MediaId); + Mmsg(&mdb->cmd, "UPDATE Media SET InChanger=0 WHERE " + "Slot=%d AND MediaId!=%u", mr->Slot, mr->MediaId); Dmsg1(400, "%s\n", mdb->cmd); UPDATE_DB(jcr, mdb, mdb->cmd); } diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index 8c3cd474ff..1043855b05 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -547,6 +547,9 @@ bool is_volume_name_legal(UAContext *ua, char *name) return 1; } +/* + * NOTE! This routine opens the SD socket but leaves it open + */ static int send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr, POOL_DBR *pr, int relabel, bool media_record_exists) { @@ -583,7 +586,6 @@ static int send_label_request(UAContext *ua, MEDIA_DBR *mr, MEDIA_DBR *omr, ok = TRUE; } } - close_sd_bsock(ua); unbash_spaces(mr->VolumeName); unbash_spaces(mr->MediaType); unbash_spaces(pr->Name); @@ -754,7 +756,7 @@ static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan) } else { vl->VolName = NULL; } - Dmsg2(100, "Add slot=%d Vol=%s to list.\n", vl->Slot, NPRT(vl->VolName)); + Dmsg2(100, "Add slot=%d Vol=%s to SD list.\n", vl->Slot, NPRT(vl->VolName)); if (!vol_list) { vl->next = vol_list; vol_list = vl; diff --git a/bacula/src/findlib/bfile.c b/bacula/src/findlib/bfile.c index 292c002044..2ca9bd0337 100644 --- a/bacula/src/findlib/bfile.c +++ b/bacula/src/findlib/bfile.c @@ -101,6 +101,7 @@ extern "C" HANDLE get_osfhandle(int fd); void binit(BFILE *bfd) { + memset(bfd, 0, sizeof(BFILE)); bfd->fid = -1; bfd->mode = BF_CLOSED; bfd->use_backup_api = have_win32_api(); @@ -412,6 +413,7 @@ off_t blseek(BFILE *bfd, off_t offset, int whence) */ void binit(BFILE *bfd) { + memset(bfd, 0, sizeof(BFILE)); bfd->fid = -1; } diff --git a/bacula/src/findlib/bfile.h b/bacula/src/findlib/bfile.h index 0e25f7de5a..390df8e2b8 100644 --- a/bacula/src/findlib/bfile.h +++ b/bacula/src/findlib/bfile.h @@ -28,6 +28,12 @@ #ifndef __BFILE_H #define __BFILE_H +/* ======================================================= + * + * W I N D O W S + * + * ======================================================= + */ #if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) #include @@ -57,6 +63,13 @@ HANDLE bget_handle(BFILE *bfd); #else /* Linux/Unix systems */ +/* ======================================================= + * + * U N I X + * + * ======================================================= + */ + /* Basic low level I/O file packet */ struct BFILE { int fid; /* file id on Unix */ diff --git a/bacula/src/lib/edit.c b/bacula/src/lib/edit.c index d1ca7fefbf..b6271e6b1c 100644 --- a/bacula/src/lib/edit.c +++ b/bacula/src/lib/edit.c @@ -374,7 +374,7 @@ char *add_commas(char *val, char *buf) } #ifdef TEST_PROGRAM -void d_msg(char*, int, int, char*, ...) +void d_msg(const char*, int, int, const char*, ...) {} int main(int argc, char *argv[]) { @@ -390,7 +390,7 @@ int main(int argc, char *argv[]) continue; } edit_utime(val, outval); - printf("in=%s val=%lld outval=%s\n", str[i], val, outval); + printf("in=%s val=%" lld " outval=%s\n", str[i], val, outval); } } #endif diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index cffb98a4ad..4070731436 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -71,6 +71,7 @@ int do_append_data(JCR *jcr) } dev = dcr->dev; block = dcr->block; + memset(&rec, 0, sizeof(rec)); Dmsg1(20, "Begin append device=%s\n", dev_name(dev)); diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index 5096907bca..6ac0380bc2 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -352,13 +352,20 @@ static int record_cb(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec) if (rec->Stream == STREAM_UNIX_ATTRIBUTES || rec->Stream == STREAM_UNIX_ATTRIBUTES_EX) { + if (verbose > 1) { + char *rtype = "Attributes"; + Pmsg5(-1, "%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n", + rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len); + } if (!unpack_attributes_record(jcr, rec->Stream, rec->data, attr)) { - Emsg0(M_ERROR_TERM, 0, _("Cannot continue.\n")); + if (!forge_on) { + Emsg0(M_ERROR_TERM, 0, _("Cannot continue.\n")); + } } if (attr->file_index != rec->FileIndex) { - Emsg2(M_ERROR_TERM, 0, _("Record header file index %ld not equal record index %ld\n"), - rec->FileIndex, attr->file_index); + Emsg2(forge_on?M_WARNING:M_ERROR_TERM, 0, _("Record header file index %ld not equal record index %ld\n"), + rec->FileIndex, attr->file_index); } attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI); @@ -401,6 +408,10 @@ static void get_session_record(DEVICE *dev, DEV_RECORD *rec, SESSION_LABEL *sess } Dmsg5(10, "%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n", rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len); + if (verbose) { + Pmsg5(-1, "%s Record: VolSessionId=%d VolSessionTime=%d JobId=%d DataLen=%d\n", + rtype, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len); + } } diff --git a/bacula/src/version.h b/bacula/src/version.h index cc881883c5..a27bd1a7f9 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,6 +1,6 @@ /* */ #undef VERSION -#define VERSION "1.34.3" +#define VERSION "1.34.4" #define VSTRING "1" #define BDATE "09 June 2004" #define LSMDATE "09Jun04"