Move code to display a cmndspec in long form to display_cmndspec_long().
This commit is contained in:
@@ -140,32 +140,25 @@ new_long_entry(struct cmndspec *cs, struct cmndspec *prev_cs)
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
||||
static int
|
||||
display_priv_long(struct sudoers_parse_tree *parse_tree, struct passwd *pw,
|
||||
struct userspec *us, struct sudo_lbuf *lbuf)
|
||||
static void
|
||||
display_cmndspec_long(struct sudoers_parse_tree *parse_tree, struct passwd *pw,
|
||||
struct userspec *us, struct privilege *priv, struct cmndspec *cs,
|
||||
struct cmndspec *prev_cs, struct sudo_lbuf *lbuf)
|
||||
{
|
||||
struct privilege *priv;
|
||||
int nfound = 0;
|
||||
debug_decl(display_priv_long, SUDOERS_DEBUG_PARSER);
|
||||
|
||||
TAILQ_FOREACH(priv, &us->privileges, entries) {
|
||||
struct cmndspec *cs, *prev_cs;
|
||||
|
||||
if (hostlist_matches(parse_tree, pw, &priv->hostlist) != ALLOW)
|
||||
continue;
|
||||
prev_cs = NULL;
|
||||
TAILQ_FOREACH(cs, &priv->cmndlist, entries) {
|
||||
struct defaults *d;
|
||||
struct member *m;
|
||||
debug_decl(display_cmndspec_long, SUDOERS_DEBUG_PARSER);
|
||||
|
||||
if (new_long_entry(cs, prev_cs)) {
|
||||
unsigned int olen;
|
||||
|
||||
if (prev_cs != NULL)
|
||||
sudo_lbuf_append(lbuf, "\n");
|
||||
if (priv->ldap_role != NULL) {
|
||||
sudo_lbuf_append(lbuf, _("\nLDAP Role: %s\n"),
|
||||
sudo_lbuf_append(lbuf, _("LDAP Role: %s\n"),
|
||||
priv->ldap_role);
|
||||
} else {
|
||||
sudo_lbuf_append(lbuf, _("\nSudoers entry: %s\n"),
|
||||
sudo_lbuf_append(lbuf, _("Sudoers entry: %s\n"),
|
||||
us->file);
|
||||
}
|
||||
sudo_lbuf_append(lbuf, "%s", _(" RunAsUsers: "));
|
||||
@@ -263,6 +256,27 @@ display_priv_long(struct sudoers_parse_tree *parse_tree, struct passwd *pw,
|
||||
sudoers_format_member(lbuf, parse_tree, cs->cmnd, "\n\t",
|
||||
CMNDALIAS);
|
||||
sudo_lbuf_append(lbuf, "\n");
|
||||
|
||||
debug_return;
|
||||
}
|
||||
|
||||
static int
|
||||
display_priv_long(struct sudoers_parse_tree *parse_tree, struct passwd *pw,
|
||||
struct userspec *us, struct sudo_lbuf *lbuf)
|
||||
{
|
||||
struct privilege *priv;
|
||||
int nfound = 0;
|
||||
debug_decl(display_priv_long, SUDOERS_DEBUG_PARSER);
|
||||
|
||||
TAILQ_FOREACH(priv, &us->privileges, entries) {
|
||||
struct cmndspec *cs, *prev_cs;
|
||||
|
||||
if (hostlist_matches(parse_tree, pw, &priv->hostlist) != ALLOW)
|
||||
continue;
|
||||
prev_cs = NULL;
|
||||
sudo_lbuf_append(lbuf, "\n");
|
||||
TAILQ_FOREACH(cs, &priv->cmndlist, entries) {
|
||||
display_cmndspec_long(parse_tree, pw, us, priv, cs, prev_cs, lbuf);
|
||||
prev_cs = cs;
|
||||
nfound++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user