2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Trying to use "+=" or "-=" operators on a non-list is an error.

Previously, they were simply treated as "=" for non-lists.
This commit is contained in:
Todd C. Miller
2021-07-29 09:29:10 -06:00
parent 2ea773ed1f
commit 1032fca5b8

View File

@@ -243,6 +243,20 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
}
}
/* Only lists support append/remove. */
if ((op == '+' || op == '-') && (def->type & T_MASK) != T_LIST) {
if (!quiet) {
if (line > 0) {
sudo_warnx(U_("%s:%d:%d: invalid operator \"%c=\" for \"%s\""),
file, line, column, op, def->name);
} else {
sudo_warnx(U_("%s: invalid operator \"%c=\" for \"%s\""),
file, op, def->name);
}
}
debug_return_bool(false);
}
switch (def->type & T_MASK) {
case T_LOGFAC:
rc = store_syslogfac(val, &def->sd_un);