summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2003-04-21 13:57:58 +0000
committernectar <nectar@FreeBSD.org>2003-04-21 13:57:58 +0000
commit6d1b148a91ae695db0154d852b8e5fdf101578a3 (patch)
tree7bac1ce99a32dd1cb3735dbe21974a6c29c06e66 /lib
parent7e0ecb534587f485ba69144706c1a08189e4da51 (diff)
downloadFreeBSD-src-6d1b148a91ae695db0154d852b8e5fdf101578a3.zip
FreeBSD-src-6d1b148a91ae695db0154d852b8e5fdf101578a3.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getpwent.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index ec8b5bc..ae0b177 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -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)
OpenPOWER on IntegriCloud