File 0007-The-use-of-AI_NUMERICHOST-in-init_transport-is-broke.patch of Package rpcbind.4752

From 18c451ad482debbe7dab00699f4df8b075cee112 Mon Sep 17 00:00:00 2001
From: Olaf Kirch <okir@suse.de>
Date: Tue, 20 Aug 2013 09:12:49 +0200
Subject: [PATCH 07/24] The use of AI_NUMERICHOST in init_transport() is
 broken.

In its current form, when seeing a dotted quad or a numeric IPv6 address,
it will clear all flags in hints.ai_flags (which has been set to AI_PASSIVE
a few lines above).

What this code should really be doing is to *set* AI_NUMERICHOST if and only
if it sees a numeric address.

Signed-off-by: Olaf Kirch <okir@suse.de>
---
 src/rpcbind.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/rpcbind.c b/src/rpcbind.c
index f562f7a..896d509 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -365,11 +365,13 @@ init_transport(struct netconfig *nconf)
 				    nconf->nc_netid);
 				return (1);
 			}
+
+			hints.ai_flags &= ~AI_NUMERICHOST;
 			switch (hints.ai_family) {
 			case AF_INET:
 				if (inet_pton(AF_INET, hosts[nhostsbak],
 				    host_addr) == 1) {
-					hints.ai_flags &= AI_NUMERICHOST;
+					hints.ai_flags |= AI_NUMERICHOST;
 				} else {
 					/*
 					 * Skip if we have an AF_INET6 adress.
@@ -382,7 +384,7 @@ init_transport(struct netconfig *nconf)
 			case AF_INET6:
 				if (inet_pton(AF_INET6, hosts[nhostsbak],
 				    host_addr) == 1) {
-					hints.ai_flags &= AI_NUMERICHOST;
+					hints.ai_flags |= AI_NUMERICHOST;
 				} else {
 					/*
 					 * Skip if we have an AF_INET adress.
-- 
1.7.12.4

openSUSE Build Service is sponsored by