and sssd backends to match the sudoers file backend. Introduces
the runas_user_set() macro to improve readability. Previously,
runas_pw was set late, now it is set before checking sudoers.
bool ret = false;
debug_decl(sudo_ldap_check_runas_user, SUDOERS_DEBUG_LDAP)
- if (!runas_pw)
+ if (!runas_user_set())
debug_return_int(UNSPEC);
/* get the runas user from the entry */
* and a runas group was specified.
* This logic assumes that we cache and refcount passwd structs.
*/
- if (!(runas_pw == sudo_user.pw && runas_gr != NULL)) {
+ if (runas_user_set()) {
/* If no runas user or runas group listed in sudoers, use default. */
if (user_list == NULL && group_list == NULL) {
debug_return_int(userpw_matches(def_runas_default,
#undef IMPLIED
#define IMPLIED 2
+/*
+ * Returns true if a runas user was specified on the command line.
+ */
+#define runas_user_set() (runas_pw != sudo_user.pw || runas_gr == NULL)
+
/*
* Initialize all tags to UNSPEC.
*/
int ret = false, i;
debug_decl(sudo_sss_check_runas_user, SUDOERS_DEBUG_SSSD);
- if (!runas_pw)
+ if (!runas_user_set())
debug_return_int(UNSPEC);
/* get the runas user from the entry */