cvtsudoers: add -l option to log merge actions

The "-l logfile" option can be used to store a log of what
actions cvtsudoers took when merging multiple files.
For example, which aliases were renamed, which entries were overriden
or removed as duplicated.
This commit is contained in:
Todd C. Miller
2021-11-24 06:52:51 -07:00
parent ce9c6d17c5
commit 003f9550f1
6 changed files with 70 additions and 8 deletions

View File

@@ -477,7 +477,8 @@ print_defaults_json(struct json_container *jsonc,
TAILQ_FOREACH_SAFE(def, &parse_tree->defaults, entries, next) {
type = get_defaults_type(def);
if (type == -1) {
sudo_warnx(U_("unknown defaults entry \"%s\""), def->var);
log_warnx(U_("%s:%d:%d: unknown defaults entry \"%s\""),
def->file, def->line, def->column, def->var);
/* XXX - just pass it through as a string anyway? */
continue;
}
@@ -511,7 +512,8 @@ print_defaults_json(struct json_container *jsonc,
def = next;
type = get_defaults_type(def);
if (type == -1) {
sudo_warnx(U_("unknown defaults entry \"%s\""), def->var);
log_warnx(U_("%s:%d:%d: unknown defaults entry \"%s\""),
def->file, def->line, def->column, def->var);
/* XXX - just pass it through as a string anyway? */
break;
}
@@ -720,7 +722,8 @@ print_cmndspec_json(struct json_container *jsonc,
TAILQ_FOREACH(def, options, entries) {
int type = get_defaults_type(def);
if (type == -1) {
sudo_warnx(U_("unknown defaults entry \"%s\""), def->var);
log_warnx(U_("%s:%d:%d: unknown defaults entry \"%s\""),
def->file, def->line, def->column, def->var);
/* XXX - just pass it through as a string anyway? */
continue;
}