]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Add FD event sequence order prepared by Eric -- for RunScripts.
authorKern Sibbald <kern@sibbald.com>
Fri, 16 Feb 2007 08:43:26 +0000 (08:43 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 16 Feb 2007 08:43:26 +0000 (08:43 +0000)
kes  Fix 12am/pm bug as reported in bug #782.

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

bacula/src/dird/run_conf.c
bacula/src/filed/backup.c
bacula/src/filed/job.c
bacula/src/filed/restore.c
bacula/src/version.h
bacula/technotes-2.0

index 334ef8a184db405da0657a14324a09de9cd16528..b92ee123e74d384bcc9b232af57a6d743d27cc90 100644 (file)
@@ -1,16 +1,7 @@
-/*
- *
- *  Configuration parser for Director Run Configuration
- *   directives, which are part of the Schedule Resource
- *
- *     Kern Sibbald, May MM
- *
- *     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.
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ *
+ *  Configuration parser for Director Run Configuration
+ *   directives, which are part of the Schedule Resource
+ *
+ *     Kern Sibbald, May MM
+ *
+ *     Version $Id$
+ */
 
 #include "bacula.h"
 #include "dird.h"
@@ -66,7 +66,7 @@ enum e_state {
 };
 
 struct s_keyw {
-  const char *name;                           /* keyword */
+  const char *name;                   /* keyword */
   enum e_state state;                 /* parser state */
   int code;                           /* state value */
 };
@@ -337,7 +337,8 @@ void store_run(LEX *lc, RES_ITEM *item, int index, int pass)
    set_defaults();
 
    for ( ; token != T_EOL; (token = lex_get_token(lc, T_ALL))) {
-      int len, pm = 0;
+      int len; 
+      bool pm = false;
       switch (token) {
       case T_NUMBER:
          state = s_mday;
@@ -361,6 +362,7 @@ void store_run(LEX *lc, RES_ITEM *item, int index, int pass)
             code = atoi(lc->str+1);
             if (code < 0 || code > 53) {
                scan_err0(lc, _("Week number out of range (0-53)"));
+              /* NOT REACHED */
             }
             state = s_woy;            /* week of year */
             break;
@@ -442,24 +444,31 @@ void store_run(LEX *lc, RES_ITEM *item, int index, int pass)
          len = strlen(p);
          if (len > 2 && p[len-1] == 'm') {
             if (p[len-2] == 'a') {
-               pm = 0;
+               pm = false;
             } else if (p[len-2] == 'p') {
-               pm = 1;
+               pm = true;
             } else {
                scan_err0(lc, _("Bad time specification."));
                /* NOT REACHED */
             }
          } else {
-            pm = 0;
+            pm = false;
          }
          code2 = atoi(p);             /* pick up minutes */
+         /* 
+          * Note, according to NIST, 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 we define 
+          *  12am as 00:00 and 12pm as 12:00.
+          */
          if (pm) {
             /* Convert to 24 hour time */
-            if (code == 12) {
-               code -= 12;
-            } else {
+            if (code != 12) {
                code += 12;
             }
+         /* am */
+         } else if (code == 12) {
+            code -= 12;
          }
          if (code < 0 || code > 23 || code2 < 0 || code2 > 59) {
             scan_err0(lc, _("Bad time specification."));
index 8b63b528a4aed05b1e36e26fd7f943b791e17702..f33afb4b72a4187dd41db17f47e8c98ebbfb2ab6 100644 (file)
@@ -124,7 +124,7 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
 
       /* Get the session data size */
       if (crypto_session_encode(jcr->pki_session, (uint8_t *)0, &size) == false) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occured while encrypting the stream.\n"));
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n"));
          return 0;
       }
 
@@ -136,7 +136,7 @@ bool blast_data_to_storage_daemon(JCR *jcr, char *addr)
 
       /* Encode session data */
       if (crypto_session_encode(jcr->pki_session, jcr->pki_session_encoded, &size) == false) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occured while encrypting the stream.\n"));
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while encrypting the stream.\n"));
          return 0;
       }
 
@@ -364,7 +364,7 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level)
       if (jcr->pki_sign) {
          signing_digest = crypto_digest_new(signing_algorithm);
 
-         /* Full-stop if a failure occured initializing the signature digest */
+         /* Full-stop if a failure occurred initializing the signature digest */
          if (signing_digest == NULL) {
             Jmsg(jcr, M_NOTSAVED, 0, _("%s signature digest initialization failed\n"),
                stream_to_ascii(signing_algorithm));
@@ -531,13 +531,13 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level)
       }
 
       if (crypto_sign_add_signer(sig, signing_digest, jcr->pki_keypair) == false) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occured while signing the stream.\n"));
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
          return 0;
       }
 
       /* Get signature size */
       if (crypto_sign_encode(sig, NULL, &size) == false) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occured while signing the stream.\n"));
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
          return 0;
       }
 
@@ -550,7 +550,7 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level)
 
       /* Encode signature data */
       if (crypto_sign_encode(sig, buf, &size) == false) {
-         Jmsg(jcr, M_FATAL, 0, _("An error occured while signing the stream.\n"));
+         Jmsg(jcr, M_FATAL, 0, _("An error occurred while signing the stream.\n"));
          return 0;
       }
 
index d1b4ea607ba41552d92c34bbd47cd3d190ba43fb..039570a5dff99871973dea7f012f0995f9f4a05e 100644 (file)
@@ -1,11 +1,3 @@
-/*
- *  Bacula File Daemon Job processing
- *
- *    Kern Sibbald, October MM
- *
- *   Version $Id$
- *
- */
 /*
    Bacula® - The Network Backup Solution
 
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 */
+/*
+ *  Bacula File Daemon Job processing
+ *
+ *    Kern Sibbald, October MM
+ *
+ *   Version $Id$
+ *
+ */
 
 #include "bacula.h"
 #include "filed.h"
@@ -179,7 +179,23 @@ static char read_close[]   = "read close session %d\n";
  *   Accept commands one at a time from the Director
  *     and execute them.
  *
+ * Concerning ClientRunBefore/After, the sequence of events
+ * is rather critical. If they are not done in the right
+ * order one can easily get FD->SD timeouts if the script
+ * runs a long time.
+ *
+ * The current sequence of events is:
+ *  1. Dir starts job with FD
+ *  2. Dir connects to SD
+ *  3. Dir connects to FD
+ *  4. FD connects to SD
+ *  5. FD gets/runs ClientRunBeforeJob and sends ClientRunAfterJob
+ *  6. Dir sends include/exclude
+ *  7. FD sends data to SD
+ *  8. SD/FD disconnects while SD despools data and attributes (optionnal)
+ *  9. FD runs ClientRunAfterJob
  */
+
 void *handle_client_request(void *dirp)
 {
    int i;
index e7d0f1bfde16432b6826512a0cc44f62267dc850..81c991e01247484ddcb128a34620f47a59fd6352 100644 (file)
@@ -417,7 +417,7 @@ void do_restore(JCR *jcr)
             break;
          default:
             /* Shouldn't happen */
-            Jmsg1(jcr, M_ERROR, 0, _("An error occured while decoding encrypted session data stream: %s\n"), crypto_strerror(cryptoerr));
+            Jmsg1(jcr, M_ERROR, 0, _("An error occurred while decoding encrypted session data stream: %s\n"), crypto_strerror(cryptoerr));
             break;
          }
 
index 12815331444fbd358c564562e66f1ad142670b7a..66498fde1c06ab6ee512d851c402efd1a9d88a76 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.0.3"
-#define BDATE   "15 February 2007"
-#define LSMDATE "15Feb07"
+#define BDATE   "16 February 2007"
+#define LSMDATE "16Feb07"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2007"       /* year for copyright messages in progs */
index 54260b80d6b7a87f25429ab34ed4973b50a56da8..135375ab0e31b9e2b454bddefc2deffa96fe3170 100644 (file)
@@ -1,6 +1,9 @@
               Technical notes on version 2.0
 
 General:
+16Feb07
+kes  Add FD event sequence order prepared by Eric -- for RunScripts.
+kes  Fix 12am/pm bug as reported in bug #782.
 15Feb07
 kes  Add quick disconnect FD code from 2.1.4 to 2.0.3.  This code
      causes the SD to release the FD as soon as the FD has sent