From owner-freebsd-current Mon Jul 22 7:31:40 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F3B3637B400; Mon, 22 Jul 2002 07:31:36 -0700 (PDT) Received: from mail.imp.ch (mail.imp.ch [157.161.1.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0880443E4A; Mon, 22 Jul 2002 07:31:36 -0700 (PDT) (envelope-from mb@imp.ch) Received: from nbs.imp.ch (nbs.imp.ch [157.161.4.7]) by mail.imp.ch (8.12.3/8.12.3) with ESMTP id g6MEVYhR022851; Mon, 22 Jul 2002 16:31:34 +0200 (CEST) (envelope-from Martin.Blapp@imp.ch) Received: from levais.imp.ch (levais.imp.ch [157.161.4.66]) by nbs.imp.ch (8.12.3/8.12.3) with ESMTP id g6MEVYYW017869; Mon, 22 Jul 2002 16:31:34 +0200 (MES) Date: Mon, 22 Jul 2002 16:33:28 +0200 (CEST) From: Martin Blapp To: Cc: Subject: [PATCH] Broken rpc client handle routine Message-ID: <20020722162807.Q24110-100000@levais.imp.ch> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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, ------------------------------------------------------------------ ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH Phone: +41 061 826 93 00: +41 61 826 93 01 PGP: 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