summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-06-27 13:29:20 -0400
committerSteve Dickson <steved@redhat.com>2008-06-27 13:29:20 -0400
commit77f7556878d1fe03dc3e285c97dd822db38f618c (patch)
tree4bda883ba33c470012536321dc226a9412431710
parentf7d18d511767e892e52932f8c6f6e49755a8e5bc (diff)
downloadrpcbind-77f7556878d1fe03dc3e285c97dd822db38f618c.tar.gz
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>
-rw-r--r--src/rpcbind.c13
1 files changed, 13 insertions, 0 deletions
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);