1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

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:
Jacques Vidrine 2003-04-18 21:13:35 +00:00
parent 8b94a0616d
commit a9ceaa9dc8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113691

View File

@ -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);
}