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

When printing a member name, quote sudoers special characters unless

it is a UID/GID, in which case we print the '#' unquoted.
This commit is contained in:
Todd C. Miller
2018-02-02 14:29:17 -07:00
parent f4ce2b25fc
commit df08d0d8f4

View File

@@ -883,7 +883,14 @@ print_member_int(struct sudo_lbuf *lbuf, char *name, int type, int negated,
}
/* FALLTHROUGH */
default:
sudo_lbuf_append(lbuf, "%s%s", negated ? "!" : "", name);
/* Do not quote UID/GID, all others get quoted. */
if (name[0] == '#' &&
name[strspn(name + 1, "0123456789") + 1] == '\0') {
sudo_lbuf_append(lbuf, "%s%s", negated ? "!" : "", name);
} else {
sudo_lbuf_append_quoted(lbuf, SUDOERS_QUOTED, "%s%s",
negated ? "!" : "", name);
}
break;
}
debug_return;