Use userpw_matches() for username matching so #uid works for

sudoRunAsUser.
This commit is contained in:
Todd C. Miller
2013-02-21 07:03:52 -05:00
parent b929dd3c46
commit 1da8739c38
2 changed files with 3 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003-2011 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 2003-2013 Todd C. Miller <Todd.Miller@courtesan.com>
* *
* This code is derived from software contributed by Aaron Spangler. * This code is derived from software contributed by Aaron Spangler.
* *
@@ -746,7 +746,7 @@ sudo_ldap_check_runas_user(LDAP *ld, LDAPMessage *entry)
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
if (strcasecmp(val, runas_pw->pw_name) == 0) if (userpw_matches(val, runas_pw->pw_name, runas_pw))
ret = true; ret = true;
break; break;
} }

View File

@@ -471,7 +471,7 @@ sudo_sss_check_runas_user(struct sudo_sss_handle *handle, struct sss_sudo_rule *
/* FALLTHROUGH */ /* FALLTHROUGH */
sudo_debug_printf(SUDO_DEBUG_DEBUG, "FALLTHROUGH"); sudo_debug_printf(SUDO_DEBUG_DEBUG, "FALLTHROUGH");
default: default:
if (strcasecmp(val, runas_pw->pw_name) == 0) { if (userpw_matches(val, runas_pw->pw_name, runas_pw)) {
sudo_debug_printf(SUDO_DEBUG_DEBUG, sudo_debug_printf(SUDO_DEBUG_DEBUG,
"%s == %s (pw_name) => match", val, runas_pw->pw_name); "%s == %s (pw_name) => match", val, runas_pw->pw_name);
ret = true; ret = true;