From: Todd C. Miller Date: Tue, 6 Mar 2018 20:42:56 +0000 (-0700) Subject: In sudoers_format_userspecs make the separator optional and silence X-Git-Tag: SUDO_1_8_23^2~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb31544fcc0940c392ef1eff1a700650fd9b666f;p=sudo In sudoers_format_userspecs make the separator optional and silence a printf format warning. --- diff --git a/plugins/sudoers/fmtsudoers.c b/plugins/sudoers/fmtsudoers.c index 3116996b9..4ab7fb0b4 100644 --- a/plugins/sudoers/fmtsudoers.c +++ b/plugins/sudoers/fmtsudoers.c @@ -291,14 +291,14 @@ sudoers_format_userspec(struct sudo_lbuf *lbuf, struct userspec *us, */ bool sudoers_format_userspecs(struct sudo_lbuf *lbuf, struct userspec_list *usl, - const char *sep, bool expand_aliases, bool flush) + const char *separator, bool expand_aliases, bool flush) { struct userspec *us; debug_decl(sudoers_format_userspecs, SUDOERS_DEBUG_UTIL) TAILQ_FOREACH(us, usl, entries) { - if (us != TAILQ_FIRST(usl)) - sudo_lbuf_append(lbuf, sep); + if (separator != NULL && us != TAILQ_FIRST(usl)) + sudo_lbuf_append(lbuf, "%s", separator); if (!sudoers_format_userspec(lbuf, us, expand_aliases)) break; sudo_lbuf_print(lbuf); diff --git a/plugins/sudoers/parse.h b/plugins/sudoers/parse.h index 31dfc7fac..dd5ac9ef1 100644 --- a/plugins/sudoers/parse.h +++ b/plugins/sudoers/parse.h @@ -323,6 +323,6 @@ bool sudoers_format_default_line(struct sudo_lbuf *lbuf, struct defaults *d, str bool sudoers_format_member(struct sudo_lbuf *lbuf, struct member *m, const char *separator, int alias_type); bool sudoers_format_privilege(struct sudo_lbuf *lbuf, struct privilege *priv, bool expand_aliases); bool sudoers_format_userspec(struct sudo_lbuf *lbuf, struct userspec *us, bool expand_aliases); -bool sudoers_format_userspecs(struct sudo_lbuf *lbuf, struct userspec_list *usl, const char *sep, bool expand_aliases, bool flush); +bool sudoers_format_userspecs(struct sudo_lbuf *lbuf, struct userspec_list *usl, const char *separator, bool expand_aliases, bool flush); #endif /* SUDOERS_PARSE_H */