2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 22:35:10 +00:00

For ldap/sssd, include defaults in the generate privilege unless

we are listing in short mode (in which case we convert them to tags
if possible).  Fixes a problem where sudoOptions were not being
applied to the command.
This commit is contained in:
Todd C. Miller
2018-08-02 14:45:00 -06:00
parent 171686c422
commit 608574a219
6 changed files with 9 additions and 9 deletions

View File

@@ -1196,7 +1196,7 @@ ldap_to_sudoers(LDAP *ld, struct ldap_result *lres,
priv = sudo_ldap_role_to_priv(cn, hosts, runasusers, runasgroups,
cmnds, opts, notbefore ? notbefore[0]->bv_val : NULL,
notafter ? notafter[0]->bv_val : NULL, false, long_list,
notafter ? notafter[0]->bv_val : NULL, false, !short_list,
berval_iter);
cleanup:

View File

@@ -540,10 +540,10 @@ sudo_display_userspecs(struct sudoers_parse_tree *parse_tree, struct passwd *pw,
if (userlist_matches(parse_tree, pw, &us->users) != ALLOW)
continue;
if (long_list)
nfound += display_priv_long(parse_tree, pw, us, lbuf);
else
if (short_list)
nfound += display_priv_short(parse_tree, pw, us, lbuf);
else
nfound += display_priv_long(parse_tree, pw, us, lbuf);
}
if (sudo_lbuf_error(lbuf))
debug_return_int(-1);

View File

@@ -904,8 +904,8 @@ sudoers_policy_list(int argc, char * const argv[], int verbose,
SET(sudo_mode, MODE_CHECK);
else
SET(sudo_mode, MODE_LIST);
if (verbose)
long_list = 1;
if (!verbose)
short_list = 1;
if (list_user) {
list_pw = sudo_getpwnam(list_user);
if (list_pw == NULL) {

View File

@@ -356,7 +356,7 @@ sss_to_sudoers(struct sudo_sss_handle *handle,
priv = sudo_ldap_role_to_priv(cn, hosts, runasusers, runasgroups,
cmnds, opts, notbefore ? notbefore[0] : NULL,
notafter ? notafter[0] : NULL, false, long_list, val_array_iter);
notafter ? notafter[0] : NULL, false, !short_list, val_array_iter);
cleanup:
if (cn_array != NULL)

View File

@@ -85,7 +85,7 @@ static bool tty_present(void);
*/
struct sudo_user sudo_user;
struct passwd *list_pw;
int long_list;
bool short_list;
uid_t timestamp_uid;
gid_t timestamp_gid;
#ifdef HAVE_BSD_AUTH_H

View File

@@ -377,7 +377,7 @@ int sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add
void sudoers_cleanup(void);
extern struct sudo_user sudo_user;
extern struct passwd *list_pw;
extern int long_list;
extern bool short_list;
extern int sudo_mode;
extern uid_t timestamp_uid;
extern gid_t timestamp_gid;