mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 06:15:37 +00:00
Add flag to sudo_pwdup that indicates whether or not to lookup the
shadow password. Will be used to a struct passwd that has the shadow password already filled in.
This commit is contained in:
@@ -176,8 +176,9 @@ sudo_getepw(pw)
|
||||
* that we care about. Fills in pw_passwd from shadow file if necessary.
|
||||
*/
|
||||
struct passwd *
|
||||
sudo_pwdup(pw)
|
||||
sudo_pwdup(pw, checkshadow)
|
||||
const struct passwd *pw;
|
||||
int checkshadow;
|
||||
{
|
||||
char *cp;
|
||||
const char *pw_passwd, *pw_shell;
|
||||
@@ -185,7 +186,7 @@ sudo_pwdup(pw)
|
||||
struct passwd *newpw;
|
||||
|
||||
/* Get shadow password if available. */
|
||||
pw_passwd = sudo_getepw(pw);
|
||||
pw_passwd = checkshadow ? sudo_getepw(pw) : pw->pw_passwd;
|
||||
|
||||
/* If shell field is empty, expand to _PATH_BSHELL. */
|
||||
pw_shell = (pw->pw_shell == NULL || pw->pw_shell[0] == '\0')
|
||||
@@ -279,7 +280,7 @@ sudo_getpwuid(uid)
|
||||
if ((pw = getpwuid(uid)) == NULL)
|
||||
return(NULL);
|
||||
else
|
||||
return(sudo_pwdup(pw));
|
||||
return(sudo_pwdup(pw, 1));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -295,5 +296,5 @@ sudo_getpwnam(name)
|
||||
if ((pw = getpwnam(name)) == NULL)
|
||||
return(NULL);
|
||||
else
|
||||
return(sudo_pwdup(pw));
|
||||
return(sudo_pwdup(pw, 1));
|
||||
}
|
||||
|
Reference in New Issue
Block a user