]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix more strncpys
authorKern Sibbald <kern@sibbald.com>
Sat, 4 Jan 2003 13:33:24 +0000 (13:33 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 4 Jan 2003 13:33:24 +0000 (13:33 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@263 91ce42f0-d328-0410-95d8-f526ca767f89

14 files changed:
bacula/ChangeLog
bacula/ReleaseNotes
bacula/kernstodo
bacula/src/cats/sql_create.c
bacula/src/cats/sql_get.c
bacula/src/cats/sqlite.c
bacula/src/dird/dird_conf.c
bacula/src/dird/job.c
bacula/src/dird/ua_output.c
bacula/src/dird/ua_status.c
bacula/src/findlib/find_one.c
bacula/src/lib/message.c
bacula/src/stored/acquire.c
bacula/src/version.h

index d908612815ed66fd53d9bfdc1d062357b094b70a..e24a7f8f445f6e72de714d20a63fb399e334a27f 100644 (file)
@@ -1,5 +1,4 @@
-2002-mm-dd Version 1.28 (not yet released)
-
+2003-01-04 Version 1.28 released
 General:
 - Implemented Bare Metal Recovery for Linux and manual procedures for Solaris
 - Now using only a single technotes file kes-1.28 and will add to
@@ -13,6 +12,8 @@ General:
   tape drivers.
 
 Changes submitted this submission:
+04Jan03
+- Add cygreadline5.dll to Win32 release -- needed for console
 03Jan03
 - Add scripts make_catalog_backup and delete_catalog_backup that makes and
   deletes an ASCII copy of the catalog for backup. An example of how
index e0be1a3e46e3c383595620f44f6d3fa2d1a17880..d1b625f6d89192b61a08515c96d0e897dad7a9a5 100644 (file)
@@ -1,6 +1,6 @@
           Release Notes for Bacula 1.28
 
-  Bacula code: Total files = 226 Total lines = 61,863 (*.h *.c *.in)
+  Bacula code: Total files = 228 Total lines = 62,042 (*.h *.c *.in)
 
 Major Changes this Release:
 - Bare Metal Recovery mostly automated for Linux systems and 
@@ -10,11 +10,12 @@ Major Changes this Release:
 - Schedule permits specification of 1st, 2nd, ... week e.g.
   1st Sun ...
 
-Minor Changes this Release:
+Other Changes this Release:
 - Allow backup of raw partitions.
 - Fixed Restore options (never,ifnewer, ...). They now work.
-- New bidirectional timed pipe mechanism for running child processes
-  permits better error messages.
+- Added a --enable-client-only    option that will cause "make" to only
+  build the File daemon and the libraries it needs.
+- Documented how to save the Catalog database (with included script).
 - Faster Storage daemon initialization (using pthreads)
 - Unlimited devices in Storage daemon (previously hard coded to 20).
 - Fixed bug that recognized only the last option specified on Include record.
@@ -28,9 +29,16 @@ Minor Changes this Release:
 - User supplied script for Sun-desktop autoloader (examples/devices).
 - Added configure options for building static versions of the 
   daemons and the console program.
-- Added a --enable-client-only    option that will cause "make" to only
-  build the File daemon and the libraries it needs.
-- Documented how to save the Catalog database (with included script).
+- New bidirectional timed pipe mechanism for running child processes
+  permits better error messages.
+- Removed last restrictions on filename length for catalog items. Previous
+  maximum was 500 chars for path and 500 chars for filename. Now unlimited.
+- Improvements all over the code to prevent string overflows and to ensure
+  that copied strings are properly terminated.
+- Improved handling of 64 bit integers especially concerning the DB.
+- Database now contains accurate tape file/block positions, and many other
+  DB items are more correctly handled.
+- Improved bootstrap record generation (more detail).
 
 Items to note:
 - Nothing in particular.
index b8c7bc9461fd37466ebad927c6f13c3689a2f45b..4adfb3f4bcceecb9abfece005cbdadad7108e63d 100644 (file)
@@ -1,12 +1,10 @@
                  Kern's ToDo List
-                 01 January 2003 
+                 04 January 2003 
 
 Documentation to do: (a little bit at a time)
 - Document running a test version.
-- Make sure restore options are documented
 - Document query file format.
 - Document static linking
-- Document nofollow flag
 
 Testing to do: (painful)
 - that console command line options work
@@ -17,14 +15,16 @@ For 1.28 release:
 - Figure out how to allow multiple simultaneous file Volumes on
   a single device.
 - Why are save/restore of device different sizes (sparse?)
-- Backup of raw partitions
+- Make sure differential handled correctly
 
 For 1.29 release:
+- Cancel does not work for restore in FD.
+- Restore to a particular time -- e.g. before date, after date. 
 - Implement SHA1
 - Implement disk spooling
 - Implement finer multiprocessing options.
 - Solaris -I on tar for include list
-- Add whereln to where or not where absolute links
+- Add whereabslinks to where or not where absolute links
 - Figure out some way to automatically backup all local partitions
 - Enable avoid backing up archive device (findlib/find_one.c:128)
 - Implement FileOptions (see end of this document)
@@ -32,7 +32,6 @@ For 1.29 release:
 - Make hash table for linked files in findlib/find_one.c:161
 - Make bcopy read through bad tape records.
 - Need a verbose mode in restore, perhaps to bsr.
-- Should we dump a SOS when starting a new tape?
 - bscan without -v is too quiet -- perhaps show jobs.
 - Add code to reject whole blocks if not wanted on restore.
 - Implement multiple simultaneous file Volumes on a single device.
@@ -61,16 +60,12 @@ For 1.29 release:
 - Restore program that errors in SD due to no tape reports
   OK incorrectly in output.
 - After unmount, if restore job started, ask to mount.
-- Fix db_get_fileset in cats/sql_get.c for multiple records.
-- Fix catalog filename truncation in sql_get and sql_create. Use
-  only a single filename split routine.
 - Make Restore report an error if FD or SD term codes are not OK.
 - Convert all %x substitution variables, which are hard to remember
   and read to %(variable-name).  Idea from TMDA.
 - Add JobLevel in FD status (but make sure it is defined).
 - Make Pool resource handle Counter resources.
 - Remove NextId for SQLite. Optimize.
-- Fix gethostbyname() to use gethostbyname_r()
 - Strip trailing / from Include
 - Move all SQL statements into a single location.
 - Cleanup db_update_media and db_update_pool
@@ -84,7 +79,6 @@ For 1.29 release:
 - Add Client FS/OS id (Linux, Win95/98, ...).
 - Test a second language e.g. french.
 - Compare tape to Client files (attributes, or attributes and data) 
-- Restore to a particular time -- e.g. before date, after date. 
 - Make all database Ids 64 bit.
 - Write an applet for Linux.
 - Add estimate to Console commands
@@ -105,14 +99,13 @@ For 1.29 release:
 - Fix Win2000 error with no messages during startup.
 - Events : tape has more than xxx bytes.
 - Restrict characters permitted in a Resource name.
-- Complete  code in Bacula Resources -- this will permit
+- Complete code in Bacula Resources -- this will permit
   reading a new config file at any time.
 - Handle ctl-c in Console
 - Implement LabelTemplate (at least first cut).
 - Implement script driven addition of File daemon to config files.
 - Think about how to make Bacula work better with File (non-tape) archives.
 
-- see setgroup and user for Bacula p4-5 of stunnel.c
 - Implement new serialize subroutines
    send(socket, "string", &Vol, "uint32", &i, NULL)
 - Audit all UA commands to ensure that we always prompt where possible.
@@ -122,7 +115,6 @@ For 1.29 release:
 - Make database type selectable by .conf files i.e. at runtime
 - gethostbyname failure in bnet_connect() continues
   generating errors -- should stop.
-- Add HOST to Volume label.
 - Set flag for uname -a.  Add to Volume label.
 - Implement throttled work queue.
 - Check for EOT at ENOSPC or EIO or ENXIO (unix Pc)
@@ -152,8 +144,6 @@ For 1.29 release:
 - Make bcopy copy with a single tape drive.
 - Permit changing ownership during restore.
 
-- Restore should get Device and Pool information from
-  job record rather than from config.
 - Autolabel should be specified by DIR instead of SD.
 - Find out how to get the system tape block limits, e.g.:
   Apr 22 21:22:10 polymatou kernel: st1: Block limits 1 - 245760 bytes.  
@@ -187,6 +177,8 @@ For 1.29 release:
 =====
 - FD sends unsaved file list to Director at end of job (see
   RFC below).
+- File daemon should build list of files skipped, and then
+  at end of save retry and report any errors.
 - Write a Storage daemon that uses pipes and
   standard Unix programs to write to the tape.
   See afbackup.
@@ -203,18 +195,13 @@ For 1.29 release:
   if tape is not valid.
 - Verify from Volume
 - Ensure that /dev/null works
-- File daemon should build list of files skipped, and then
-  at end of save retry and report any errors.
 - Need report class for messages. Perhaps
   report resource where report=group of messages
 - enhance scan_attrib and rename scan_jobtype, and
   fill in code for "since" option 
-- Need to save contents of FileSet to tape?
 - Director needs a time after which the report status is sent
   anyway -- or better yet, a retry time for the job.
   Don't reschedule a job if previous incarnation is still running.
-- Figure out how to save the catalog (possibly a special FileSet).
-- Figure out how to restore the catalog.
 - Some way to automatically backup everything is needed????
 - Need a structure for pending actions:
   - buffered messages
@@ -254,7 +241,7 @@ Projects:
            last update 27 November 2002
 
 Item 1:   Multiple simultaneous Jobs. (done)
-Done
+Done -- Restore part needs better implementation to work correctly
 
   What:   Permit multiple simultaneous jobs in Bacula.
 
@@ -707,4 +694,16 @@ Done: (see kernsdone for more)
 - Implement ./configure --with-client-only
 - Finish up static linking 
 - that restore options work in FD               
+- Backup of raw partitions
+- Document nofollow flag
+- Make sure restore options are documented
+- Should we dump a SOS when starting a new tape? (no -- too complicated)
+- Fix gethostbyname() to use gethostbyname_r() -- no added mutex
+- Add HOST to Volume label.
+- Need to save contents of FileSet to tape? -- no not now
+- Fix db_get_fileset in cats/sql_get.c for multiple records.
+- Fix catalog filename truncation in sql_get and sql_create. Use
+  only a single filename split routine.
+- Figure out how to save the catalog (possibly a special FileSet).
+- Figure out how to restore the catalog.
     
index be30de82b24e220ed7170c20aefcabb2fd712c3a..4747c20f5d5e3d1e92742cf5d5a4e52138c3fe2a 100644 (file)
@@ -306,8 +306,7 @@ int db_create_client_record(B_DB *mdb, CLIENT_DBR *cr)
         }
         cr->ClientId = atoi(row[0]);
         if (row[1]) {
-           strncpy(cr->Uname, row[1], sizeof(cr->Uname)-2);
-           cr->Uname[sizeof(cr->Uname)-1] = 0;
+           bstrncpy(cr->Uname, row[1], sizeof(cr->Uname));
         } else {
            cr->Uname[0] = 0;         /* no name */
         }
index a063cc2618cfc67c17bba4f3a039c128165ab4e5..f3f0539987be9b52735ca2269688cccfbd0cc618 100644 (file)
@@ -186,10 +186,8 @@ File.FilenameId=%u", fdbr->JobId, fdbr->PathId, fdbr->FilenameId);
             Mmsg1(&mdb->errmsg, _("Error fetching row: %s\n"), sql_strerror(mdb));
         } else {
            fdbr->FileId = (FileId_t)str_to_int64(row[0]);
-           strncpy(fdbr->LStat, row[1], sizeof(fdbr->LStat));
-           fdbr->LStat[sizeof(fdbr->LStat)] = 0;
-           strncpy(fdbr->MD5, row[2], sizeof(fdbr->MD5));
-           fdbr->MD5[sizeof(fdbr->MD5)] = 0;
+           bstrncpy(fdbr->LStat, row[1], sizeof(fdbr->LStat));
+           bstrncpy(fdbr->MD5, row[2], sizeof(fdbr->MD5));
            stat = 1;
         }
       } else {
index d26c69dea60e50973f40d43223c60048c6364fc4..2fe91481ca3a3fc3261ea2b0e183374348648212 100644 (file)
@@ -205,8 +205,7 @@ int db_next_index(B_DB *mdb, char *table, char *index)
       db_unlock(mdb);
       return 0;
    }
-   strncpy(index, row[0], 28);
-   index[28] = 0;
+   bstrncpy(index, row[0], 28);
    sql_free_result(mdb);
 
    Mmsg(&mdb->cmd,
index 2f9ca4854ec677fde9fa6387985ae56c63531c37..91f3d11475d38262a6ea43f757e8ecde2fcb893a 100644 (file)
@@ -22,7 +22,7 @@
  *     Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index a7f7b367c68382bcfea84fcc6db9716be653507f..2c1055a254e21572933290d3e64fbb583b9b7047 100644 (file)
@@ -293,7 +293,7 @@ void create_unique_job_name(JCR *jcr, char *base_name)
    localtime_r(&now, &tm);
    /* Use only characters that are permitted in Windows filenames */
    strftime(dt, sizeof(dt), "%Y-%m-%d_%H.%M.%S", &tm); 
-   strncpy(name, base_name, sizeof(name));
+   bstrncpy(name, base_name, sizeof(name));
    name[sizeof(name)-22] = 0;         /* truncate if too long */
    sprintf(jcr->Job, "%s.%s", name, dt); /* add date & time */
    /* Convert spaces into underscores */
index 975970e357b1e24b80d262a363dcabfe7dc769c5..a61feeb4dea12d2428a5474160541e7013f9af53 100644 (file)
@@ -233,8 +233,7 @@ int listcmd(UAContext *ua, char *cmd)
 
       /* List JOB */
       } else if (strcasecmp(ua->argk[i], _("job")) == 0 && ua->argv[i]) {
-        strncpy(jr.Job, ua->argv[i], MAX_NAME_LENGTH);
-        jr.Job[MAX_NAME_LENGTH-1] = 0;
+        bstrncpy(jr.Job, ua->argv[i], MAX_NAME_LENGTH);
         jr.JobId = 0;
         db_list_job_records(ua->db, &jr, prtit, ua);
 
@@ -243,8 +242,7 @@ int listcmd(UAContext *ua, char *cmd)
 
         for (j=i+1; j<ua->argc; j++) {
             if (strcasecmp(ua->argk[j], _("job")) == 0 && ua->argv[j]) {
-              strncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
-              jr.Job[MAX_NAME_LENGTH-1] = 0;
+              bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
               jr.JobId = 0;
               db_get_job_record(ua->db, &jr);
               jobid = jr.JobId;
@@ -263,8 +261,7 @@ int listcmd(UAContext *ua, char *cmd)
         int done = FALSE;
         for (j=i+1; j<ua->argc; j++) {
             if (strcasecmp(ua->argk[j], _("job")) == 0 && ua->argv[j]) {
-              strncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
-              jr.Job[MAX_NAME_LENGTH-1] = 0;
+              bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
               jr.JobId = 0;
               db_get_job_record(ua->db, &jr);
               jobid = jr.JobId;
@@ -295,8 +292,7 @@ int listcmd(UAContext *ua, char *cmd)
         int done = FALSE;
         for (j=i+1; j<ua->argc; j++) {
             if (strcasecmp(ua->argk[j], _("job")) == 0 && ua->argv[j]) {
-              strncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
-              jr.Job[MAX_NAME_LENGTH-1] = 0;
+              bstrncpy(jr.Job, ua->argv[j], MAX_NAME_LENGTH);
               jr.JobId = 0;
               db_get_job_record(ua->db, &jr);
               jobid = jr.JobId;
index 77a7be2540cd619f3b00d372691fc89c64e57f40..a01ac3806f81ec65ee886c2042c7de1edfb396df 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
index b13a9da33f25b524102ccc100f7a470dbb53e644..597d2575e9ea7fde8bcb3f92966bdc60c1a736b5 100755 (executable)
@@ -1,5 +1,5 @@
 /* 
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 Kern Sibbald and John Walker
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -218,7 +218,7 @@ find_one_file(FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt), void *pkt
        len = strlen(fname);
        namebuf_len = len + DEFAULT_NAMEBUF_LEN;
        namebuf = (char *)bmalloc(namebuf_len + 2);
-       strncpy(namebuf, fname, namebuf_len);
+       bstrncpy(namebuf, fname, namebuf_len);
        while (len >= 1 && namebuf[len - 1] == '/')
         len--;
        namebuf[len++] = '/';
index b5b4dd8ab9c73bf4fbf06560753c52369598ab2a..a0079a6acbd39779324a75f574bc9cc8a1930c6a 100755 (executable)
@@ -71,8 +71,7 @@ void my_name_is(int argc, char *argv[], char *name)
    char cpath[400], npath[400];
    int len;
 
-   strncpy(my_name, name, sizeof(my_name));
-   my_name[sizeof(my_name)-1] = 0;
+   bstrncpy(my_name, name, sizeof(my_name));
    if (argc>0 && argv && argv[0]) {
       /* strip trailing filename and save exepath */
       for (l=p=argv[0]; *p; p++) {
index 9f674d3eaf656d5155741ed9b76150e06457be79..d57b4f03b4c91a832576395c7237b73821ef07b7 100644 (file)
@@ -128,6 +128,7 @@ default_path:
    stat = 1;                         /* good return */
    if ((dev->state & ST_TAPE) && vol->start_file > 0) {
       Dmsg1(200, "====== Got start_file = %d\n", vol->start_file);
+      Jmsg(jcr, M_INFO, 0, _("Forward spacing to file %d.\n"), vol->start_file);
       fsf_dev(dev, vol->start_file);
    }
 
index ecd466b27bae3f3758d202af3932e231759bb6e1..5646b09bf7fb1ea7acbefb2569bf8d846927eaee 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.28"
 #define VSTRING "1"
-#define DATE    "2 January 2003"
-#define LSMDATE "02Jan03"
+#define DATE    "4 January 2003"
+#define LSMDATE "04Jan03"
 
 /* Debug flags */
 #define DEBUG 1