summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorrstone <rstone@FreeBSD.org>2015-01-28 21:51:34 +0000
committerrstone <rstone@FreeBSD.org>2015-01-28 21:51:34 +0000
commitcd9291a5a74493ffad3256f24264e438a91f915d (patch)
tree9b7ae2fb8087b33a3125b577de331809799eae9b /usr.sbin
parent0392db24d466366f8e3feb0cb9dc97451e21fdd7 (diff)
downloadFreeBSD-src-cd9291a5a74493ffad3256f24264e438a91f915d.zip
FreeBSD-src-cd9291a5a74493ffad3256f24264e438a91f915d.tar.gz
MFC r277352:
When mountd is creating sockets, it iterates over all addresses specified in the "hosts" array and eventually looks up the network address with getaddrinfo(). At one point it checks for a numeric address and if it sees one, it sets a hint parameter to force getaddrinfo to interpret the host as a numeric address. However that hint is not cleared for subsequent iterations of the loop and if any hosts seen after this point are host names, getaddrinfo will fail on the name. The result of this bug is that you cannot pass a host name to the -h flag. Unfortunately, the first iteration will either process ::1 or 127.0.0.1, so the flag is set on the first iteration and all host names will fail to be processed. The same bug applies to rpc.lockd and rpc.statd, so fix them too. Differential Revision: https://reviews.freebsd.org/D1507 Reported by: Dylan Martin MFC after: 1 week Sponsored by: Sandvine Inc.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mountd/mountd.c3
-rw-r--r--usr.sbin/rpc.lockd/lockd.c2
-rw-r--r--usr.sbin/rpc.statd/statd.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 6e4085c..87794c3 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -627,7 +627,6 @@ create_service(struct netconfig *nconf)
/* Get mountd's address on this transport */
memset(&hints, 0, sizeof hints);
- hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
@@ -644,6 +643,8 @@ create_service(struct netconfig *nconf)
sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */
mallocd_res = 0;
+ hints.ai_flags = AI_PASSIVE;
+
/*
* XXX - using RPC library internal functions.
*/
diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c
index b3402ff..72a5e25 100644
--- a/usr.sbin/rpc.lockd/lockd.c
+++ b/usr.sbin/rpc.lockd/lockd.c
@@ -522,7 +522,6 @@ create_service(struct netconfig *nconf)
/* Get rpc.statd's address on this transport */
memset(&hints, 0, sizeof hints);
- hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
@@ -538,6 +537,7 @@ create_service(struct netconfig *nconf)
out_of_mem();
sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */
mallocd_res = 0;
+ hints.ai_flags = AI_PASSIVE;
/*
* XXX - using RPC library internal functions.
diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c
index ff537f8..faa8513 100644
--- a/usr.sbin/rpc.statd/statd.c
+++ b/usr.sbin/rpc.statd/statd.c
@@ -343,7 +343,6 @@ create_service(struct netconfig *nconf)
/* Get rpc.statd's address on this transport */
memset(&hints, 0, sizeof hints);
- hints.ai_flags = AI_PASSIVE;
hints.ai_family = si.si_af;
hints.ai_socktype = si.si_socktype;
hints.ai_protocol = si.si_proto;
@@ -359,6 +358,7 @@ create_service(struct netconfig *nconf)
out_of_mem();
sock_fd[sock_fdcnt++] = -1; /* Set invalid for now. */
mallocd_res = 0;
+ hints.ai_flags = AI_PASSIVE;
/*
* XXX - using RPC library internal functions.
OpenPOWER on IntegriCloud