svn commit: r241059 - in stable/9: include/rpc lib/libc/rpc sys/rpc

Pedro F. Giffuni pfg at FreeBSD.org
Sun Sep 30 00:44:25 UTC 2012


Author: pfg
Date: Sun Sep 30 00:44:24 2012
New Revision: 241059
URL: http://svn.freebsd.org/changeset/base/241059

Log:
  MFC	r241007, r241008:
  
  Complete revert of r239963 (from head).
  
  The attempt to merge changes from the linux libtirpc caused
  rpc.lockd to exit after startup under unclear conditions.
  
  Reported by:	David Wolfskill

Modified:
  stable/9/include/rpc/auth.h
  stable/9/include/rpc/auth_unix.h
  stable/9/lib/libc/rpc/auth_unix.c
  stable/9/lib/libc/rpc/authunix_prot.c
  stable/9/lib/libc/rpc/clnt_perror.c
  stable/9/lib/libc/rpc/rpc_generic.c
  stable/9/lib/libc/rpc/rpc_soc.3
  stable/9/lib/libc/rpc/rpcb_clnt.c
  stable/9/lib/libc/rpc/svc_auth_unix.c
  stable/9/lib/libc/rpc/svc_run.c
  stable/9/sys/rpc/auth.h
  stable/9/sys/rpc/rpcb_clnt.c

Modified: stable/9/include/rpc/auth.h
==============================================================================
--- stable/9/include/rpc/auth.h	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/include/rpc/auth.h	Sun Sep 30 00:44:24 2012	(r241059)
@@ -243,13 +243,14 @@ __END_DECLS
  * System style authentication
  * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
  *	char *machname;
- *	uid_t uid;
- *	gid_t gid;
+ *	int uid;
+ *	int gid;
  *	int len;
- *	gid_t *aup_gids;
+ *	int *aup_gids;
  */
 __BEGIN_DECLS
-extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *);
+extern AUTH *authunix_create(char *, int, int, int,
+    int *);
 extern AUTH *authunix_create_default(void);	/* takes no parameters */
 extern AUTH *authnone_create(void);		/* takes no parameters */
 __END_DECLS

Modified: stable/9/include/rpc/auth_unix.h
==============================================================================
--- stable/9/include/rpc/auth_unix.h	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/include/rpc/auth_unix.h	Sun Sep 30 00:44:24 2012	(r241059)
@@ -60,10 +60,10 @@
 struct authunix_parms {
 	u_long	 aup_time;
 	char	*aup_machname;
-	uid_t	 aup_uid;
-	gid_t	 aup_gid;
+	int	 aup_uid;
+	int	 aup_gid;
 	u_int	 aup_len;
-	gid_t	*aup_gids;
+	int	*aup_gids;
 };
 
 #define authsys_parms authunix_parms

Modified: stable/9/lib/libc/rpc/auth_unix.c
==============================================================================
--- stable/9/lib/libc/rpc/auth_unix.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/auth_unix.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -94,10 +94,10 @@ struct audata {
 AUTH *
 authunix_create(machname, uid, gid, len, aup_gids)
 	char *machname;
-	uid_t uid;
-	gid_t gid;
+	int uid;
+	int gid;
 	int len;
-	gid_t *aup_gids;
+	int *aup_gids;
 {
 	struct authunix_parms aup;
 	char mymem[MAX_AUTH_BYTES];
@@ -207,7 +207,9 @@ authunix_create_default()
 		abort();
 	if (ngids > NGRPS)
 		ngids = NGRPS;
-	auth = authunix_create(machname, uid, gid, ngids, gids);
+	/* XXX: interface problem; those should all have been unsigned */
+	auth = authunix_create(machname, (int)uid, (int)gid, ngids,
+	    (int *)gids);
 	free(gids);
 	return (auth);
 }

Modified: stable/9/lib/libc/rpc/authunix_prot.c
==============================================================================
--- stable/9/lib/libc/rpc/authunix_prot.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/authunix_prot.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -60,7 +60,7 @@ xdr_authunix_parms(xdrs, p)
 	XDR *xdrs;
 	struct authunix_parms *p;
 {
-	gid_t **paup_gids;
+	int **paup_gids;
 
 	assert(xdrs != NULL);
 	assert(p != NULL);
@@ -69,8 +69,8 @@ xdr_authunix_parms(xdrs, p)
 
 	if (xdr_u_long(xdrs, &(p->aup_time))
 	    && xdr_string(xdrs, &(p->aup_machname), MAX_MACHINE_NAME)
-	    && xdr_u_int(xdrs, &(p->aup_uid))
-	    && xdr_u_int(xdrs, &(p->aup_gid))
+	    && xdr_int(xdrs, &(p->aup_uid))
+	    && xdr_int(xdrs, &(p->aup_gid))
 	    && xdr_array(xdrs, (char **) paup_gids,
 		    &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t)xdr_int) ) {
 		return (TRUE);

Modified: stable/9/lib/libc/rpc/clnt_perror.c
==============================================================================
--- stable/9/lib/libc/rpc/clnt_perror.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/clnt_perror.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -242,7 +242,7 @@ char *
 clnt_spcreateerror(s)
 	const char *s;
 {
-	char *str, *err;
+	char *str;
 	size_t len, i;
 
 	assert(s != NULL);
@@ -258,21 +258,8 @@ clnt_spcreateerror(s)
 	switch (rpc_createerr.cf_stat) {
 	case RPC_PMAPFAILURE:
 		(void) strncat(str, " - ", len - 1);
-		 err = clnt_sperrno(rpc_createerr.cf_error.re_status);
-		if (err)
-			(void) strncat(str, err+5, len-5);
-		switch(rpc_createerr.cf_error.re_status) {
-		case RPC_CANTSEND:
-		case RPC_CANTRECV:
-			i = strlen(str);
-			len -= i;
-			snprintf(str+i, len, ": errno %d (%s)", 
-				rpc_createerr.cf_error.re_errno,
-				strerror(rpc_createerr.cf_error.re_errno)); 
-			break;
-		default:
-			break;
-		}
+		(void) strncat(str,
+		    clnt_sperrno(rpc_createerr.cf_error.re_status), len - 4);
 		break;
 
 	case RPC_SYSTEMERROR:

Modified: stable/9/lib/libc/rpc/rpc_generic.c
==============================================================================
--- stable/9/lib/libc/rpc/rpc_generic.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/rpc_generic.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -269,8 +269,7 @@ __rpc_getconfip(nettype)
 		}
 		while ((nconf = getnetconfig(confighandle)) != NULL) {
 			if (strcmp(nconf->nc_protofmly, NC_INET) == 0) {
-				if (strcmp(nconf->nc_proto, NC_TCP) == 0 &&
-				    netid_tcp == NULL) {
+				if (strcmp(nconf->nc_proto, NC_TCP) == 0) {
 					netid_tcp = strdup(nconf->nc_netid);
 					if (main_thread)
 						netid_tcp_main = netid_tcp;
@@ -278,8 +277,7 @@ __rpc_getconfip(nettype)
 						thr_setspecific(tcp_key,
 							(void *) netid_tcp);
 				} else
-				if (strcmp(nconf->nc_proto, NC_UDP) == 0 &&
-				   netid_udp == NULL) {
+				if (strcmp(nconf->nc_proto, NC_UDP) == 0) {
 					netid_udp = strdup(nconf->nc_netid);
 					if (main_thread)
 						netid_udp_main = netid_udp;
@@ -618,9 +616,6 @@ __rpc_taddr2uaddr_af(int af, const struc
 #endif
 	u_int16_t port;
 
-	if (nbuf->len <= 0)
-		return NULL;
-
 	switch (af) {
 	case AF_INET:
 		sin = nbuf->buf;

Modified: stable/9/lib/libc/rpc/rpc_soc.3
==============================================================================
--- stable/9/lib/libc/rpc/rpc_soc.3	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/rpc_soc.3	Sun Sep 30 00:44:24 2012	(r241059)
@@ -148,7 +148,7 @@ default authentication used by
 .Ft "AUTH *"
 .Xc
 .It Xo
-.Fn authunix_create "char *host" "uid_t uid" "gid_t gid" "int len" "gid_t *aup_gids"
+.Fn authunix_create "char *host" "int uid" "int gid" "int len" "int *aup_gids"
 .Xc
 .Pp
 Create and return an

Modified: stable/9/lib/libc/rpc/rpcb_clnt.c
==============================================================================
--- stable/9/lib/libc/rpc/rpcb_clnt.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/rpcb_clnt.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -770,13 +770,6 @@ __rpcb_findaddr_timed(program, version, 
 	}
 
 	parms.r_addr = NULL;
-	parms.r_netid = nconf->nc_netid;
-
-       /*
-	* According to wire captures, the reference implementation
-	* (OpenSolaris) sends a blank string here too.
-	*/
-	parms.r_owner = "";
 
 	/*
 	 * Use default total timeout if no timeout is specified.

Modified: stable/9/lib/libc/rpc/svc_auth_unix.c
==============================================================================
--- stable/9/lib/libc/rpc/svc_auth_unix.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/svc_auth_unix.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -68,7 +68,7 @@ _svcauth_unix(rqst, msg)
 	struct area {
 		struct authunix_parms area_aup;
 		char area_machname[MAX_MACHINE_NAME+1];
-		gid_t area_gids[NGRPS];
+		int area_gids[NGRPS];
 	} *area;
 	u_int auth_len;
 	size_t str_len, gid_len;

Modified: stable/9/lib/libc/rpc/svc_run.c
==============================================================================
--- stable/9/lib/libc/rpc/svc_run.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/lib/libc/rpc/svc_run.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -60,13 +60,14 @@ svc_run()
 	fd_set readfds, cleanfds;
 	struct timeval timeout;
 
+	timeout.tv_sec = 30;
+	timeout.tv_usec = 0;
+
 	for (;;) {
 		rwlock_rdlock(&svc_fd_lock);
 		readfds = svc_fdset;
 		cleanfds = svc_fdset;
 		rwlock_unlock(&svc_fd_lock);
-		timeout.tv_sec = 30;
-		timeout.tv_usec = 0;
 		switch (_select(svc_maxfd+1, &readfds, NULL, NULL, &timeout)) {
 		case -1:
 			FD_ZERO(&readfds);

Modified: stable/9/sys/rpc/auth.h
==============================================================================
--- stable/9/sys/rpc/auth.h	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/sys/rpc/auth.h	Sun Sep 30 00:44:24 2012	(r241059)
@@ -234,17 +234,18 @@ __END_DECLS
  * System style authentication
  * AUTH *authunix_create(machname, uid, gid, len, aup_gids)
  *	char *machname;
- *	uid_t uid;
- *	gid_t gid;
+ *	int uid;
+ *	int gid;
  *	int len;
- *	gid_t *aup_gids;
+ *	int *aup_gids;
  */
 __BEGIN_DECLS
 #ifdef _KERNEL
 struct ucred;
 extern AUTH *authunix_create(struct ucred *);
 #else
-extern AUTH *authunix_create(char *, uid_t, gid_t, int, gid_t *);
+extern AUTH *authunix_create(char *, int, int, int,
+    int *);
 extern AUTH *authunix_create_default(void);	/* takes no parameters */
 #endif
 extern AUTH *authnone_create(void);		/* takes no parameters */

Modified: stable/9/sys/rpc/rpcb_clnt.c
==============================================================================
--- stable/9/sys/rpc/rpcb_clnt.c	Sat Sep 29 22:28:00 2012	(r241058)
+++ stable/9/sys/rpc/rpcb_clnt.c	Sun Sep 30 00:44:24 2012	(r241059)
@@ -780,13 +780,6 @@ __rpcb_findaddr_timed(program, version, 
 	}
 
 	parms.r_addr = NULL;
-	parms.r_netid = nconf->nc_netid;
-
-       /*
-	* According to wire captures, the reference implementation
-	* (OpenSolaris) sends a blank string here too.
-	*/
-	parms.r_owner = "";
 
 	/*
 	 * Use default total timeout if no timeout is specified.


More information about the svn-src-stable-9 mailing list