From mblapp@fuchur.lan.attic.ch  Sun Mar 25 05:28:31 2001
Return-Path: <mblapp@fuchur.lan.attic.ch>
Received: from fuchur.lan.attic.ch (fuchur.lan.attic.ch [194.235.47.21])
	by hub.freebsd.org (Postfix) with ESMTP id 43A2737B728
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Mar 2001 05:28:25 -0800 (PST)
	(envelope-from mblapp@fuchur.lan.attic.ch)
Received: (from root@localhost)
	by fuchur.lan.attic.ch (8.11.3/8.11.3) id f2PDT2K40433;
	Sun, 25 Mar 2001 15:29:02 +0200 (CEST)
	(envelope-from mblapp)
Message-Id: <200103251329.f2PDT2K40433@fuchur.lan.attic.ch>
Date: Sun, 25 Mar 2001 15:29:02 +0200 (CEST)
From: mb@imp.ch
Reply-To: mb@imp.ch
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [Fix] clnt_generic af_unix support
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         26072
>Category:       kern
>Synopsis:       [Fix] clnt_generic af_unix support
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 25 05:30:01 PST 2001
>Closed-Date:    Sun Mar 25 07:36:22 PST 2001
>Last-Modified:  Wed Oct 26 06:37:39 GMT 2005
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:

Adding a temporary fix for the af_unix rpc connections what we had
previously in our old rpc code. This makes secure rpc client programms
working again, cause they are using an authentificated unix channel.
Rpcbind has been hacked by the netbsd people directly, so they have not
seen the breakage.

The current code should normally work, but it doesn't. I've investigated a
lot of time. One thing is, that for af_unix sockets it is wrong to call
getaddrinfo() which fails.

Anyway, this fix does it's job and so we can investigate some time to
provide the real fix.

>How-To-Repeat:

>Fix:

http://home.teleport.ch/freebsd/clnt_generic.c.diff

--- lib/libc/rpc/clnt_generic.c	Sun Mar 25 14:24:24 2001
+++ lib/libc/rpc/clnt_generic.c	Sun Mar 25 14:26:46 2001
@@ -143,9 +143,28 @@
 	struct netconfig *nconf;
 	CLIENT *clnt = NULL;
 	void *handle;
+	struct sockaddr_un sun;
+	int sock;
+	static struct timeval tv;
 	enum clnt_stat	save_cf_stat = RPC_SUCCESS;
 	struct rpc_err	save_cf_error;
 
+	if (!strcmp(nettype, "unix")) {
+		bzero((char *)&sun, sizeof(sun));
+		sun.sun_family = AF_UNIX;
+		strcpy(sun.sun_path, hostname);
+		sun.sun_len = sizeof(sun.sun_len) + sizeof(sun.sun_family) +
+		    strlen(sun.sun_path) + 1;
+		sock = RPC_ANYSOCK;
+		clnt = clntunix_create(&sun, prog, vers, &sock, 0, 0);
+		if (clnt == NULL)
+			return(NULL);
+		tv.tv_sec = 25;
+		tv.tv_usec = 0;
+		clnt_control(clnt, CLSET_TIMEOUT, &tv);
+		return(clnt);
+	}
 
 	if ((handle = __rpc_setconf(nettype)) == NULL) {
 		rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: roam 
State-Changed-When: Sun Mar 25 07:36:22 PST 2001 
State-Changed-Why:  
Misfiled; originator shall refile. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=26072 
>Unformatted:
 System: FreeBSD fuchur.lan.attic.ch 5.0-CURRENT FreeBSD 5.0-CURRENT #8: Tue Mar 20 14:39:22 CET 2001 root@fuchur.lan.attic.ch:/usr/src/sys/compile/MARTIN i386
 
