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, <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 061 826 93 00: +41 61 826 93 01
PGP: <finger -l [EMAIL PROTECTED]>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to