From: Eric Bollengier Date: Tue, 19 Dec 2006 20:56:46 +0000 (+0000) Subject: ebl fix nasty runscript configuration parsing bug X-Git-Tag: Release-2.0.0~104 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=71c364d82bc4afcdcd697bd92e9cf44a166ba964;p=bacula%2Fbacula ebl fix nasty runscript configuration parsing bug git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3813 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 7c2636f768..74db53766c 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -1691,19 +1691,35 @@ static void store_short_runscript(LEX *lc, RES_ITEM *item, int index, int pass) scan_to_eol(lc); } +/* Store a bool in a bit field without modifing res_all.hdr + * We can also add an option to store_bool to skip res_all.hdr + */ +void store_runscript_bool(LEX *lc, RES_ITEM *item, int index, int pass) +{ + lex_get_token(lc, T_NAME); + if (strcasecmp(lc->str, "yes") == 0 || strcasecmp(lc->str, "true") == 0) { + *(bool *)(item->value) = true; + } else if (strcasecmp(lc->str, "no") == 0 || strcasecmp(lc->str, "false") == 0) { + *(bool *)(item->value) = false; + } else { + scan_err2(lc, _("Expect %s, got: %s"), "YES, NO, TRUE, or FALSE", lc->str); /* YES and NO must not be translated */ + } + scan_to_eol(lc); +} + /* * new RunScript items - * name handler value code flags default_value + * name handler value code flags default_value */ static RES_ITEM runscript_items[] = { - {"command", store_runscript_cmd, {(char **)&res_runscript}, 0, ITEM_REQUIRED, 0}, - {"target", store_runscript_target, {(char **)&res_runscript}, 0, 0, 0}, - {"runsonsuccess", store_bool, {(char **)&res_runscript.on_success}, 0, 0, 0}, - {"runsonfailure", store_bool, {(char **)&res_runscript.on_failure}, 0, 0, 0}, - {"abortjobonerror", store_bool, {(char **)&res_runscript.abort_on_error}, 0, 0, 0}, - {"runswhen", store_runscript_when, {(char **)&res_runscript.when}, 0, 0, 0}, - {"runsonclient", store_runscript_target, {(char **)&res_runscript}, 0, 0, 0}, /* TODO */ - {NULL, NULL, {0}, 0, 0, 0} + {"command", store_runscript_cmd, {(char **)&res_runscript}, 0, ITEM_REQUIRED, 0}, + {"target", store_runscript_target,{(char **)&res_runscript}, 0, 0, 0}, + {"runsonsuccess", store_runscript_bool, {(char **)&res_runscript.on_success},0, 0, 0}, + {"runsonfailure", store_runscript_bool, {(char **)&res_runscript.on_failure},0, 0, 0}, + {"abortjobonerror",store_runscript_bool, {(char **)&res_runscript.abort_on_error},0, 0, 0}, + {"runswhen", store_runscript_when, {(char **)&res_runscript.when}, 0, 0, 0}, + {"runsonclient", store_runscript_target,{(char **)&res_runscript}, 0, 0, 0}, /* TODO */ + {NULL, NULL, {0}, 0, 0, 0} }; /* diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index 918d20244d..e1b2d026ee 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,6 +1,8 @@ Technical notes on version 1.39 General: +19Dec06 +ebl Fix runscript configuration parsing bug. 17Dec06 kes Add ENABLE_NLS (as suggested by Eric) to correct NLS problems. Remove NLS kludge from baconfig.h. This fixes bug #729.