]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/parse_conf.c
o fix : restore a crypted stream on a fd witch doen't define keys cause
[bacula/bacula] / bacula / src / lib / parse_conf.c
index 238307312bfef307266ed5b4ed1f8f647bd5aa23..d5a0ceafdaf23a1176312376a7600da13ca2f07f 100755 (executable)
@@ -50,8 +50,6 @@
 
 #include "bacula.h"
 
-extern int debug_level;
-
 /* Each daemon has a slightly different set of
  * resources, so it will define the following
  * global values.
@@ -61,15 +59,14 @@ extern int r_last;
 extern RES_TABLE resources[];
 extern RES **res_head;
 
-#ifdef HAVE_WIN32
+#if defined(_MSC_VER)
 // work around visual studio name manling preventing external linkage since res_all
 // is declared as a different type when instantiated.
 extern "C" CURES res_all;
-extern "C" int res_all_size;
 #else
 extern  CURES res_all;
-extern int res_all_size;
 #endif
+extern int res_all_size;
 
 extern brwlock_t res_lock;            /* resource lock */
 
@@ -98,7 +95,8 @@ RES_ITEM msgs_items[] = {
    {"director",    store_msgs, ITEM(res_msgs), MD_DIRECTOR, 0, 0},
    {"console",     store_msgs, ITEM(res_msgs), MD_CONSOLE,  0, 0},
    {"operator",    store_msgs, ITEM(res_msgs), MD_OPERATOR, 0, 0},
-   {NULL, NULL,    NULL,       0,              0}
+   {"catalog",     store_msgs, ITEM(res_msgs), MD_CATALOG,  0, 0},
+   {NULL,          NULL,       {0},       0, 0, 0}
 };
 
 struct s_mtypes {
@@ -121,6 +119,7 @@ static struct s_mtypes msg_types[] = {
    {"restored",      M_RESTORED},
    {"security",      M_SECURITY},
    {"alert",         M_ALERT},
+   {"volmgmt",       M_VOLMGMT},
    {"all",           M_MAX+1},
    {NULL,            0}
 };
@@ -231,6 +230,7 @@ void store_msgs(LEX *lc, RES_ITEM *item, int index, int pass)
       case MD_STDERR:
       case MD_SYSLOG:              /* syslog */
       case MD_CONSOLE:
+      case MD_CATALOG:
          scan_types(lc, (MSGS *)(item->value), item->code, NULL, NULL);
          break;
       case MD_OPERATOR:            /* send to operator */
@@ -759,7 +759,7 @@ enum parse_state {
  *  scan_error handler is to die on an error.
  */
 int
-parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error)
+parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error, int err_type)
 {
    LEX *lc = NULL;
    int token, i, pass;
@@ -784,6 +784,7 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error)
          } else {
             lex_set_default_error_handler(lc);
          }
+         lex_set_error_handler_error_type(lc, err_type) ;
          bstrncpy(lc->str, cf, sizeof(lc->str));
          lc->fname = lc->str;
          scan_err2(lc, _("Cannot open config file \"%s\": %s\n"),
@@ -791,6 +792,7 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error)
          free(lc);
          return 0;
       }
+      lex_set_error_handler_error_type(lc, err_type) ;
       while ((token=lex_get_token(lc, T_ALL)) != T_EOF) {
          Dmsg1(900, "parse got token=%s\n", lex_tok_to_str(token));
          switch (state) {
@@ -857,6 +859,9 @@ parse_config(const char *cf, LEX_ERROR_HANDLER *scan_error)
                level--;
                state = p_none;
                Dmsg0(900, "T_EOB => define new resource\n");
+               if (res_all.hdr.name == NULL) {
+                  scan_err0(lc, _("Name not specified for resource"));
+               }
                save_resource(res_type, items, pass);  /* save resource */
                break;