]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/inc_conf.c
Make migration work with new subroutine
[bacula/bacula] / bacula / src / dird / inc_conf.c
index f6ef20d11597ff447e9b6004a74e5ad0bdd61245..034c338c6c1b37d94012d107bfeda992ea14a5a4 100644 (file)
@@ -7,11 +7,11 @@
  *     Version $Id$
  */
 /*
-   Copyright (C) 2003-2005 Kern Sibbald
+   Copyright (C) 2003-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
-   version 2 as ammended with additional clauses defined in the
+   version 2 as amended with additional clauses defined in the
    file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
@@ -23,7 +23,9 @@
 
 #include "bacula.h"
 #include "dird.h"
-#ifdef HAVE_REGEX_H
+#ifndef HAVE_REGEX_H
+#include "lib/regex.h"
+#else
 #include <regex.h>
 #endif
 
@@ -103,7 +105,7 @@ static RES_ITEM options_items[] = {
 enum {
    INC_KW_NONE,
    INC_KW_COMPRESSION,
-   INC_KW_SIGNATURE,
+   INC_KW_DIGEST,
    INC_KW_ENCRYPTION,
    INC_KW_VERIFY,
    INC_KW_ONEFS,
@@ -129,7 +131,7 @@ enum {
  */
 static struct s_kw FS_option_kw[] = {
    {"compression", INC_KW_COMPRESSION},
-   {"signature",   INC_KW_SIGNATURE},
+   {"signature",   INC_KW_DIGEST},
    {"encryption",  INC_KW_ENCRYPTION},
    {"verify",      INC_KW_VERIFY},
    {"onefs",       INC_KW_ONEFS},
@@ -163,8 +165,10 @@ struct s_fs_opt {
  * included files.
  */
 static struct s_fs_opt FS_options[] = {
-   {"md5",      INC_KW_SIGNATURE,    "M"},
-   {"sha1",     INC_KW_SIGNATURE,    "S"},
+   {"md5",      INC_KW_DIGEST,        "M"},
+   {"sha1",     INC_KW_DIGEST,        "S"},
+   {"sha256",   INC_KW_DIGEST,       "S2"},
+   {"sha512",   INC_KW_DIGEST,       "S3"},
    {"gzip",     INC_KW_COMPRESSION,  "Z6"},
    {"gzip1",    INC_KW_COMPRESSION,  "Z1"},
    {"gzip2",    INC_KW_COMPRESSION,  "Z2"},
@@ -246,7 +250,7 @@ static void scan_include_options(LEX *lc, int keyword, char *opts, int optlen)
          }
       }
       if (i != 0) {
-         scan_err1(lc, "Expected a FileSet option keyword, got:%s:", lc->str);
+         scan_err1(lc, _("Expected a FileSet option keyword, got:%s:"), lc->str);
       } else { /* add option */
          bstrncat(opts, option, optlen);
          Dmsg3(900, "Catopts=%s option=%s optlen=%d\n", opts, option,optlen);
@@ -315,7 +319,7 @@ static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass)
             if (!options) {
                token = lex_get_token(lc, T_SKIP_EOL);
                if (token != T_EQUALS) {
-                  scan_err1(lc, "expected an equals, got: %s", lc->str);
+                  scan_err1(lc, _("expected an equals, got: %s"), lc->str);
                }
             }
             /* Call item handler */
@@ -325,7 +329,7 @@ static void store_newinc(LEX *lc, RES_ITEM *item, int index, int pass)
          }
       }
       if (i >=0) {
-         scan_err1(lc, "Keyword %s not permitted in this resource", lc->str);
+         scan_err1(lc, _("Keyword %s not permitted in this resource"), lc->str);
       }
    }
    if (pass == 1) {
@@ -529,21 +533,25 @@ static void store_fname(LEX *lc, RES_ITEM *item, int index, int pass)
       /* Pickup Filename string
        */
       switch (token) {
-         case T_IDENTIFIER:
-         case T_UNQUOTED_STRING:
-         case T_QUOTED_STRING:
-            if (res_all.res_fs.have_MD5) {
-               MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len);
-            }
-            incexe = &res_incexe;
-            if (incexe->name_list.size() == 0) {
-               incexe->name_list.init(10, true);
-            }
-            incexe->name_list.append(bstrdup(lc->str));
-            Dmsg1(900, "Add to name_list %s\n", lc->str);
-            break;
-         default:
-            scan_err1(lc, _("Expected a filename, got: %s"), lc->str);
+      case T_IDENTIFIER:
+      case T_UNQUOTED_STRING:
+         if (strchr(lc->str, '\\')) {
+            scan_err1(lc, _("Backslash found. Use forward slashes or quote the string.: %s\n"), lc->str);
+            /* NOT REACHED */
+         }
+      case T_QUOTED_STRING:
+         if (res_all.res_fs.have_MD5) {
+            MD5Update(&res_all.res_fs.md5c, (unsigned char *)lc->str, lc->str_len);
+         }
+         incexe = &res_incexe;
+         if (incexe->name_list.size() == 0) {
+            incexe->name_list.init(10, true);
+         }
+         incexe->name_list.append(bstrdup(lc->str));
+         Dmsg1(900, "Add to name_list %s\n", lc->str);
+         break;
+      default:
+         scan_err1(lc, _("Expected a filename, got: %s"), lc->str);
       }
    }
    scan_to_eol(lc);
@@ -559,7 +567,7 @@ static void options_res(LEX *lc, RES_ITEM *item, int index, int pass)
 
    token = lex_get_token(lc, T_SKIP_EOL);
    if (token != T_BOB) {
-      scan_err1(lc, "Expecting open brace. Got %s", lc->str);
+      scan_err1(lc, _("Expecting open brace. Got %s"), lc->str);
    }
 
    if (pass == 1) {
@@ -580,7 +588,7 @@ static void options_res(LEX *lc, RES_ITEM *item, int index, int pass)
          if (strcasecmp(options_items[i].name, lc->str) == 0) {
             token = lex_get_token(lc, T_SKIP_EOL);
             if (token != T_EQUALS) {
-               scan_err1(lc, "expected an equals, got: %s", lc->str);
+               scan_err1(lc, _("expected an equals, got: %s"), lc->str);
             }
             /* Call item handler */
             options_items[i].handler(lc, &options_items[i], i, pass);
@@ -589,7 +597,7 @@ static void options_res(LEX *lc, RES_ITEM *item, int index, int pass)
          }
       }
       if (i >=0) {
-         scan_err1(lc, "Keyword %s not permitted in this resource", lc->str);
+         scan_err1(lc, _("Keyword %s not permitted in this resource"), lc->str);
       }
    }
 }
@@ -614,7 +622,7 @@ static void store_opts(LEX *lc, RES_ITEM *item, int index, int pass)
       }
    }
    if (keyword == INC_KW_NONE) {
-      scan_err1(lc, "Expected a FileSet keyword, got: %s", lc->str);
+      scan_err1(lc, _("Expected a FileSet keyword, got: %s"), lc->str);
    }
    /* Now scan for the value */
    scan_include_options(lc, keyword, inc_opts, sizeof(inc_opts));