rpcbind/0023-Make-rpcinfo-p-support-IPv6-addresses-too.patch

48 lines
1.5 KiB
Diff
Raw Normal View History

From efe7c73ea490f9cd184fa974f1a4d67bd93d8269 Mon Sep 17 00:00:00 2001
From: Olaf Kirch <okir@suse.de>
Date: Mon, 20 Jan 2014 13:08:18 +0100
Subject: [PATCH 23/24] Make rpcinfo -p support IPv6 addresses, too
While this is not strictly necessary (you can use "rpcinfo <hostname>" instead),
some older scripts may rely on rpcinfo to work with just about any hostname.
Let's be gentle with them. It doesn't cost us much.
Signed-off-by: Olaf Kirch <okir@suse.de>
---
src/rpcinfo.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
index 0da5628..2981240 100644
--- a/src/rpcinfo.c
+++ b/src/rpcinfo.c
@@ -484,7 +484,6 @@ pmapdump (argc, argv)
int argc;
char **argv;
{
- struct sockaddr_in server_addr;
struct pmaplist *head = NULL;
int socket = RPC_ANYSOCK;
struct timeval minutetimeout;
@@ -502,10 +501,13 @@ pmapdump (argc, argv)
if (argc == 1)
{
host = argv[0];
- get_inet_address (&server_addr, host);
- server_addr.sin_port = htons (PMAPPORT);
- client = clnttcp_create (&server_addr, PMAPPROG, PMAPVERS,
- &socket, 50, 500);
+
+ /* This is a little bit more complicated than it should be.
+ * ip_getclient will do an rpcb_getaddr call to identify the
+ * port of the portmapper - but it works, and it's easier than
+ * creating a copy of ip_getclient that avoids the getaddr call.
+ */
+ client = ip_getclient(host, PMAPPROG, PMAPVERS, "tcp");
}
else
client = local_rpcb (PMAPPROG, PMAPVERS);
--
1.7.12.4