Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jul 2002 16:33:28 +0200 (CEST)
From:      Martin Blapp <mb@imp.ch>
To:        <alfred@freebsd.org>
Cc:        <current@freebsd.org>
Subject:   [PATCH] Broken rpc client handle routine
Message-ID:  <20020722162807.Q24110-100000@levais.imp.ch>

next in thread | raw e-mail | index | archive | help

Hi Alfred, (and other may commit this patch if Alfred doesn't)

Here is the patch again. Previous version did only work for
digit hostnames, of course. This one should work.

This fixes the following bugs:

1.) getnetconfigent() was wrong, it should have been __rpc_setconf().

2.) If 1.) was fixed, the wrong UDP protocol (UDP6, or UDP) could
be choosed, if /etc/netconfig had the wrong version first -> maybe
we have to reverse the entrys anyway, but this fix is definitly
needed.

--- rpc/rpcb_clnt.c	Thu Jul 11 18:23:04 2002
+++ rpc/rpcb_clnt.c.new	Mon Jul 22 16:16:04 2002
@@ -778,8 +778,8 @@
 		if (strcmp(nconf->nc_proto, NC_TCP) == 0) {
 			struct netconfig *newnconf;
 			void *handle;
-
-			if ((handle = getnetconfigent("udp")) == NULL) {
+
+			if ((handle = __rpc_setconf("udp")) == NULL) {
 				rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
 				return (NULL);
 			}
@@ -789,6 +789,19 @@
 				return (NULL);
 			}
 			client = getclnthandle(host, newnconf, &parms.r_addr);
+			/*
+			 * If __rpc_getconf() returns IPV6 nconf first and we
+			 * get an empty clienthandle back, check if the next
+			 * UDP handle works better.
+                         */
+			if (client == NULL) {
+				if ((newnconf = __rpc_getconf(handle)) == NULL) {
+					__rpc_endconf(handle);
+					rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
+					return (NULL);
+				}
+				client = getclnthandle(host, newnconf, &parms.r_addr);
+			}
 			__rpc_endconf(handle);
 		} else {
 			client = getclnthandle(host, nconf, &parms.r_addr);

Martin Blapp, <mb@imp.ch> <mbr@FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 061 826 93 00: +41 61 826 93 01
PGP: <finger -l mbr@freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020722162807.Q24110-100000>