1
0
forked from rpms/rpcbind
rpcbind/rpcbind-0.1.5-nss-config.patch

49 lines
1.6 KiB
Diff

commit 77f7556878d1fe03dc3e285c97dd822db38f618c
Author: Ulrich Drepper <drepper@redhat.com>
Date: Fri Jun 27 13:29:20 2008 -0400
Due to an installation mistake (somehow rpm messed up) I ended up with an passwd
file which didn't have a rpc entry. This meant that during startup the
getpwnam() call to determine the details for user rpc caused the normal process
for passwd lookups to be followed. For me this meant after looking at
/etc/passwd the lookup tried to use NIS. This of course deadlocked since as
part of the NIS lookup rpcbind has to be contacted.
The workaround is quite simple: use __nss_configure_lookup() to restrict
the lookup.
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/src/rpcbind.c b/src/rpcbind.c
index fb75517..550fefd 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -155,6 +155,13 @@ main(int argc, char *argv[])
fprintf(stderr, "Sorry. You are not superuser\n");
exit(1);
}
+
+ /*
+ * Make sure we use the local service file
+ * for service lookkups
+ */
+ __nss_configure_lookup("services", "files");
+
nc_handle = setnetconfig(); /* open netconfig file */
if (nc_handle == NULL) {
syslog(LOG_ERR, "could not read /etc/netconfig");
@@ -212,6 +219,12 @@ main(int argc, char *argv[])
struct passwd *p;
char *id = runasdaemon ? RUN_AS : rpcbinduser;
+ /*
+ * Make sure we use the local password file
+ * for these lookups.
+ */
+ __nss_configure_lookup("passwd", "files");
+
if((p = getpwnam(id)) == NULL) {
syslog(LOG_ERR, "cannot get uid of '%s': %m", id);
exit(1);