For "sudo -l" start a new line if the runas list changes to make
the output easier to read.
This commit is contained in:
@@ -359,12 +359,11 @@ sudo_file_display_priv_short(struct passwd *pw, struct userspec *us,
|
|||||||
if (hostlist_matches(&priv->hostlist) != ALLOW)
|
if (hostlist_matches(&priv->hostlist) != ALLOW)
|
||||||
continue;
|
continue;
|
||||||
prev_cs = NULL;
|
prev_cs = NULL;
|
||||||
lbuf_append(lbuf, " ");
|
|
||||||
tq_foreach_fwd(&priv->cmndlist, cs) {
|
tq_foreach_fwd(&priv->cmndlist, cs) {
|
||||||
if (cs != tq_first(&priv->cmndlist))
|
|
||||||
lbuf_append(lbuf, ", ");
|
|
||||||
if (RUNAS_CHANGED(cs, prev_cs)) {
|
if (RUNAS_CHANGED(cs, prev_cs)) {
|
||||||
lbuf_append(lbuf, "(");
|
if (cs != tq_first(&priv->cmndlist))
|
||||||
|
lbuf_append(lbuf, "\n");
|
||||||
|
lbuf_append(lbuf, " (");
|
||||||
if (!tq_empty(&cs->runasuserlist)) {
|
if (!tq_empty(&cs->runasuserlist)) {
|
||||||
tq_foreach_fwd(&cs->runasuserlist, m) {
|
tq_foreach_fwd(&cs->runasuserlist, m) {
|
||||||
if (m != tq_first(&cs->runasuserlist))
|
if (m != tq_first(&cs->runasuserlist))
|
||||||
@@ -392,6 +391,8 @@ sudo_file_display_priv_short(struct passwd *pw, struct userspec *us,
|
|||||||
tags.nopasswd = UNSPEC;
|
tags.nopasswd = UNSPEC;
|
||||||
tags.log_input = UNSPEC;
|
tags.log_input = UNSPEC;
|
||||||
tags.log_output = UNSPEC;
|
tags.log_output = UNSPEC;
|
||||||
|
} else if (cs != tq_first(&priv->cmndlist)) {
|
||||||
|
lbuf_append(lbuf, ", ");
|
||||||
}
|
}
|
||||||
sudo_file_append_cmnd(cs, &tags, lbuf);
|
sudo_file_append_cmnd(cs, &tags, lbuf);
|
||||||
prev_cs = cs;
|
prev_cs = cs;
|
||||||
|
@@ -277,7 +277,7 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
|
|||||||
if (fstat(STDOUT_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode))
|
if (fstat(STDOUT_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode))
|
||||||
cols = 0;
|
cols = 0;
|
||||||
lbuf_init(&defs, output, 4, NULL, cols);
|
lbuf_init(&defs, output, 4, NULL, cols);
|
||||||
lbuf_init(&privs, output, long_list ? 8 : 4, NULL, cols);
|
lbuf_init(&privs, output, 8, NULL, cols);
|
||||||
|
|
||||||
/* Display defaults from all sources. */
|
/* Display defaults from all sources. */
|
||||||
lbuf_append(&defs, _("Matching Defaults entries for %s on this host:\n"),
|
lbuf_append(&defs, _("Matching Defaults entries for %s on this host:\n"),
|
||||||
|
Reference in New Issue
Block a user