Don't try to access the NIS `master' maps unless we have superuser

privileges.  To do so may cause the NIS server to log spurious and
annoying `access denied' messages.

Reported by:	Philip Paeps <philip@paeps.cx>
Sponsored by:	DARPA, Network Associates Laboratories
This commit is contained in:
Jacques Vidrine 2003-04-21 13:57:58 +00:00
parent 1ecb38a365
commit d3fc864f93

View File

@ -941,13 +941,15 @@ nis_map(char *domain, enum nss_lookup_type how, char *buffer, size_t bufsize,
int rv, order;
*master = 0;
if (snprintf(buffer, bufsize, "master.passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
rv = yp_order(domain, buffer, &order);
if (rv == 0) {
*master = 1;
return (NS_SUCCESS);
if (geteuid() == 0) {
if (snprintf(buffer, bufsize, "master.passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
rv = yp_order(domain, buffer, &order);
if (rv == 0) {
*master = 1;
return (NS_SUCCESS);
}
}
if (snprintf(buffer, bufsize, "passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)