]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix segfault from double free or RestoreBootstrap; add L_NONE for restore and admin...
authorKern Sibbald <kern@sibbald.com>
Tue, 11 Nov 2003 21:55:36 +0000 (21:55 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 11 Nov 2003 21:55:36 +0000 (21:55 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@805 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/scripts/btraceback.in
bacula/src/console/Makefile.in
bacula/src/dird/dird_conf.c
bacula/src/dird/job.c
bacula/src/dird/restore.c
bacula/src/dird/ua_status.c
bacula/src/jcr.h
bacula/src/lib/jcr.c
bacula/src/lib/util.c

index 6459cf9e2df3c2c4f9af78c43625abb30b2dad4b..61ac53862377cd47e2adb0ac57b7ef9183c53fc7 100644 (file)
@@ -47,6 +47,15 @@ For 1.33 Testing/Documentation:
                 
 
 For 1.33
+- Implement Console mtx commands.
+- Look at 2Gb limit for SQLite.
+- Implement 3 Pools for a Job:
+   Job {
+     Name = ...
+     Full Backup Pool = xxx
+     Incremental Backup Pool = yyy
+     Differential Backup Pool = zzz
+   }
 - Add a default DB password to MySQL.  
   GRANT all privileges ON bacula.* TO bacula@localhost IDENTIFIED BY 
      'bacula_password';
index bc9d87c67b427d5b7316a2b13816e65dd1c1d68f..79df59979d183bc2fa3ab48889e30558f0f2d63c 100755 (executable)
@@ -9,7 +9,7 @@
 #  $2 = main pid of running program to be traced back.
 #
 gdb -quiet -batch -x @sbindir@/btraceback.gdb $1 $2 2>&1 \
- | @sbindir@/smtp -h @smtp_host@ -s "Bacula traceback" @dump_email@
+ | @sbindir@/bsmtp -h @smtp_host@ -s "Bacula traceback" @dump_email@
 
 # Below is some old code that did the traceback from a core
 #  dump. However, for some odd reason, core dumps are not
index 83958a8410e941b31090d14a5b095811950696d8..93661945dcf4860922970cf5cdf3629e0f9e2b75 100644 (file)
@@ -38,7 +38,7 @@ CONS_LDFLAGS=@CONS_LDFLAGS@
 .c.o:
        $(CXX) $(DEFS) $(DEBUG) -c $(CPPFLAGS) $(CONS_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
 #-------------------------------------------------------------------------
-all: Makefile console @STATIC_CONS@
+all: Makefile bconsole @STATIC_CONS@
        @echo "==== Make of console is good ===="
        @echo " "
 
@@ -58,19 +58,19 @@ Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
          && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
 clean:
-       @$(RMF) console core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
-       @$(RMF) static-console gmon.out
+       @$(RMF) console bconsole core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
+       @$(RMF) static-console static-bconsole gmon.out
 
 realclean: clean
-       @$(RMF) tags console.conf
+       @$(RMF) tags console.conf bconsole.conf
 
 distclean: realclean
        if test $(srcdir) = .; then $(MAKE) realclean; fi
        (cd $(srcdir); $(RMF) Makefile; $(RMF) -r CVS)
 
 install: all
-       $(INSTALL_SCRIPT) console $(DESTDIR)$(sbindir)/console
-       @srcconf=console.conf; \
+       $(INSTALL_SCRIPT) bconsole $(DESTDIR)$(sbindir)/bconsole
+       @srcconf=bconsole.conf; \
        if  test -f ${DESTDIR}${sysconfdir}/$$srcconf; then \
           destconf=$$srcconf.new; \
           echo "  ==> Found existing $$srcconf, installing new conf file as $$destconf"; \
@@ -81,8 +81,8 @@ install: all
        ${INSTALL_CONFIG} $$srcconf ${DESTDIR}${sysconfdir}/$$destconf
 
 uninstall:
-       (cd $(DESTDIR)$(sbindir); $(RMF) console)
-       (cd $(DESTDIR)$(sysconfdir); $(RMF) console.conf console.conf.new)
+       (cd $(DESTDIR)$(sbindir); $(RMF) bconsole)
+       (cd $(DESTDIR)$(sysconfdir); $(RMF) bconsole.conf bconsole.conf.new)
 
 
 
index e29e192fa6c6d549dff0c68ddbaaed225319ab54..d98f8b9cd73ece335933337aecb191f29e0bc1e9 100644 (file)
@@ -349,6 +349,8 @@ struct s_jl joblevels[] = {
    {"VolumeToCatalog", L_VERIFY_VOLUME_TO_CATALOG,   JT_VERIFY},
    {"DiskToCatalog", L_VERIFY_DISK_TO_CATALOG,   JT_VERIFY},
    {"Data",          L_VERIFY_DATA,     JT_VERIFY},
+   {" ",             L_NONE,            JT_ADMIN},
+   {" ",             L_NONE,            JT_RESTORE},
    {NULL,           0}
 };
 
index db7064e71619935cb33075ed8c6ab4670bd16b66..e84a6422ccb1ee96e5cdbe9c52ed962f7ac3f6a4 100644 (file)
@@ -407,7 +407,15 @@ void set_jcr_defaults(JCR *jcr, JOB *job)
 {
    jcr->job = job;
    jcr->JobType = job->JobType;
-   jcr->JobLevel = job->level;
+   switch (jcr->JobType) {
+   case JT_ADMIN:
+   case JT_RESTORE:
+      jcr->JobLevel = L_NONE;
+      break;
+   default:
+      jcr->JobLevel = job->level;
+      break;
+   }
    jcr->JobPriority = job->Priority;
    jcr->store = job->storage;
    jcr->client = job->client;
@@ -421,6 +429,7 @@ void set_jcr_defaults(JCR *jcr, JOB *job)
    jcr->messages = job->messages; 
    if (jcr->RestoreBootstrap) {
       free(jcr->RestoreBootstrap);
+      jcr->RestoreBootstrap = NULL;
    }
    /* This can be overridden by Console program */
    if (job->RestoreBootstrap) {
@@ -437,7 +446,7 @@ void set_jcr_defaults(JCR *jcr, JOB *job)
         break;
       case JT_RESTORE:
       case JT_ADMIN:
-        jcr->JobLevel = L_FULL;
+        jcr->JobLevel = L_NONE;
         break;
       default:
         break;
index 73e5c6b8e8cf477c5585f52eb71a22473d776506..6dfb15ef140cd47dcdfc9b08f2a3a2aa2f357a09 100644 (file)
@@ -73,7 +73,7 @@ int do_restore(JCR *jcr)
    }
 
    memset(&rjr, 0, sizeof(rjr));
-   jcr->jr.Level = 'F';            /* Full restore */
+   jcr->jr.Level = L_FULL;        /* Full restore */
    jcr->jr.StartTime = jcr->start_time;
    if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
       Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
index 9a041a5ab79ed44ba8312145886ac504015c0e2c..c9aaede5bae53817ee53d15b73217604974e3b90 100644 (file)
@@ -406,6 +406,7 @@ static void prt_runhdr(UAContext *ua)
 static void prt_runtime(UAContext *ua, JOB *job, int level, time_t runtime, POOL *pool)
 {
    char dt[MAX_TIME_LENGTH];      
+   char *level_ptr;
    bool ok = false;
    bool close_db = false;
    JCR *jcr = ua->jcr;
@@ -425,9 +426,17 @@ static void prt_runtime(UAContext *ua, JOB *job, int level, time_t runtime, POOL
       }
    }
    bstrftime(dt, sizeof(dt), runtime);
+   switch (job->JobType) {
+   case JT_ADMIN:
+   case JT_RESTORE:
+      level_ptr = " ";
+      break;
+   default:
+      level_ptr = level_to_str(level);
+      break;
+   }
    bsendmsg(ua, _("%-14s %-8s %-18s %-18s %s\n"), 
-      level_to_str(level), job_type_to_str(job->JobType), dt, job->hdr.name,
-      mr.VolumeName);
+      level_ptr, job_type_to_str(job->JobType), dt, job->hdr.name, mr.VolumeName);
    if (close_db) {
       db_close_database(jcr, jcr->db);
    }
index 88217eeb260c6d854598ada4af9da2b188183683..0d6a9818828c539ccc0c97cef2493ff5951dbcd2 100644 (file)
@@ -43,6 +43,7 @@
 #define L_VERIFY_DISK_TO_CATALOG 'd'  /* verify Disk attributes to catalog */
 #define L_VERIFY_DATA            'A'  /* verify data on volume */
 #define L_BASE                   'B'  /* Base level job */
+#define L_NONE                   ' '  /* None, for Restore and Admin */
 
 
 /* Job Types. These are stored in the DB */
index ece158bd71805d67639ced3376d50fc40aab4bae..ad80a10cef707748f4ba579c44679d9e9a6d18ae 100755 (executable)
@@ -111,23 +111,24 @@ static void free_common_jcr(JCR *jcr)
 {
    /* Keep some statistics */
    switch (jcr->JobType) {
-      case JT_BACKUP:
-      case JT_VERIFY:
-      case JT_RESTORE:
-        last_job.NumJobs++;
-        last_job.JobType = jcr->JobType;
-        last_job.JobId = jcr->JobId;
-        last_job.VolSessionId = jcr->VolSessionId;
-        last_job.VolSessionTime = jcr->VolSessionTime;
-        strcpy(last_job.Job, jcr->Job);
-        last_job.JobFiles = jcr->JobFiles;
-        last_job.JobBytes = jcr->JobBytes;
-        last_job.JobStatus = jcr->JobStatus;
-        last_job.start_time = jcr->start_time;
-        last_job.end_time = time(NULL);
-        break;
-      default:
-        break;
+   case JT_BACKUP:
+   case JT_VERIFY:
+   case JT_RESTORE:
+   case JT_ADMIN:
+      last_job.NumJobs++;
+      last_job.JobType = jcr->JobType;
+      last_job.JobId = jcr->JobId;
+      last_job.VolSessionId = jcr->VolSessionId;
+      last_job.VolSessionTime = jcr->VolSessionTime;
+      bstrncpy(last_job.Job, jcr->Job, sizeof(last_job.Job));
+      last_job.JobFiles = jcr->JobFiles;
+      last_job.JobBytes = jcr->JobBytes;
+      last_job.JobStatus = jcr->JobStatus;
+      last_job.start_time = jcr->start_time;
+      last_job.end_time = time(NULL);
+      break;
+   default:
+      break;
    }
    pthread_mutex_destroy(&jcr->mutex);
 
index 0f03113fecfe1431764124a25849bb1fd0c33246..8f91db6c67a44a3e369169963c2503ac57d7c123 100644 (file)
@@ -315,6 +315,9 @@ char *job_level_to_str(int level)
    case L_VERIFY_DATA:
       str = _("Verify Data");
       break;
+   case L_NONE:
+      str = " ";
+      break;
    default:
       str = _("Unknown Job Level");
       break;