When formatting as sudoers, flush the lbuf after each userspec.

This commit is contained in:
Todd C. Miller
2018-03-03 07:42:10 -07:00
parent 843213d3de
commit c9b70940cf
3 changed files with 4 additions and 3 deletions

View File

@@ -583,7 +583,7 @@ convert_sudoers_sudoers(const char *output_file, struct cvtsudoers_config *conf)
}
/* Print User_Specs */
if (!sudoers_format_userspecs(&lbuf, &userspecs, conf->expand_aliases))
if (!sudoers_format_userspecs(&lbuf, &userspecs, conf->expand_aliases, true))
goto done;
if (lbuf.len > 1) {
sudo_lbuf_print(&lbuf);

View File

@@ -285,7 +285,7 @@ sudoers_format_userspec(struct sudo_lbuf *lbuf, struct userspec *us,
*/
bool
sudoers_format_userspecs(struct sudo_lbuf *lbuf, struct userspec_list *usl,
bool expand_aliases)
bool expand_aliases, bool flush)
{
struct userspec *us;
debug_decl(sudoers_format_userspecs, SUDOERS_DEBUG_UTIL)
@@ -293,6 +293,7 @@ sudoers_format_userspecs(struct sudo_lbuf *lbuf, struct userspec_list *usl,
TAILQ_FOREACH(us, usl, entries) {
if (!sudoers_format_userspec(lbuf, us, expand_aliases))
break;
sudo_lbuf_print(lbuf);
}
debug_return_bool(!sudo_lbuf_error(lbuf));

View File

@@ -315,6 +315,6 @@ bool sudoers_format_default(struct sudo_lbuf *lbuf, struct defaults *d);
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, bool expand_aliases);
bool sudoers_format_userspecs(struct sudo_lbuf *lbuf, struct userspec_list *usl, bool expand_aliases, bool flush);
#endif /* SUDOERS_PARSE_H */