From: Kern Sibbald Date: Sun, 17 Jul 2016 16:21:41 +0000 (+0200) Subject: Fail when multipl mailcommand and other strings are specified in .conf. Fixes bug... X-Git-Tag: Release-7.4.3~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ddf4e3c6aefc9299a79049b78c6540d6059610c8;p=bacula%2Fbacula Fail when multipl mailcommand and other strings are specified in .conf. Fixes bug #2222 --- diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index 26d81408da..dad7f5c30b 100644 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -369,8 +369,8 @@ void store_name(LEX *lc, RES_ITEM *item, int index, int pass) free_pool_memory(msg); /* Store the name both pass 1 and pass 2 */ if (*(item->value)) { - scan_err2(lc, _("Attempt to redefine name \"%s\" to \"%s\"."), - *(item->value), lc->str); + scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"), + item->name, *(item->value), lc->str, lc->line_no, lc->line); return; } *(item->value) = bstrdup(lc->str); @@ -388,6 +388,11 @@ void store_strname(LEX *lc, RES_ITEM *item, int index, int pass) lex_get_token(lc, T_NAME); /* Store the name */ if (pass == 1) { + if (*(item->value)) { + scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"), + item->name, *(item->value), lc->str, lc->line_no, lc->line); + return; + } *(item->value) = bstrdup(lc->str); } scan_to_eol(lc); @@ -399,6 +404,11 @@ void store_str(LEX *lc, RES_ITEM *item, int index, int pass) { lex_get_token(lc, T_STRING); if (pass == 1) { + if (*(item->value)) { + scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"), + item->name, *(item->value), lc->str, lc->line_no, lc->line); + return; + } *(item->value) = bstrdup(lc->str); } scan_to_eol(lc); @@ -417,6 +427,11 @@ void store_dir(LEX *lc, RES_ITEM *item, int index, int pass) if (lc->str[0] != '|') { do_shell_expansion(lc->str, sizeof_pool_memory(lc->str)); } + if (*(item->value)) { + scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"), + item->name, *(item->value), lc->str, lc->line_no, lc->line); + return; + } *(item->value) = bstrdup(lc->str); } scan_to_eol(lc); @@ -442,6 +457,11 @@ void store_password(LEX *lc, RES_ITEM *item, int index, int pass) sprintf(&sig[j], "%02x", digest[i]); j += 2; } + if (*(item->value)) { + scan_err5(lc, _("Attempt to redefine \"%s\" from \"%s\" to \"%s\" referenced on line %d : %s\n"), + item->name, *(item->value), lc->str, lc->line_no, lc->line); + return; + } *(item->value) = bstrdup(sig); } scan_to_eol(lc);