]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Implement patch supplied by Landon to fix bug #944 where using
authorKern Sibbald <kern@sibbald.com>
Tue, 11 Sep 2007 22:09:32 +0000 (22:09 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 11 Sep 2007 22:09:32 +0000 (22:09 +0000)
     TLS with bconsole uses 99+% of the CPU.
kes  Move patches into patches directory.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@5527 91ce42f0-d328-0410-95d8-f526ca767f89

21 files changed:
bacula/ReleaseNotes
bacula/patches/2.0.1-restart.patch [deleted file]
bacula/patches/2.0.3-ampm.patch [deleted file]
bacula/patches/2.0.3-maxbyteslist.patch [deleted file]
bacula/patches/2.0.3-maxwaittime.patch [deleted file]
bacula/patches/2.0.3-scheduler-next-hour.patch [deleted file]
bacula/patches/2.0.3-tls-disconnect.patch [deleted file]
bacula/patches/2.0.3-verify.patch [deleted file]
bacula/patches/2.0.x/2.0.1-restart.patch [new file with mode: 0644]
bacula/patches/2.0.x/2.0.3-ampm.patch [new file with mode: 0644]
bacula/patches/2.0.x/2.0.3-maxbyteslist.patch [new file with mode: 0644]
bacula/patches/2.0.x/2.0.3-maxwaittime.patch [new file with mode: 0644]
bacula/patches/2.0.x/2.0.3-scheduler-next-hour.patch [new file with mode: 0644]
bacula/patches/2.0.x/2.0.3-tls-disconnect.patch [new file with mode: 0644]
bacula/patches/2.0.x/2.0.3-verify.patch [new file with mode: 0644]
bacula/patches/2.2.0-restore.patch [new file with mode: 0644]
bacula/patches/2.2.1-restore.patch [new file with mode: 0644]
bacula/patches/2.2.2-restore.patch [new file with mode: 0644]
bacula/patches/2.2.3-tls.patch [new file with mode: 0644]
bacula/src/lib/tls.c
bacula/technotes-2.1

index 5142ee5c49f4994a61e3e784fc529f127ecb47a4..aa13e1490732b7533b58b0535f45c271a413dcab 100644 (file)
@@ -23,6 +23,8 @@ Version 2.2.3 is a critical bug fix release to version 2.2.2
 - Apply Martin Simmons patch that should turn off the new API usage
   when batch insert is turned off allowing building on older
   PostgreSQLs.
+- Note, you need GTK >= 2.10 to be able to link the Tray Monitor 
+  program.
 
 Version 2.2.2 is a minor bug fix release to 2.2.1
 - Detect if new PosgreSQL batch insert API is present.
diff --git a/bacula/patches/2.0.1-restart.patch b/bacula/patches/2.0.1-restart.patch
deleted file mode 100644 (file)
index 80353b3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-
- This patch should fix the Job restart on error bug that promotes
- an Incremental backup to a Full backup.
-
- Apply it to version 2.0.1 (perhaps to 2.0.0) with:
-
-  cd <bacula-source>
-  patch -p0 <2.0.1-restart.patch
-  make
-  ...
-  make install
-
-Index: src/dird/job.c
-===================================================================
-RCS file: /cvsroot/bacula/bacula/src/dird/job.c,v
-retrieving revision 1.148.2.2
-diff -u -r1.148.2.2 job.c
---- src/dird/job.c     12 Jan 2007 09:58:04 -0000      1.148.2.2
-+++ src/dird/job.c     17 Jan 2007 15:29:25 -0000
-@@ -852,11 +852,6 @@
-       free_pool_memory(jcr->fname);
-       jcr->fname = NULL;
-    }
--   if (jcr->stime) {
--      Dmsg0(200, "Free JCR stime\n");
--      free_pool_memory(jcr->stime);
--      jcr->stime = NULL;
--   }
-    if (jcr->RestoreBootstrap) {
-       free(jcr->RestoreBootstrap);
-       jcr->RestoreBootstrap = NULL;
-@@ -889,6 +884,11 @@
-       pthread_cond_destroy(&jcr->term_wait);
-       jcr->term_wait_inited = false;
-    }
-+   if (jcr->stime) {
-+      Dmsg0(200, "Free JCR stime\n");
-+      free_pool_memory(jcr->stime);
-+      jcr->stime = NULL;
-+   }
-    if (jcr->fname) {
-       Dmsg0(200, "Free JCR fname\n");
-       free_pool_memory(jcr->fname);
diff --git a/bacula/patches/2.0.3-ampm.patch b/bacula/patches/2.0.3-ampm.patch
deleted file mode 100644 (file)
index d811507..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-This patch should resolve some problems with handling of am/pm
-in schedules as reported by bug #808.
-
-According to the NIST (US National Institute of Standards and Technology),
-12am and 12pm are ambiguous and can be defined to anything.  However,
-12:01am is the same as 00:01 and 12:01pm is the same as 12:01, so Bacula
-defines 12am as 00:00 (midnight) and 12pm as 12:00 (noon).  You can avoid
-this abiguity (confusion) by using 24 hour time specifications (i.e.  no
-am/pm). This is the definition in Bacula version 2.0.3 and later.
-
-Apply it to version 2.0.3 with:
-
-  cd <bacula-source>
-  patch -p0 <2.0.3-ampm.patch
-  make
-  ...
-  make install
-
-Index: src/dird/run_conf.c
-===================================================================
---- src/dird/run_conf.c        (revision 4349)
-+++ src/dird/run_conf.c        (working copy)
-@@ -339,6 +339,7 @@
-    for ( ; token != T_EOL; (token = lex_get_token(lc, T_ALL))) {
-       int len; 
-       bool pm = false;
-+      bool am = false;
-       switch (token) {
-       case T_NUMBER:
-          state = s_mday;
-@@ -434,6 +435,7 @@
-          if (!have_hour) {
-             clear_bits(0, 23, lrun.hour);
-          }
-+//       Dmsg1(000, "s_time=%s\n", lc->str);
-          p = strchr(lc->str, ':');
-          if (!p)  {
-             scan_err0(lc, _("Time logic error.\n"));
-@@ -441,20 +443,19 @@
-          }
-          *p++ = 0;                 /* separate two halves */
-          code = atoi(lc->str);     /* pick up hour */
-+         code2 = atoi(p);          /* pick up minutes */
-          len = strlen(p);
--         if (len > 2 && p[len-1] == 'm') {
--            if (p[len-2] == 'a') {
--               pm = false;
--            } else if (p[len-2] == 'p') {
--               pm = true;
--            } else {
--               scan_err0(lc, _("Bad time specification."));
--               /* NOT REACHED */
--            }
--         } else {
--            pm = false;
-+         if (len >= 2) {
-+            p += 2;
-          }
--         code2 = atoi(p);             /* pick up minutes */
-+         if (strcasecmp(p, "pm") == 0) {
-+            pm = true;
-+         } else if (strcasecmp(p, "am") == 0) {
-+            am = true;
-+         } else if (len != 2) {
-+            scan_err0(lc, _("Bad time specification."));
-+            /* NOT REACHED */
-+         }   
-          /* 
-           * Note, according to NIST, 12am and 12pm are ambiguous and
-           *  can be defined to anything.  However, 12:01am is the same
-@@ -467,13 +468,14 @@
-                code += 12;
-             }
-          /* am */
--         } else if (code == 12) {
-+         } else if (am && code == 12) {
-             code -= 12;
-          }
-          if (code < 0 || code > 23 || code2 < 0 || code2 > 59) {
-             scan_err0(lc, _("Bad time specification."));
-             /* NOT REACHED */
-          }
-+//       Dmsg2(000, "hour=%d min=%d\n", code, code2);
-          set_bit(code, lrun.hour);
-          lrun.minute = code2;
-          have_hour = true;
diff --git a/bacula/patches/2.0.3-maxbyteslist.patch b/bacula/patches/2.0.3-maxbyteslist.patch
deleted file mode 100644 (file)
index ecb97b2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
- This patch adds the MaxVolBytes to the output of a "show pools" command.
- It fixes bug #814.  Apply it to Bacula version 2.0.3 with:
-
-   cd <bacula-source>
-   patch -p0 <2.0.3-maxbyteslist.patch
-   make
-   ...
-   make install
-
-
-Index: src/dird/dird_conf.c
-===================================================================
---- src/dird/dird_conf.c       (revision 4349)
-+++ src/dird/dird_conf.c       (working copy)
-@@ -844,10 +844,13 @@
-               NPRT(res->res_pool.label_format));
-       sendit(sock, _("      CleaningPrefix=%s LabelType=%d\n"),
-               NPRT(res->res_pool.cleaning_prefix), res->res_pool.LabelType);
--      sendit(sock, _("      RecyleOldest=%d PurgeOldest=%d MaxVolJobs=%d MaxVolFiles=%d\n"),
-+      sendit(sock, _("      RecyleOldest=%d PurgeOldest=%d\n"), 
-               res->res_pool.recycle_oldest_volume,
--              res->res_pool.purge_oldest_volume,
--              res->res_pool.MaxVolJobs, res->res_pool.MaxVolFiles);
-+              res->res_pool.purge_oldest_volume);
-+      sendit(sock, _("      MaxVolJobs=%d MaxVolFiles=%d MaxVolBytes=%s\n"),
-+              res->res_pool.MaxVolJobs, 
-+              res->res_pool.MaxVolFiles,
-+              edit_uint64(res->res_pool.MaxVolFiles, ed1));
-       sendit(sock, _("      MigTime=%s MigHiBytes=%s MigLoBytes=%s\n"),
-               edit_utime(res->res_pool.MigrationTime, ed1, sizeof(ed1)),
-               edit_uint64(res->res_pool.MigrationHighBytes, ed2),
diff --git a/bacula/patches/2.0.3-maxwaittime.patch b/bacula/patches/2.0.3-maxwaittime.patch
deleted file mode 100644 (file)
index 5ed6b29..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-
-This patch should fix the logic error in checking for the MaxWaitTime of
-a job in src/dird/job.c.  It fixes bug #802.
-
-Apply it to Bacula version 2.0.3 with:
-
-  cd <bacula-source>
-  patch -p0 <2.0.3-maxwaittime.patch
-  make
-  ...
-  make install
-
-
-
-Index: src/dird/job.c
-===================================================================
---- src/dird/job.c     (revision 4349)
-+++ src/dird/job.c     (working copy)
-@@ -481,7 +481,6 @@
- static bool job_check_maxwaittime(JCR *control_jcr, JCR *jcr)
- {
-    bool cancel = false;
--   bool ok_to_cancel = false;
-    JOB *job = jcr->job;
-    if (job_canceled(jcr)) {
-@@ -493,69 +492,18 @@
-    } 
-    if (jcr->JobLevel == L_FULL && job->FullMaxWaitTime != 0 &&
-          (watchdog_time - jcr->start_time) >= job->FullMaxWaitTime) {
--      ok_to_cancel = true;
-+      cancel = true;
-    } else if (jcr->JobLevel == L_DIFFERENTIAL && job->DiffMaxWaitTime != 0 &&
-          (watchdog_time - jcr->start_time) >= job->DiffMaxWaitTime) {
--      ok_to_cancel = true;
-+      cancel = true;
-    } else if (jcr->JobLevel == L_INCREMENTAL && job->IncMaxWaitTime != 0 &&
-          (watchdog_time - jcr->start_time) >= job->IncMaxWaitTime) {
--      ok_to_cancel = true;
-+      cancel = true;
-    } else if (job->MaxWaitTime != 0 &&
-          (watchdog_time - jcr->start_time) >= job->MaxWaitTime) {
--      ok_to_cancel = true;
--   }
--   if (!ok_to_cancel) {
--      return false;
--   }
--
--/*
-- * I don't see the need for all this -- kes 17Dec06
-- */
--#ifdef xxx
--   Dmsg3(800, "Job %d (%s): MaxWaitTime of %d seconds exceeded, "
--         "checking status\n",
--         jcr->JobId, jcr->Job, job->MaxWaitTime);
--   switch (jcr->JobStatus) {
--   case JS_Created:
--   case JS_Blocked:
--   case JS_WaitFD:
--   case JS_WaitSD:
--   case JS_WaitStoreRes:
--   case JS_WaitClientRes:
--   case JS_WaitJobRes:
--   case JS_WaitPriority:
--   case JS_WaitMaxJobs:
--   case JS_WaitStartTime:
-       cancel = true;
--      Dmsg0(200, "JCR blocked in #1\n");
--      break;
--   case JS_Running:
--      Dmsg0(800, "JCR running, checking SD status\n");
--      switch (jcr->SDJobStatus) {
--      case JS_WaitMount:
--      case JS_WaitMedia:
--      case JS_WaitFD:
--         cancel = true;
--         Dmsg0(800, "JCR blocked in #2\n");
--         break;
--      default:
--         Dmsg0(800, "JCR not blocked in #2\n");
--         break;
--      }
--      break;
--   case JS_Terminated:
--   case JS_ErrorTerminated:
--   case JS_Canceled:
--   case JS_FatalError:
--      Dmsg0(800, "JCR already dead in #3\n");
--      break;
--   default:
--      Jmsg1(jcr, M_ERROR, 0, _("Unhandled job status code %d\n"),
--            jcr->JobStatus);
-    }
--   Dmsg3(800, "MaxWaitTime result: %scancel JCR %p (%s)\n",
--         cancel ? "" : "do not ", jcr, jcr->Job);
--#endif
-+
-    return cancel;
- }
-@@ -574,36 +522,6 @@
-       return false;
-    }
--#ifdef xxx
--   switch (jcr->JobStatus) {
--   case JS_Created:
--   case JS_Running:
--   case JS_Blocked:
--   case JS_WaitFD:
--   case JS_WaitSD:
--   case JS_WaitStoreRes:
--   case JS_WaitClientRes:
--   case JS_WaitJobRes:
--   case JS_WaitPriority:
--   case JS_WaitMaxJobs:
--   case JS_WaitStartTime:
--   case JS_Differences:
--      cancel = true;
--      break;
--   case JS_Terminated:
--   case JS_ErrorTerminated:
--   case JS_Canceled:
--   case JS_FatalError:
--      cancel = false;
--      break;
--   default:
--      Jmsg1(jcr, M_ERROR, 0, _("Unhandled job status code %d\n"),
--            jcr->JobStatus);
--   }
--
--   Dmsg3(200, "MaxRunTime result: %scancel JCR %p (%s)\n",
--         cancel ? "" : "do not ", jcr, jcr->Job);
--#endif
-    return true;
- }
diff --git a/bacula/patches/2.0.3-scheduler-next-hour.patch b/bacula/patches/2.0.3-scheduler-next-hour.patch
deleted file mode 100644 (file)
index 115e86b..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-
- This patch should fix bug #812 where the DST time shift was 
- incorrectly handled. This patch was submitted by Martin Simmons.
- Apply it to Bacula version 2.0.3 with:
-
-  cd <bacula-source>
-  patch -p0 <2.0.3-scheduler-next-hour.patch
-  make
-  ...
-  make install
-
-Index: src/dird/scheduler.c
-===================================================================
---- src/dird/scheduler.c       (revision 4445)
-+++ src/dird/scheduler.c       (working copy)
-@@ -175,11 +175,11 @@
-       }
-       /* Recheck at least once per minute */
-       bmicrosleep((next_check_secs < twait)?next_check_secs:twait, 0);
--      /* Attempt to handle clock shift from/to daylight savings time
-+      /* Attempt to handle clock shift (but not daylight savings time changes)
-        * we allow a skew of 10 seconds before invalidating everything.
-        */
-       now = time(NULL);
--      if (now < prev+10 || now > (prev+next_check_secs+10)) {
-+      if (now < prev-10 || now > (prev+next_check_secs+10)) {
-          schedules_invalidated = true;
-       }
-    }
-@@ -284,6 +284,9 @@
-    wom = mday / 7;
-    woy = tm_woy(now);                     /* get week of year */
-+   Dmsg7(dbglvl, "now = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
-+       now, hour, month, mday, wday, wom, woy);
-+
-    /*
-     * Compute values for next hour from now.
-     * We do this to be sure we don't miss a job while
-@@ -299,6 +302,9 @@
-    nh_wom = nh_mday / 7;
-    nh_woy = tm_woy(now);                     /* get week of year */
-+   Dmsg7(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
-+       next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy);
-+
-    /* Loop through all jobs */
-    LockRes();
-    foreach_res(job, R_JOB) {
-@@ -351,24 +357,20 @@
-          Dmsg3(dbglvl, "run@%p: run_now=%d run_nh=%d\n", run, run_now, run_nh);
--         /* find time (time_t) job is to be run */
--         (void)localtime_r(&now, &tm);      /* reset tm structure */
--         tm.tm_min = run->minute;     /* set run minute */
--         tm.tm_sec = 0;               /* zero secs */
--         if (run_now) {
--            runtime = mktime(&tm);
--            add_job(job, run, now, runtime);
--         }
--         /* If job is to be run in the next hour schedule it */
--         if (run_nh) {
--            /* Set correct values */
--            tm.tm_hour = nh_hour;
--            tm.tm_mday = nh_mday + 1; /* fixup because we biased for tests above */
--            tm.tm_mon = nh_month;
--            tm.tm_year = nh_year;
--            runtime = mktime(&tm);
--            add_job(job, run, now, runtime);
--         }
-+       if (run_now || run_nh) {
-+         /* find time (time_t) job is to be run */
-+         (void)localtime_r(&now, &tm);      /* reset tm structure */
-+         tm.tm_min = run->minute;     /* set run minute */
-+         tm.tm_sec = 0;               /* zero secs */
-+         runtime = mktime(&tm);
-+         if (run_now) {
-+           add_job(job, run, now, runtime);
-+         }
-+         /* If job is to be run in the next hour schedule it */
-+         if (run_nh) {
-+           add_job(job, run, now, runtime + 3600);
-+         }
-+       }
-       }
-    }
-    UnlockRes();
diff --git a/bacula/patches/2.0.3-tls-disconnect.patch b/bacula/patches/2.0.3-tls-disconnect.patch
deleted file mode 100644 (file)
index e634cb0..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-
-This patch should fix the spurious connection drops that fail jobs
-as reported in bug #888.
-Apply it to version 2.0.3 (possibly earlier versions of 2.0) with:
-
-  cd <bacula-source>
-  patch -p0 <2.0.3-tls-disconnect.patch
-  make
-  ...
-  make install
-
-Index: src/lib/tls.c
-===================================================================
---- src/lib/tls.c      (revision 4668)
-+++ src/lib/tls.c      (working copy)
-@@ -540,14 +540,6 @@
-     * The first time to initiate the shutdown handshake, and the second to
-     * receive the peer's reply.
-     *
--    * However, it is valid to close the SSL connection after the initial
--    * shutdown notification is sent to the peer, without waiting for the
--    * peer's reply, as long as you do not plan to re-use that particular
--    * SSL connection object.
--    *
--    * Because we do not re-use SSL connection objects, I do not bother
--    * calling SSL_shutdown a second time.
--    *
-     * In addition, if the underlying socket is blocking, SSL_shutdown()
-     * will not return until the current stage of the shutdown process has
-     * completed or an error has occured. By setting the socket blocking
-@@ -560,6 +552,10 @@
-    flags = bnet_set_blocking(bsock);
-    err = SSL_shutdown(bsock->tls->openssl);
-+   if (err == 0) {
-+      /* Finish up the closing */
-+      err = SSL_shutdown(bsock->tls->openssl);
-+   }
-    switch (SSL_get_error(bsock->tls->openssl, err)) {
-       case SSL_ERROR_NONE:
-@@ -574,8 +570,6 @@
-          break;
-    }
--   /* Restore saved flags */
--   bnet_restore_blocking(bsock, flags);
- }
- /* Does all the manual labor for tls_bsock_readn() and tls_bsock_writen() */
diff --git a/bacula/patches/2.0.3-verify.patch b/bacula/patches/2.0.3-verify.patch
deleted file mode 100644 (file)
index e239584..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-This patch should fix the problem reported in bug #803 where a Verify 
-job select the JobId to verified at schedule time rather than at runtime.
-This makes it difficult or impossible to schedule a verify just after
-a backup.
-
-Apply this patch to Bacula version 2.0.3 (probably 2.0.2 as well) with:
-
-  cd <bacula-source>
-  patch -p0 <2.0.3-verify.patch
-  make
-  ...
-  make install
-
-Index: src/dird/verify.c
-===================================================================
---- src/dird/verify.c  (revision 4353)
-+++ src/dird/verify.c  (working copy)
-@@ -1,22 +1,7 @@
- /*
-- *
-- *   Bacula Director -- verify.c -- responsible for running file verification
-- *
-- *     Kern Sibbald, October MM
-- *
-- *  Basic tasks done here:
-- *     Open DB
-- *     Open connection with File daemon and pass him commands
-- *       to do the verify.
-- *     When the File daemon sends the attributes, compare them to
-- *       what is in the DB.
-- *
-- *   Version $Id$
-- */
--/*
-    Bacula® - The Network Backup Solution
--   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
-+   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
-    The main author of Bacula is Kern Sibbald, with contributions from
-    many others, a complete list can be found in the file AUTHORS.
-@@ -40,6 +25,21 @@
-    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
-    Switzerland, email:ftf@fsfeurope.org.
- */
-+/*
-+ *
-+ *   Bacula Director -- verify.c -- responsible for running file verification
-+ *
-+ *     Kern Sibbald, October MM
-+ *
-+ *  Basic tasks done here:
-+ *     Open DB
-+ *     Open connection with File daemon and pass him commands
-+ *       to do the verify.
-+ *     When the File daemon sends the attributes, compare them to
-+ *       what is in the DB.
-+ *
-+ *   Version $Id$
-+ */
- #include "bacula.h"
-@@ -66,6 +66,22 @@
-  */
- bool do_verify_init(JCR *jcr) 
- {
-+   return true;
-+}
-+
-+
-+/*
-+ * Do a verification of the specified files against the Catlaog
-+ *
-+ *  Returns:  false on failure
-+ *            true  on success
-+ */
-+bool do_verify(JCR *jcr)
-+{
-+   const char *level;
-+   BSOCK   *fd;
-+   int stat;
-+   char ed1[100];
-    JOB_DBR jr;
-    JobId_t verify_jobid = 0;
-    const char *Name;
-@@ -74,12 +90,16 @@
-    memset(&jcr->previous_jr, 0, sizeof(jcr->previous_jr));
--   Dmsg1(9, "bdird: created client %s record\n", jcr->client->hdr.name);
--
-    /*
--    * Find JobId of last job that ran.  E.g.
--    *   for VERIFY_CATALOG we want the JobId of the last INIT.
--    *   for VERIFY_VOLUME_TO_CATALOG, we want the JobId of the
-+    * Find JobId of last job that ran. Note, we do this when
-+    *   the job actually starts running, not at schedule time,
-+    *   so that we find the last job that terminated before
-+    *   this job runs rather than before it is scheduled. This
-+    *   permits scheduling a Backup and Verify at the same time,
-+    *   but with the Verify at a lower priority.
-+    *
-+    *   For VERIFY_CATALOG we want the JobId of the last INIT.
-+    *   For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the
-     *       last backup Job.
-     */
-    if (jcr->JobLevel == L_VERIFY_CATALOG ||
-@@ -89,7 +109,7 @@
-       if (jcr->verify_job &&
-           (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
-            jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG)) {
--         Name = jcr->verify_job->hdr.name;
-+         Name = jcr->verify_job->name();  
-       } else {
-          Name = NULL;
-       }
-@@ -149,23 +169,7 @@
-       jcr->fileset = jcr->verify_job->fileset;
-    }
-    Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->JobLevel);
--   return true;
--}
--
--/*
-- * Do a verification of the specified files against the Catlaog
-- *
-- *  Returns:  false on failure
-- *            true  on success
-- */
--bool do_verify(JCR *jcr)
--{
--   const char *level;
--   BSOCK   *fd;
--   int stat;
--   char ed1[100];
--
-    if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
-       Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
-       return false;
diff --git a/bacula/patches/2.0.x/2.0.1-restart.patch b/bacula/patches/2.0.x/2.0.1-restart.patch
new file mode 100644 (file)
index 0000000..80353b3
--- /dev/null
@@ -0,0 +1,43 @@
+
+ This patch should fix the Job restart on error bug that promotes
+ an Incremental backup to a Full backup.
+
+ Apply it to version 2.0.1 (perhaps to 2.0.0) with:
+
+  cd <bacula-source>
+  patch -p0 <2.0.1-restart.patch
+  make
+  ...
+  make install
+
+Index: src/dird/job.c
+===================================================================
+RCS file: /cvsroot/bacula/bacula/src/dird/job.c,v
+retrieving revision 1.148.2.2
+diff -u -r1.148.2.2 job.c
+--- src/dird/job.c     12 Jan 2007 09:58:04 -0000      1.148.2.2
++++ src/dird/job.c     17 Jan 2007 15:29:25 -0000
+@@ -852,11 +852,6 @@
+       free_pool_memory(jcr->fname);
+       jcr->fname = NULL;
+    }
+-   if (jcr->stime) {
+-      Dmsg0(200, "Free JCR stime\n");
+-      free_pool_memory(jcr->stime);
+-      jcr->stime = NULL;
+-   }
+    if (jcr->RestoreBootstrap) {
+       free(jcr->RestoreBootstrap);
+       jcr->RestoreBootstrap = NULL;
+@@ -889,6 +884,11 @@
+       pthread_cond_destroy(&jcr->term_wait);
+       jcr->term_wait_inited = false;
+    }
++   if (jcr->stime) {
++      Dmsg0(200, "Free JCR stime\n");
++      free_pool_memory(jcr->stime);
++      jcr->stime = NULL;
++   }
+    if (jcr->fname) {
+       Dmsg0(200, "Free JCR fname\n");
+       free_pool_memory(jcr->fname);
diff --git a/bacula/patches/2.0.x/2.0.3-ampm.patch b/bacula/patches/2.0.x/2.0.3-ampm.patch
new file mode 100644 (file)
index 0000000..d811507
--- /dev/null
@@ -0,0 +1,86 @@
+This patch should resolve some problems with handling of am/pm
+in schedules as reported by bug #808.
+
+According to the NIST (US National Institute of Standards and Technology),
+12am and 12pm are ambiguous and can be defined to anything.  However,
+12:01am is the same as 00:01 and 12:01pm is the same as 12:01, so Bacula
+defines 12am as 00:00 (midnight) and 12pm as 12:00 (noon).  You can avoid
+this abiguity (confusion) by using 24 hour time specifications (i.e.  no
+am/pm). This is the definition in Bacula version 2.0.3 and later.
+
+Apply it to version 2.0.3 with:
+
+  cd <bacula-source>
+  patch -p0 <2.0.3-ampm.patch
+  make
+  ...
+  make install
+
+Index: src/dird/run_conf.c
+===================================================================
+--- src/dird/run_conf.c        (revision 4349)
++++ src/dird/run_conf.c        (working copy)
+@@ -339,6 +339,7 @@
+    for ( ; token != T_EOL; (token = lex_get_token(lc, T_ALL))) {
+       int len; 
+       bool pm = false;
++      bool am = false;
+       switch (token) {
+       case T_NUMBER:
+          state = s_mday;
+@@ -434,6 +435,7 @@
+          if (!have_hour) {
+             clear_bits(0, 23, lrun.hour);
+          }
++//       Dmsg1(000, "s_time=%s\n", lc->str);
+          p = strchr(lc->str, ':');
+          if (!p)  {
+             scan_err0(lc, _("Time logic error.\n"));
+@@ -441,20 +443,19 @@
+          }
+          *p++ = 0;                 /* separate two halves */
+          code = atoi(lc->str);     /* pick up hour */
++         code2 = atoi(p);          /* pick up minutes */
+          len = strlen(p);
+-         if (len > 2 && p[len-1] == 'm') {
+-            if (p[len-2] == 'a') {
+-               pm = false;
+-            } else if (p[len-2] == 'p') {
+-               pm = true;
+-            } else {
+-               scan_err0(lc, _("Bad time specification."));
+-               /* NOT REACHED */
+-            }
+-         } else {
+-            pm = false;
++         if (len >= 2) {
++            p += 2;
+          }
+-         code2 = atoi(p);             /* pick up minutes */
++         if (strcasecmp(p, "pm") == 0) {
++            pm = true;
++         } else if (strcasecmp(p, "am") == 0) {
++            am = true;
++         } else if (len != 2) {
++            scan_err0(lc, _("Bad time specification."));
++            /* NOT REACHED */
++         }   
+          /* 
+           * Note, according to NIST, 12am and 12pm are ambiguous and
+           *  can be defined to anything.  However, 12:01am is the same
+@@ -467,13 +468,14 @@
+                code += 12;
+             }
+          /* am */
+-         } else if (code == 12) {
++         } else if (am && code == 12) {
+             code -= 12;
+          }
+          if (code < 0 || code > 23 || code2 < 0 || code2 > 59) {
+             scan_err0(lc, _("Bad time specification."));
+             /* NOT REACHED */
+          }
++//       Dmsg2(000, "hour=%d min=%d\n", code, code2);
+          set_bit(code, lrun.hour);
+          lrun.minute = code2;
+          have_hour = true;
diff --git a/bacula/patches/2.0.x/2.0.3-maxbyteslist.patch b/bacula/patches/2.0.x/2.0.3-maxbyteslist.patch
new file mode 100644 (file)
index 0000000..ecb97b2
--- /dev/null
@@ -0,0 +1,32 @@
+
+ This patch adds the MaxVolBytes to the output of a "show pools" command.
+ It fixes bug #814.  Apply it to Bacula version 2.0.3 with:
+
+   cd <bacula-source>
+   patch -p0 <2.0.3-maxbyteslist.patch
+   make
+   ...
+   make install
+
+
+Index: src/dird/dird_conf.c
+===================================================================
+--- src/dird/dird_conf.c       (revision 4349)
++++ src/dird/dird_conf.c       (working copy)
+@@ -844,10 +844,13 @@
+               NPRT(res->res_pool.label_format));
+       sendit(sock, _("      CleaningPrefix=%s LabelType=%d\n"),
+               NPRT(res->res_pool.cleaning_prefix), res->res_pool.LabelType);
+-      sendit(sock, _("      RecyleOldest=%d PurgeOldest=%d MaxVolJobs=%d MaxVolFiles=%d\n"),
++      sendit(sock, _("      RecyleOldest=%d PurgeOldest=%d\n"), 
+               res->res_pool.recycle_oldest_volume,
+-              res->res_pool.purge_oldest_volume,
+-              res->res_pool.MaxVolJobs, res->res_pool.MaxVolFiles);
++              res->res_pool.purge_oldest_volume);
++      sendit(sock, _("      MaxVolJobs=%d MaxVolFiles=%d MaxVolBytes=%s\n"),
++              res->res_pool.MaxVolJobs, 
++              res->res_pool.MaxVolFiles,
++              edit_uint64(res->res_pool.MaxVolFiles, ed1));
+       sendit(sock, _("      MigTime=%s MigHiBytes=%s MigLoBytes=%s\n"),
+               edit_utime(res->res_pool.MigrationTime, ed1, sizeof(ed1)),
+               edit_uint64(res->res_pool.MigrationHighBytes, ed2),
diff --git a/bacula/patches/2.0.x/2.0.3-maxwaittime.patch b/bacula/patches/2.0.x/2.0.3-maxwaittime.patch
new file mode 100644 (file)
index 0000000..5ed6b29
--- /dev/null
@@ -0,0 +1,137 @@
+
+This patch should fix the logic error in checking for the MaxWaitTime of
+a job in src/dird/job.c.  It fixes bug #802.
+
+Apply it to Bacula version 2.0.3 with:
+
+  cd <bacula-source>
+  patch -p0 <2.0.3-maxwaittime.patch
+  make
+  ...
+  make install
+
+
+
+Index: src/dird/job.c
+===================================================================
+--- src/dird/job.c     (revision 4349)
++++ src/dird/job.c     (working copy)
+@@ -481,7 +481,6 @@
+ static bool job_check_maxwaittime(JCR *control_jcr, JCR *jcr)
+ {
+    bool cancel = false;
+-   bool ok_to_cancel = false;
+    JOB *job = jcr->job;
+    if (job_canceled(jcr)) {
+@@ -493,69 +492,18 @@
+    } 
+    if (jcr->JobLevel == L_FULL && job->FullMaxWaitTime != 0 &&
+          (watchdog_time - jcr->start_time) >= job->FullMaxWaitTime) {
+-      ok_to_cancel = true;
++      cancel = true;
+    } else if (jcr->JobLevel == L_DIFFERENTIAL && job->DiffMaxWaitTime != 0 &&
+          (watchdog_time - jcr->start_time) >= job->DiffMaxWaitTime) {
+-      ok_to_cancel = true;
++      cancel = true;
+    } else if (jcr->JobLevel == L_INCREMENTAL && job->IncMaxWaitTime != 0 &&
+          (watchdog_time - jcr->start_time) >= job->IncMaxWaitTime) {
+-      ok_to_cancel = true;
++      cancel = true;
+    } else if (job->MaxWaitTime != 0 &&
+          (watchdog_time - jcr->start_time) >= job->MaxWaitTime) {
+-      ok_to_cancel = true;
+-   }
+-   if (!ok_to_cancel) {
+-      return false;
+-   }
+-
+-/*
+- * I don't see the need for all this -- kes 17Dec06
+- */
+-#ifdef xxx
+-   Dmsg3(800, "Job %d (%s): MaxWaitTime of %d seconds exceeded, "
+-         "checking status\n",
+-         jcr->JobId, jcr->Job, job->MaxWaitTime);
+-   switch (jcr->JobStatus) {
+-   case JS_Created:
+-   case JS_Blocked:
+-   case JS_WaitFD:
+-   case JS_WaitSD:
+-   case JS_WaitStoreRes:
+-   case JS_WaitClientRes:
+-   case JS_WaitJobRes:
+-   case JS_WaitPriority:
+-   case JS_WaitMaxJobs:
+-   case JS_WaitStartTime:
+       cancel = true;
+-      Dmsg0(200, "JCR blocked in #1\n");
+-      break;
+-   case JS_Running:
+-      Dmsg0(800, "JCR running, checking SD status\n");
+-      switch (jcr->SDJobStatus) {
+-      case JS_WaitMount:
+-      case JS_WaitMedia:
+-      case JS_WaitFD:
+-         cancel = true;
+-         Dmsg0(800, "JCR blocked in #2\n");
+-         break;
+-      default:
+-         Dmsg0(800, "JCR not blocked in #2\n");
+-         break;
+-      }
+-      break;
+-   case JS_Terminated:
+-   case JS_ErrorTerminated:
+-   case JS_Canceled:
+-   case JS_FatalError:
+-      Dmsg0(800, "JCR already dead in #3\n");
+-      break;
+-   default:
+-      Jmsg1(jcr, M_ERROR, 0, _("Unhandled job status code %d\n"),
+-            jcr->JobStatus);
+    }
+-   Dmsg3(800, "MaxWaitTime result: %scancel JCR %p (%s)\n",
+-         cancel ? "" : "do not ", jcr, jcr->Job);
+-#endif
++
+    return cancel;
+ }
+@@ -574,36 +522,6 @@
+       return false;
+    }
+-#ifdef xxx
+-   switch (jcr->JobStatus) {
+-   case JS_Created:
+-   case JS_Running:
+-   case JS_Blocked:
+-   case JS_WaitFD:
+-   case JS_WaitSD:
+-   case JS_WaitStoreRes:
+-   case JS_WaitClientRes:
+-   case JS_WaitJobRes:
+-   case JS_WaitPriority:
+-   case JS_WaitMaxJobs:
+-   case JS_WaitStartTime:
+-   case JS_Differences:
+-      cancel = true;
+-      break;
+-   case JS_Terminated:
+-   case JS_ErrorTerminated:
+-   case JS_Canceled:
+-   case JS_FatalError:
+-      cancel = false;
+-      break;
+-   default:
+-      Jmsg1(jcr, M_ERROR, 0, _("Unhandled job status code %d\n"),
+-            jcr->JobStatus);
+-   }
+-
+-   Dmsg3(200, "MaxRunTime result: %scancel JCR %p (%s)\n",
+-         cancel ? "" : "do not ", jcr, jcr->Job);
+-#endif
+    return true;
+ }
diff --git a/bacula/patches/2.0.x/2.0.3-scheduler-next-hour.patch b/bacula/patches/2.0.x/2.0.3-scheduler-next-hour.patch
new file mode 100644 (file)
index 0000000..115e86b
--- /dev/null
@@ -0,0 +1,88 @@
+
+ This patch should fix bug #812 where the DST time shift was 
+ incorrectly handled. This patch was submitted by Martin Simmons.
+ Apply it to Bacula version 2.0.3 with:
+
+  cd <bacula-source>
+  patch -p0 <2.0.3-scheduler-next-hour.patch
+  make
+  ...
+  make install
+
+Index: src/dird/scheduler.c
+===================================================================
+--- src/dird/scheduler.c       (revision 4445)
++++ src/dird/scheduler.c       (working copy)
+@@ -175,11 +175,11 @@
+       }
+       /* Recheck at least once per minute */
+       bmicrosleep((next_check_secs < twait)?next_check_secs:twait, 0);
+-      /* Attempt to handle clock shift from/to daylight savings time
++      /* Attempt to handle clock shift (but not daylight savings time changes)
+        * we allow a skew of 10 seconds before invalidating everything.
+        */
+       now = time(NULL);
+-      if (now < prev+10 || now > (prev+next_check_secs+10)) {
++      if (now < prev-10 || now > (prev+next_check_secs+10)) {
+          schedules_invalidated = true;
+       }
+    }
+@@ -284,6 +284,9 @@
+    wom = mday / 7;
+    woy = tm_woy(now);                     /* get week of year */
++   Dmsg7(dbglvl, "now = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
++       now, hour, month, mday, wday, wom, woy);
++
+    /*
+     * Compute values for next hour from now.
+     * We do this to be sure we don't miss a job while
+@@ -299,6 +302,9 @@
+    nh_wom = nh_mday / 7;
+    nh_woy = tm_woy(now);                     /* get week of year */
++   Dmsg7(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d\n",
++       next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy);
++
+    /* Loop through all jobs */
+    LockRes();
+    foreach_res(job, R_JOB) {
+@@ -351,24 +357,20 @@
+          Dmsg3(dbglvl, "run@%p: run_now=%d run_nh=%d\n", run, run_now, run_nh);
+-         /* find time (time_t) job is to be run */
+-         (void)localtime_r(&now, &tm);      /* reset tm structure */
+-         tm.tm_min = run->minute;     /* set run minute */
+-         tm.tm_sec = 0;               /* zero secs */
+-         if (run_now) {
+-            runtime = mktime(&tm);
+-            add_job(job, run, now, runtime);
+-         }
+-         /* If job is to be run in the next hour schedule it */
+-         if (run_nh) {
+-            /* Set correct values */
+-            tm.tm_hour = nh_hour;
+-            tm.tm_mday = nh_mday + 1; /* fixup because we biased for tests above */
+-            tm.tm_mon = nh_month;
+-            tm.tm_year = nh_year;
+-            runtime = mktime(&tm);
+-            add_job(job, run, now, runtime);
+-         }
++       if (run_now || run_nh) {
++         /* find time (time_t) job is to be run */
++         (void)localtime_r(&now, &tm);      /* reset tm structure */
++         tm.tm_min = run->minute;     /* set run minute */
++         tm.tm_sec = 0;               /* zero secs */
++         runtime = mktime(&tm);
++         if (run_now) {
++           add_job(job, run, now, runtime);
++         }
++         /* If job is to be run in the next hour schedule it */
++         if (run_nh) {
++           add_job(job, run, now, runtime + 3600);
++         }
++       }
+       }
+    }
+    UnlockRes();
diff --git a/bacula/patches/2.0.x/2.0.3-tls-disconnect.patch b/bacula/patches/2.0.x/2.0.3-tls-disconnect.patch
new file mode 100644 (file)
index 0000000..e634cb0
--- /dev/null
@@ -0,0 +1,50 @@
+
+This patch should fix the spurious connection drops that fail jobs
+as reported in bug #888.
+Apply it to version 2.0.3 (possibly earlier versions of 2.0) with:
+
+  cd <bacula-source>
+  patch -p0 <2.0.3-tls-disconnect.patch
+  make
+  ...
+  make install
+
+Index: src/lib/tls.c
+===================================================================
+--- src/lib/tls.c      (revision 4668)
++++ src/lib/tls.c      (working copy)
+@@ -540,14 +540,6 @@
+     * The first time to initiate the shutdown handshake, and the second to
+     * receive the peer's reply.
+     *
+-    * However, it is valid to close the SSL connection after the initial
+-    * shutdown notification is sent to the peer, without waiting for the
+-    * peer's reply, as long as you do not plan to re-use that particular
+-    * SSL connection object.
+-    *
+-    * Because we do not re-use SSL connection objects, I do not bother
+-    * calling SSL_shutdown a second time.
+-    *
+     * In addition, if the underlying socket is blocking, SSL_shutdown()
+     * will not return until the current stage of the shutdown process has
+     * completed or an error has occured. By setting the socket blocking
+@@ -560,6 +552,10 @@
+    flags = bnet_set_blocking(bsock);
+    err = SSL_shutdown(bsock->tls->openssl);
++   if (err == 0) {
++      /* Finish up the closing */
++      err = SSL_shutdown(bsock->tls->openssl);
++   }
+    switch (SSL_get_error(bsock->tls->openssl, err)) {
+       case SSL_ERROR_NONE:
+@@ -574,8 +570,6 @@
+          break;
+    }
+-   /* Restore saved flags */
+-   bnet_restore_blocking(bsock, flags);
+ }
+ /* Does all the manual labor for tls_bsock_readn() and tls_bsock_writen() */
diff --git a/bacula/patches/2.0.x/2.0.3-verify.patch b/bacula/patches/2.0.x/2.0.3-verify.patch
new file mode 100644 (file)
index 0000000..e239584
--- /dev/null
@@ -0,0 +1,141 @@
+This patch should fix the problem reported in bug #803 where a Verify 
+job select the JobId to verified at schedule time rather than at runtime.
+This makes it difficult or impossible to schedule a verify just after
+a backup.
+
+Apply this patch to Bacula version 2.0.3 (probably 2.0.2 as well) with:
+
+  cd <bacula-source>
+  patch -p0 <2.0.3-verify.patch
+  make
+  ...
+  make install
+
+Index: src/dird/verify.c
+===================================================================
+--- src/dird/verify.c  (revision 4353)
++++ src/dird/verify.c  (working copy)
+@@ -1,22 +1,7 @@
+ /*
+- *
+- *   Bacula Director -- verify.c -- responsible for running file verification
+- *
+- *     Kern Sibbald, October MM
+- *
+- *  Basic tasks done here:
+- *     Open DB
+- *     Open connection with File daemon and pass him commands
+- *       to do the verify.
+- *     When the File daemon sends the attributes, compare them to
+- *       what is in the DB.
+- *
+- *   Version $Id$
+- */
+-/*
+    Bacula® - The Network Backup Solution
+-   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
++   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+    The main author of Bacula is Kern Sibbald, with contributions from
+    many others, a complete list can be found in the file AUTHORS.
+@@ -40,6 +25,21 @@
+    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+    Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ *
++ *   Bacula Director -- verify.c -- responsible for running file verification
++ *
++ *     Kern Sibbald, October MM
++ *
++ *  Basic tasks done here:
++ *     Open DB
++ *     Open connection with File daemon and pass him commands
++ *       to do the verify.
++ *     When the File daemon sends the attributes, compare them to
++ *       what is in the DB.
++ *
++ *   Version $Id$
++ */
+ #include "bacula.h"
+@@ -66,6 +66,22 @@
+  */
+ bool do_verify_init(JCR *jcr) 
+ {
++   return true;
++}
++
++
++/*
++ * Do a verification of the specified files against the Catlaog
++ *
++ *  Returns:  false on failure
++ *            true  on success
++ */
++bool do_verify(JCR *jcr)
++{
++   const char *level;
++   BSOCK   *fd;
++   int stat;
++   char ed1[100];
+    JOB_DBR jr;
+    JobId_t verify_jobid = 0;
+    const char *Name;
+@@ -74,12 +90,16 @@
+    memset(&jcr->previous_jr, 0, sizeof(jcr->previous_jr));
+-   Dmsg1(9, "bdird: created client %s record\n", jcr->client->hdr.name);
+-
+    /*
+-    * Find JobId of last job that ran.  E.g.
+-    *   for VERIFY_CATALOG we want the JobId of the last INIT.
+-    *   for VERIFY_VOLUME_TO_CATALOG, we want the JobId of the
++    * Find JobId of last job that ran. Note, we do this when
++    *   the job actually starts running, not at schedule time,
++    *   so that we find the last job that terminated before
++    *   this job runs rather than before it is scheduled. This
++    *   permits scheduling a Backup and Verify at the same time,
++    *   but with the Verify at a lower priority.
++    *
++    *   For VERIFY_CATALOG we want the JobId of the last INIT.
++    *   For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the
+     *       last backup Job.
+     */
+    if (jcr->JobLevel == L_VERIFY_CATALOG ||
+@@ -89,7 +109,7 @@
+       if (jcr->verify_job &&
+           (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
+            jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG)) {
+-         Name = jcr->verify_job->hdr.name;
++         Name = jcr->verify_job->name();  
+       } else {
+          Name = NULL;
+       }
+@@ -149,23 +169,7 @@
+       jcr->fileset = jcr->verify_job->fileset;
+    }
+    Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->JobLevel);
+-   return true;
+-}
+-
+-/*
+- * Do a verification of the specified files against the Catlaog
+- *
+- *  Returns:  false on failure
+- *            true  on success
+- */
+-bool do_verify(JCR *jcr)
+-{
+-   const char *level;
+-   BSOCK   *fd;
+-   int stat;
+-   char ed1[100];
+-
+    if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
+       Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
+       return false;
diff --git a/bacula/patches/2.2.0-restore.patch b/bacula/patches/2.2.0-restore.patch
new file mode 100644 (file)
index 0000000..4cccf12
--- /dev/null
@@ -0,0 +1,322 @@
+Index: fd_cmds.c
+===================================================================
+--- fd_cmds.c  (.../tags/Release-2.2.0/bacula/src/stored)      (revision 5508)
++++ fd_cmds.c  (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -1,18 +1,4 @@
+ /*
+- * This file handles commands from the File daemon.
+- *
+- *  Kern Sibbald, MM
+- *
+- * We get here because the Director has initiated a Job with
+- *  the Storage daemon, then done the same with the File daemon,
+- *  then when the Storage daemon receives a proper connection from
+- *  the File daemon, control is passed here to handle the
+- *  subsequent File daemon commands.
+- *
+- *   Version $Id$
+- *
+- */
+-/*
+    Bacula® - The Network Backup Solution
+    Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+@@ -39,6 +25,20 @@
+    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+    Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ * This file handles commands from the File daemon.
++ *
++ *  Kern Sibbald, MM
++ *
++ * We get here because the Director has initiated a Job with
++ *  the Storage daemon, then done the same with the File daemon,
++ *  then when the Storage daemon receives a proper connection from
++ *  the File daemon, control is passed here to handle the
++ *  subsequent File daemon commands.
++ *
++ *   Version $Id$
++ *
++ */
+ #include "bacula.h"
+ #include "stored.h"
+@@ -120,7 +120,7 @@
+    dir->set_jcr(jcr);
+    Dmsg1(120, "Start run Job=%s\n", jcr->Job);
+-   bnet_fsend(dir, Job_start, jcr->Job);
++   dir->fsend(Job_start, jcr->Job);
+    jcr->start_time = time(NULL);
+    jcr->run_time = jcr->start_time;
+    set_jcr_job_status(jcr, JS_Running);
+@@ -130,9 +130,9 @@
+    dequeue_messages(jcr);             /* send any queued messages */
+    set_jcr_job_status(jcr, JS_Terminated);
+    generate_daemon_event(jcr, "JobEnd");
+-   bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
++   dir->fsend(Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
+       edit_uint64(jcr->JobBytes, ec1));
+-   bnet_sig(dir, BNET_EOD);           /* send EOD to Director daemon */
++   dir->signal(BNET_EOD);             /* send EOD to Director daemon */
+    return;
+ }
+@@ -150,7 +150,7 @@
+       int stat;
+       /* Read command coming from the File daemon */
+-      stat = bnet_recv(fd);
++      stat = fd->recv();
+       if (is_bnet_stop(fd)) {         /* hardeof or error */
+          break;                       /* connection terminated */
+       }
+@@ -171,11 +171,11 @@
+       }
+       if (!found) {                   /* command not found */
+          Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
+-         bnet_fsend(fd, ferrmsg);
++         fd->fsend(ferrmsg);
+          break;
+       }
+    }
+-   bnet_sig(fd, BNET_TERMINATE);      /* signal to FD job is done */
++   fd->signal(BNET_TERMINATE);        /* signal to FD job is done */
+ }
+ /*
+@@ -195,10 +195,10 @@
+          return true;
+       } else {
+          bnet_suppress_error_messages(fd, 1); /* ignore errors at this point */
+-         bnet_fsend(fd, ERROR_append);
++         fd->fsend(ERROR_append);
+       }
+    } else {
+-      bnet_fsend(fd, NOT_opened);
++      fd->fsend(NOT_opened);
+    }
+    return false;
+ }
+@@ -209,11 +209,11 @@
+    Dmsg1(120, "store<file: %s", fd->msg);
+    if (!jcr->session_opened) {
+-      bnet_fsend(fd, NOT_opened);
++      fd->fsend(NOT_opened);
+       return false;
+    }
+    set_jcr_job_status(jcr, JS_Terminated);
+-   return bnet_fsend(fd, OK_end);
++   return fd->fsend(OK_end);
+ }
+@@ -227,14 +227,14 @@
+    Dmsg1(120, "Append open session: %s", fd->msg);
+    if (jcr->session_opened) {
+-      bnet_fsend(fd, NO_open);
++      fd->fsend(NO_open);
+       return false;
+    }
+    jcr->session_opened = true;
+    /* Send "Ticket" to File Daemon */
+-   bnet_fsend(fd, OK_open, jcr->VolSessionId);
++   fd->fsend(OK_open, jcr->VolSessionId);
+    Dmsg1(110, ">filed: %s", fd->msg);
+    return true;
+@@ -251,14 +251,14 @@
+    Dmsg1(120, "<filed: %s", fd->msg);
+    if (!jcr->session_opened) {
+-      bnet_fsend(fd, NOT_opened);
++      fd->fsend(NOT_opened);
+       return false;
+    }
+    /* Send final statistics to File daemon */
+-   bnet_fsend(fd, OK_close, jcr->JobStatus);
++   fd->fsend(OK_close, jcr->JobStatus);
+    Dmsg1(120, ">filed: %s", fd->msg);
+-   bnet_sig(fd, BNET_EOD);            /* send EOD to File daemon */
++   fd->signal(BNET_EOD);              /* send EOD to File daemon */
+    jcr->session_opened = false;
+    return true;
+@@ -279,7 +279,7 @@
+       Dmsg1(120, "<bfiled: %s", fd->msg);
+       return do_read_data(jcr);
+    } else {
+-      bnet_fsend(fd, NOT_opened);
++      fd->fsend(NOT_opened);
+       return false;
+    }
+ }
+@@ -296,7 +296,7 @@
+    Dmsg1(120, "%s\n", fd->msg);
+    if (jcr->session_opened) {
+-      bnet_fsend(fd, NO_open);
++      fd->fsend(NO_open);
+       return false;
+    }
+@@ -304,7 +304,7 @@
+          &jcr->read_VolSessionTime, &jcr->read_StartFile, &jcr->read_EndFile,
+          &jcr->read_StartBlock, &jcr->read_EndBlock) == 7) {
+       if (jcr->session_opened) {
+-         bnet_fsend(fd, NOT_opened);
++         fd->fsend(NOT_opened);
+          return false;
+       }
+       Dmsg4(100, "read_open_session got: JobId=%d Vol=%s VolSessId=%ld VolSessT=%ld\n",
+@@ -319,7 +319,7 @@
+    jcr->JobType = JT_RESTORE;
+    /* Send "Ticket" to File Daemon */
+-   bnet_fsend(fd, OK_open, jcr->VolSessionId);
++   fd->fsend(OK_open, jcr->VolSessionId);
+    Dmsg1(110, ">filed: %s", fd->msg);
+    return true;
+@@ -357,7 +357,7 @@
+       goto bail_out;
+    }
+    Dmsg0(10, "=== Bootstrap file ===\n");
+-   while (bnet_recv(sock) >= 0) {
++   while (sock->recv() >= 0) {
+        Dmsg1(10, "%s", sock->msg);
+        fputs(sock->msg, bs);
+    }
+@@ -378,10 +378,10 @@
+    free_pool_memory(jcr->RestoreBootstrap);
+    jcr->RestoreBootstrap = NULL;
+    if (!ok) {
+-      bnet_fsend(sock, ERROR_bootstrap);
++      sock->fsend(ERROR_bootstrap);
+       return false;
+    }
+-   return bnet_fsend(sock, OK_bootstrap);
++   return sock->fsend(OK_bootstrap);
+ }
+@@ -395,14 +395,14 @@
+    Dmsg1(120, "Read close session: %s\n", fd->msg);
+    if (!jcr->session_opened) {
+-      bnet_fsend(fd, NOT_opened);
++      fd->fsend(NOT_opened);
+       return false;
+    }
+-   /* Send final statistics to File daemon */
+-   bnet_fsend(fd, OK_close);
++   /* Send final close msg to File daemon */
++   fd->fsend(OK_close, jcr->JobStatus);
+    Dmsg1(160, ">filed: %s\n", fd->msg);
+-   bnet_sig(fd, BNET_EOD);          /* send EOD to File daemon */
++   fd->signal(BNET_EOD);            /* send EOD to File daemon */
+    jcr->session_opened = false;
+    return true;
+Index: stored_conf.c
+===================================================================
+--- stored_conf.c      (.../tags/Release-2.2.0/bacula/src/stored)      (revision 5508)
++++ stored_conf.c      (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -75,7 +75,7 @@
+    {"piddirectory",          store_dir,  ITEM(res_store.pid_directory), 0, ITEM_REQUIRED, 0},
+    {"subsysdirectory",       store_dir,  ITEM(res_store.subsys_directory), 0, 0, 0},
+    {"scriptsdirectory",      store_dir,  ITEM(res_store.scripts_directory), 0, 0, 0},
+-   {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 10},
++   {"maximumconcurrentjobs", store_pint, ITEM(res_store.max_concurrent_jobs), 0, ITEM_DEFAULT, 20},
+    {"heartbeatinterval",     store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0},
+    {"tlsenable",             store_bit,     ITEM(res_store.tls_enable), 1, 0, 0},
+    {"tlsrequire",            store_bit,     ITEM(res_store.tls_require), 1, 0, 0},
+Index: bscan.c
+===================================================================
+--- bscan.c    (.../tags/Release-2.2.0/bacula/src/stored)      (revision 5508)
++++ bscan.c    (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -120,7 +120,7 @@
+ "       -m                update media info in database\n"
+ "       -n <name>         specify the database name (default bacula)\n"
+ "       -u <user>         specify database user name (default bacula)\n"
+-"       -P <password      specify database password (default none)\n"
++"       -P <password>     specify database password (default none)\n"
+ "       -h <host>         specify database host (default NULL)\n"
+ "       -p                proceed inspite of I/O errors\n"
+ "       -r                list records\n"
+@@ -326,6 +326,7 @@
+       mdcr->StartFile = dcr->StartFile;
+       mdcr->EndBlock = dcr->EndBlock;
+       mdcr->EndFile = dcr->EndFile;
++      mdcr->VolMediaId = dcr->VolMediaId;
+       mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
+       if (!create_jobmedia_record(db, mjcr)) {
+          Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+@@ -476,6 +477,7 @@
+             dcr->VolFirstIndex = dcr->FileIndex = 0;
+             dcr->StartBlock = dcr->EndBlock = 0;
+             dcr->StartFile = dcr->EndFile = 0;
++            dcr->VolMediaId = 0;
+          }
+          Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
+@@ -1177,6 +1179,7 @@
+    dcr->EndBlock = dev->EndBlock;
+    dcr->EndFile  = dev->EndFile;
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    memset(&jmr, 0, sizeof(jmr));
+    jmr.JobId = mjcr->JobId;
+Index: askdir.c
+===================================================================
+--- askdir.c   (.../tags/Release-2.2.0/bacula/src/stored)      (revision 5508)
++++ askdir.c   (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -398,7 +398,7 @@
+       dcr->StartFile, dcr->EndFile,
+       dcr->StartBlock, dcr->EndBlock, 
+       dcr->Copy, dcr->Stripe, 
+-      edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
++      edit_uint64(dcr->VolMediaId, ed1));
+     Dmsg1(100, ">dird: %s", dir->msg);
+    if (bnet_recv(dir) <= 0) {
+       Dmsg0(190, "create_jobmedia error bnet_recv\n");
+Index: dev.h
+===================================================================
+--- dev.h      (.../tags/Release-2.2.0/bacula/src/stored)      (revision 5508)
++++ dev.h      (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -447,6 +447,7 @@
+    uint32_t StartFile;                /* Start write file */
+    uint32_t StartBlock;               /* Start write block */
+    uint32_t EndBlock;                 /* Ending block written */
++   int64_t  VolMediaId;               /* MediaId */
+    int64_t job_spool_size;            /* Current job spool size */
+    int64_t max_job_spool_size;        /* Max job spool size */
+    char VolumeName[MAX_NAME_LENGTH];  /* Volume name */
+Index: block.c
+===================================================================
+--- block.c    (.../tags/Release-2.2.0/bacula/src/stored)      (revision 5508)
++++ block.c    (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -611,6 +611,7 @@
+       dev->block_num = dcr->EndBlock;
+       dev->file = dcr->EndFile;
+    }
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
+       dcr->VolFirstIndex = block->FirstIndex;
+    }
+@@ -1098,6 +1099,7 @@
+       dev->block_num = dcr->EndBlock;
+       dev->file = dcr->EndFile;
+    }
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    dev->file_addr += block->read_len;
+    dev->file_size += block->read_len;
diff --git a/bacula/patches/2.2.1-restore.patch b/bacula/patches/2.2.1-restore.patch
new file mode 100644 (file)
index 0000000..2550584
--- /dev/null
@@ -0,0 +1,117 @@
+Index: fd_cmds.c
+===================================================================
+--- fd_cmds.c  (.../tags/Release-2.2.1/bacula/src/stored)      (revision 5508)
++++ fd_cmds.c  (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -1,18 +1,4 @@
+ /*
+- * This file handles commands from the File daemon.
+- *
+- *  Kern Sibbald, MM
+- *
+- * We get here because the Director has initiated a Job with
+- *  the Storage daemon, then done the same with the File daemon,
+- *  then when the Storage daemon receives a proper connection from
+- *  the File daemon, control is passed here to handle the
+- *  subsequent File daemon commands.
+- *
+- *   Version $Id$
+- *
+- */
+-/*
+    Bacula® - The Network Backup Solution
+    Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+@@ -39,6 +25,20 @@
+    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+    Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ * This file handles commands from the File daemon.
++ *
++ *  Kern Sibbald, MM
++ *
++ * We get here because the Director has initiated a Job with
++ *  the Storage daemon, then done the same with the File daemon,
++ *  then when the Storage daemon receives a proper connection from
++ *  the File daemon, control is passed here to handle the
++ *  subsequent File daemon commands.
++ *
++ *   Version $Id$
++ *
++ */
+ #include "bacula.h"
+ #include "stored.h"
+Index: bscan.c
+===================================================================
+--- bscan.c    (.../tags/Release-2.2.1/bacula/src/stored)      (revision 5508)
++++ bscan.c    (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -326,6 +326,7 @@
+       mdcr->StartFile = dcr->StartFile;
+       mdcr->EndBlock = dcr->EndBlock;
+       mdcr->EndFile = dcr->EndFile;
++      mdcr->VolMediaId = dcr->VolMediaId;
+       mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
+       if (!create_jobmedia_record(db, mjcr)) {
+          Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+@@ -476,6 +477,7 @@
+             dcr->VolFirstIndex = dcr->FileIndex = 0;
+             dcr->StartBlock = dcr->EndBlock = 0;
+             dcr->StartFile = dcr->EndFile = 0;
++            dcr->VolMediaId = 0;
+          }
+          Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
+@@ -1177,6 +1179,7 @@
+    dcr->EndBlock = dev->EndBlock;
+    dcr->EndFile  = dev->EndFile;
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    memset(&jmr, 0, sizeof(jmr));
+    jmr.JobId = mjcr->JobId;
+Index: askdir.c
+===================================================================
+--- askdir.c   (.../tags/Release-2.2.1/bacula/src/stored)      (revision 5508)
++++ askdir.c   (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -398,7 +398,7 @@
+       dcr->StartFile, dcr->EndFile,
+       dcr->StartBlock, dcr->EndBlock, 
+       dcr->Copy, dcr->Stripe, 
+-      edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
++      edit_uint64(dcr->VolMediaId, ed1));
+     Dmsg1(100, ">dird: %s", dir->msg);
+    if (bnet_recv(dir) <= 0) {
+       Dmsg0(190, "create_jobmedia error bnet_recv\n");
+Index: dev.h
+===================================================================
+--- dev.h      (.../tags/Release-2.2.1/bacula/src/stored)      (revision 5508)
++++ dev.h      (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -447,6 +447,7 @@
+    uint32_t StartFile;                /* Start write file */
+    uint32_t StartBlock;               /* Start write block */
+    uint32_t EndBlock;                 /* Ending block written */
++   int64_t  VolMediaId;               /* MediaId */
+    int64_t job_spool_size;            /* Current job spool size */
+    int64_t max_job_spool_size;        /* Max job spool size */
+    char VolumeName[MAX_NAME_LENGTH];  /* Volume name */
+Index: block.c
+===================================================================
+--- block.c    (.../tags/Release-2.2.1/bacula/src/stored)      (revision 5508)
++++ block.c    (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -611,6 +611,7 @@
+       dev->block_num = dcr->EndBlock;
+       dev->file = dcr->EndFile;
+    }
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
+       dcr->VolFirstIndex = block->FirstIndex;
+    }
+@@ -1098,6 +1099,7 @@
+       dev->block_num = dcr->EndBlock;
+       dev->file = dcr->EndFile;
+    }
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    dev->file_addr += block->read_len;
+    dev->file_size += block->read_len;
diff --git a/bacula/patches/2.2.2-restore.patch b/bacula/patches/2.2.2-restore.patch
new file mode 100644 (file)
index 0000000..c061e4c
--- /dev/null
@@ -0,0 +1,117 @@
+Index: fd_cmds.c
+===================================================================
+--- fd_cmds.c  (.../tags/Release-2.2.2/bacula/src/stored)      (revision 5508)
++++ fd_cmds.c  (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -1,18 +1,4 @@
+ /*
+- * This file handles commands from the File daemon.
+- *
+- *  Kern Sibbald, MM
+- *
+- * We get here because the Director has initiated a Job with
+- *  the Storage daemon, then done the same with the File daemon,
+- *  then when the Storage daemon receives a proper connection from
+- *  the File daemon, control is passed here to handle the
+- *  subsequent File daemon commands.
+- *
+- *   Version $Id$
+- *
+- */
+-/*
+    Bacula® - The Network Backup Solution
+    Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+@@ -39,6 +25,20 @@
+    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+    Switzerland, email:ftf@fsfeurope.org.
+ */
++/*
++ * This file handles commands from the File daemon.
++ *
++ *  Kern Sibbald, MM
++ *
++ * We get here because the Director has initiated a Job with
++ *  the Storage daemon, then done the same with the File daemon,
++ *  then when the Storage daemon receives a proper connection from
++ *  the File daemon, control is passed here to handle the
++ *  subsequent File daemon commands.
++ *
++ *   Version $Id$
++ *
++ */
+ #include "bacula.h"
+ #include "stored.h"
+Index: bscan.c
+===================================================================
+--- bscan.c    (.../tags/Release-2.2.2/bacula/src/stored)      (revision 5508)
++++ bscan.c    (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -326,6 +326,7 @@
+       mdcr->StartFile = dcr->StartFile;
+       mdcr->EndBlock = dcr->EndBlock;
+       mdcr->EndFile = dcr->EndFile;
++      mdcr->VolMediaId = dcr->VolMediaId;
+       mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
+       if (!create_jobmedia_record(db, mjcr)) {
+          Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
+@@ -476,6 +477,7 @@
+             dcr->VolFirstIndex = dcr->FileIndex = 0;
+             dcr->StartBlock = dcr->EndBlock = 0;
+             dcr->StartFile = dcr->EndFile = 0;
++            dcr->VolMediaId = 0;
+          }
+          Pmsg1(000, _("VOL_LABEL: OK for Volume: %s\n"), mr.VolumeName);
+@@ -1177,6 +1179,7 @@
+    dcr->EndBlock = dev->EndBlock;
+    dcr->EndFile  = dev->EndFile;
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    memset(&jmr, 0, sizeof(jmr));
+    jmr.JobId = mjcr->JobId;
+Index: askdir.c
+===================================================================
+--- askdir.c   (.../tags/Release-2.2.2/bacula/src/stored)      (revision 5508)
++++ askdir.c   (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -398,7 +398,7 @@
+       dcr->StartFile, dcr->EndFile,
+       dcr->StartBlock, dcr->EndBlock, 
+       dcr->Copy, dcr->Stripe, 
+-      edit_uint64(dcr->dev->VolCatInfo.VolMediaId, ed1));
++      edit_uint64(dcr->VolMediaId, ed1));
+     Dmsg1(100, ">dird: %s", dir->msg);
+    if (bnet_recv(dir) <= 0) {
+       Dmsg0(190, "create_jobmedia error bnet_recv\n");
+Index: dev.h
+===================================================================
+--- dev.h      (.../tags/Release-2.2.2/bacula/src/stored)      (revision 5508)
++++ dev.h      (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -447,6 +447,7 @@
+    uint32_t StartFile;                /* Start write file */
+    uint32_t StartBlock;               /* Start write block */
+    uint32_t EndBlock;                 /* Ending block written */
++   int64_t  VolMediaId;               /* MediaId */
+    int64_t job_spool_size;            /* Current job spool size */
+    int64_t max_job_spool_size;        /* Max job spool size */
+    char VolumeName[MAX_NAME_LENGTH];  /* Volume name */
+Index: block.c
+===================================================================
+--- block.c    (.../tags/Release-2.2.2/bacula/src/stored)      (revision 5508)
++++ block.c    (.../branches/Branch-2.2/bacula/src/stored)     (revision 5508)
+@@ -611,6 +611,7 @@
+       dev->block_num = dcr->EndBlock;
+       dev->file = dcr->EndFile;
+    }
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
+       dcr->VolFirstIndex = block->FirstIndex;
+    }
+@@ -1098,6 +1099,7 @@
+       dev->block_num = dcr->EndBlock;
+       dev->file = dcr->EndFile;
+    }
++   dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
+    dev->file_addr += block->read_len;
+    dev->file_size += block->read_len;
diff --git a/bacula/patches/2.2.3-tls.patch b/bacula/patches/2.2.3-tls.patch
new file mode 100644 (file)
index 0000000..c65132e
--- /dev/null
@@ -0,0 +1,43 @@
+
+ This patch was supplied by Landon Fuller and corrects a bug that
+ caused high CPU usage when connecting from bconsole to the Director.
+ This fixes bug #944.
+
+ Apply this patch to version 2.2.3 (it should work with any 2.2.x 
+ version with:
+
+  cd <bacula-source>
+  patch -p0 <2.2.3-tls.patch
+  ./configure (your options)
+  make
+  ...
+  make install
+
+Index: src/lib/tls.c
+===================================================================
+--- src/lib/tls.c      (revision 5507)
++++ src/lib/tls.c      (working copy)
+@@ -622,13 +622,21 @@
+          break;
+       case SSL_ERROR_WANT_READ:
++         /* If we timeout on a select, this will be unset */
++         FD_SET((unsigned)bsock->m_fd, &fdset);
++         tv.tv_sec = 10;
++         tv.tv_usec = 0;
++         /* Block until we can read */
++         select(fdmax, &fdset, NULL, NULL, &tv);
++         break;
++
+       case SSL_ERROR_WANT_WRITE:
+          /* If we timeout on a select, this will be unset */
+          FD_SET((unsigned)bsock->m_fd, &fdset);
+          tv.tv_sec = 10;
+          tv.tv_usec = 0;
+-         /* Block until we can read or write */
+-         select(fdmax, NULL, &fdset, &fdset, &tv);
++         /* Block until we can write */
++         select(fdmax, NULL, &fdset, NULL, &tv);
+          break;
+       case SSL_ERROR_ZERO_RETURN:
index 26d8df332e98c7724290aa8ce1553134fa72d5e6..26c03c1f520c37967f88100b464ea5db4c3cbb38 100644 (file)
@@ -622,13 +622,21 @@ static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, b
          break;
 
       case SSL_ERROR_WANT_READ:
+         /* If we timeout on a select, this will be unset */
+         FD_SET((unsigned)bsock->m_fd, &fdset);
+         tv.tv_sec = 10;
+         tv.tv_usec = 0;
+         /* Block until we can read */
+         select(fdmax, &fdset, NULL, NULL, &tv);
+         break;
+
       case SSL_ERROR_WANT_WRITE:
          /* If we timeout on a select, this will be unset */
          FD_SET((unsigned)bsock->m_fd, &fdset);
          tv.tv_sec = 10;
          tv.tv_usec = 0;
-         /* Block until we can read or write */
-         select(fdmax, NULL, &fdset, &fdset, &tv);
+         /* Block until we can write */
+         select(fdmax, NULL, &fdset, NULL, &tv);
          break;
 
       case SSL_ERROR_ZERO_RETURN:
index fa5c650271aec0f251c64bbe51a4d4fa93a8429d..3e941770b27e7aa3344ae122988529d741b41187 100644 (file)
@@ -1,7 +1,14 @@
               Technical notes on version 2.2
 
 General:
+12Sep07
+kes  Implement patch supplied by Landon to fix bug #944 where using
+     TLS with bconsole uses 99+% of the CPU.
+kes  Move patches into patches directory.
+
 Release Version 2.2.3
+kes  Note, you need GTK >= 2.10 to be able to link the Tray Monitor
+     program.
 09Sep07
 kes  Fix bug #935, and probably also bug #903 where files were not
      restored. MediaId was not properly set in JobMedia record after