When a uname->id translation fails, close the password file and retry
CVS patchset: 1746 CVS date: 1997/07/17 19:18:33
This commit is contained in:
parent
b00397df11
commit
007b4c33a2
15
lib/misc.c
15
lib/misc.c
|
@ -213,10 +213,12 @@ int unameToUid(char * thisUname, uid_t * uid) {
|
|||
|
||||
pwent = getpwnam(thisUname);
|
||||
if (!pwent) {
|
||||
return -1;
|
||||
} else {
|
||||
lastUid = pwent->pw_uid;
|
||||
endpwent();
|
||||
pwent = getpwnam(thisUname);
|
||||
if (!pwent) return -1;
|
||||
}
|
||||
|
||||
lastUid = pwent->pw_uid;
|
||||
}
|
||||
|
||||
*uid = lastUid;
|
||||
|
@ -251,10 +253,11 @@ int gnameToGid(char * thisGname, gid_t * gid) {
|
|||
|
||||
grent = getgrnam(thisGname);
|
||||
if (!grent) {
|
||||
return -1;
|
||||
} else {
|
||||
lastGid = grent->gr_gid;
|
||||
endgrent();
|
||||
grent = getgrnam(thisGname);
|
||||
if (!grent) return -1;
|
||||
}
|
||||
lastGid = grent->gr_gid;
|
||||
}
|
||||
|
||||
*gid = lastGid;
|
||||
|
|
Loading…
Reference in New Issue