Follow-up to revision 1.73: set _PWF_FILES when `compat' source is used
but user is found in local file. Reported by: Shizuka Kudo <shizukakudo_99@yahoo.com> Sponsored by: DARPA, Network Associates Laboratories
This commit is contained in:
parent
8b94a0616d
commit
a9ceaa9dc8
@ -1436,8 +1436,9 @@ compat_passwd(void *retval, void *mdata, va_list ap)
|
||||
size_t bufsize;
|
||||
uid_t uid;
|
||||
uint32_t store;
|
||||
int rv, stayopen, *errnop;
|
||||
int rv, from_compat, stayopen, *errnop;
|
||||
|
||||
from_compat = 0;
|
||||
name = NULL;
|
||||
uid = (uid_t)-1;
|
||||
how = (enum nss_lookup_type)mdata;
|
||||
@ -1516,8 +1517,10 @@ compat_passwd(void *retval, void *mdata, va_list ap)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (rv & NS_TERMINATE)
|
||||
if (rv & NS_TERMINATE) {
|
||||
from_compat = 1;
|
||||
goto fin;
|
||||
}
|
||||
key.data = keybuf;
|
||||
rv = NS_NOTFOUND;
|
||||
while (st->keynum >= 0) {
|
||||
@ -1626,8 +1629,14 @@ compat_passwd(void *retval, void *mdata, va_list ap)
|
||||
(void)st->db->close(st->db);
|
||||
st->db = NULL;
|
||||
}
|
||||
if (rv == NS_SUCCESS && retval != NULL)
|
||||
*(struct passwd **)retval = pwd;
|
||||
if (rv == NS_SUCCESS) {
|
||||
if (!from_compat) {
|
||||
pwd->pw_fields &= ~_PWF_SOURCE;
|
||||
pwd->pw_fields |= _PWF_FILES;
|
||||
}
|
||||
if (retval != NULL)
|
||||
*(struct passwd **)retval = pwd;
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user