getpwnam(3) may return NULL.
Requested by: nork Reviewed by: Takeharu KATO <takeharu1219__at__ybb.ne.jp>, nork MFC after: 1 week
This commit is contained in:
parent
8e19e21cb3
commit
985728498a
@ -149,7 +149,7 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
static char *cleanenv;
|
||||
struct passwd *pwd;
|
||||
struct passwd *pwd = NULL;
|
||||
struct pam_conv conv = { openpam_ttyconv, NULL };
|
||||
enum tristate iscsh;
|
||||
login_cap_t *lc;
|
||||
@ -255,8 +255,9 @@ main(int argc, char *argv[])
|
||||
/* get current login name, real uid and shell */
|
||||
ruid = getuid();
|
||||
username = getlogin();
|
||||
pwd = getpwnam(username);
|
||||
if (username == NULL || pwd == NULL || pwd->pw_uid != ruid)
|
||||
if (username != NULL)
|
||||
pwd = getpwnam(username);
|
||||
if (pwd == NULL || pwd->pw_uid != ruid)
|
||||
pwd = getpwuid(ruid);
|
||||
if (pwd == NULL) {
|
||||
#ifdef USE_BSM_AUDIT
|
||||
|
Loading…
Reference in New Issue
Block a user