From: Todd C. Miller Date: Tue, 23 Oct 2012 15:57:07 +0000 (-0400) Subject: Add SUDOERS_NO_SEQ define to allow ${seq} to be disabled. X-Git-Tag: SUDO_1_8_7~1^2~372 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb037caffcd3a5e256e136443695e9a1d82e2e1b;p=sudo Add SUDOERS_NO_SEQ define to allow ${seq} to be disabled. --- diff --git a/plugins/sudoers/iolog_path.c b/plugins/sudoers/iolog_path.c index 71030e4b5..fec178142 100644 --- a/plugins/sudoers/iolog_path.c +++ b/plugins/sudoers/iolog_path.c @@ -49,26 +49,7 @@ struct path_escape { size_t (*copy_fn)(char *, size_t, char *); }; -static size_t fill_seq(char *, size_t, char *); -static size_t fill_user(char *, size_t, char *); -static size_t fill_group(char *, size_t, char *); -static size_t fill_runas_user(char *, size_t, char *); -static size_t fill_runas_group(char *, size_t, char *); -static size_t fill_hostname(char *, size_t, char *); -static size_t fill_command(char *, size_t, char *); - -/* Note: "seq" must be first in the list. */ -static struct path_escape io_path_escapes[] = { - { "seq", fill_seq }, - { "user", fill_user }, - { "group", fill_group }, - { "runas_user", fill_runas_user }, - { "runas_group", fill_runas_group }, - { "hostname", fill_hostname }, - { "command", fill_command }, - { NULL, NULL } -}; - +#ifndef SUDOERS_NO_SEQ static size_t fill_seq(char *str, size_t strsize, char *logdir) { @@ -86,6 +67,7 @@ fill_seq(char *str, size_t strsize, char *logdir) debug_return_size_t(strsize); /* handle non-standard snprintf() */ debug_return_size_t(len); } +#endif /* SUDOERS_NO_SEQ */ static size_t fill_user(char *str, size_t strsize, char *unused) @@ -155,6 +137,20 @@ fill_command(char *str, size_t strsize, char *unused) debug_return_size_t(strlcpy(str, user_base, strsize)); } +/* Note: "seq" must be first in the list. */ +static struct path_escape io_path_escapes[] = { +#ifndef SUDOERS_NO_SEQ + { "seq", fill_seq }, +#endif + { "user", fill_user }, + { "group", fill_group }, + { "runas_user", fill_runas_user }, + { "runas_group", fill_runas_group }, + { "hostname", fill_hostname }, + { "command", fill_command }, + { NULL, NULL } +}; + /* * Concatenate dir + file, expanding any escape sequences. * Returns the concatenated path and sets slashp point to