Bug 29174

Summary: [PATCH] cleanup of the ti-rpc merger
Product: Base System Reporter: mb <mb>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description mb 2001-07-23 22:10:01 UTC
Add missing includes, shut up some nasty warnings and so on.

Fix: 

Add my patch:

http://home.teleport.ch/freebsd/userland/rpclib-cleanup.diff
Comment 1 mb 2001-10-07 01:20:59 UTC
DES has pointed out that I should not post URL's and the patches
instead:

----------------------------------------------------------------

Last modified:

2001-10-06 16:31

Changed files:

include/rpc/auth.h
include/rpc/rpc_com.h
lib/libc/gen/getpwent.c
lib/libc/net/getaddrinfo.c
lib/libc/rpc/auth_time.c
lib/libc/rpc/clnt_bcast.c
lib/libc/rpc/clnt_dg.c
lib/libc/rpc/des_crypt.c
lib/libc/rpc/getpublickey.c
lib/libc/rpc/key_call.c
lib/libc/rpc/key_prot_xdr.c
lib/libc/rpc/netname.c
lib/libc/rpc/netnamer.c
lib/libc/rpc/rpc_generic.c
lib/libc/rpc/rpc_soc.c
lib/libc/rpc/rpcb_prot.c
lib/libc/rpc/rpcdname.c
lib/libc/rpc/svc_auth_des.c
lib/libc/rpc/svc_simple.c
lib/libc/rpc/svc_vc.c
lib/libc/yp/xdryp.c
lib/libc/yp/yplib.c

Comment:

Fix cc -Wall, fix rcsid warnings, add missing prototypes,
change _rpc_get_default_domain() to __rpc_get_default_domain
to fit the prototype, various style fixes

Index: include/rpc/auth.h
===================================================================
RCS file: /usr/home/ncvs/src/include/rpc/auth.h,v
retrieving revision 1.17
diff -u -r1.17 auth.h
--- include/rpc/auth.h	19 Mar 2001 19:36:11 -0000	1.17
+++ include/rpc/auth.h	6 Oct 2001 14:25:10 -0000
@@ -267,7 +267,7 @@
 __END_DECLS

 __BEGIN_DECLS
-extern bool_t xdr_opaque_auth		__P((XDR *, struct opaque_auth *));
+extern bool_t xdr_opaque_auth		(XDR *, struct opaque_auth *);
 __END_DECLS

 #define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip))
@@ -298,6 +298,15 @@
 extern int key_secretkey_is_set(void);
 __END_DECLS

+/*
+ * Publickey routines.
+ */
+__BEGIN_DECLS
+extern int getpublickey (const char *, char *);
+extern int getpublicandprivatekey (char *, char *);
+extern int getsecretkey (char *, char *, char *);
+__END_DECLS
+
 #ifdef KERBEROS
 /*
  * Kerberos style authentication
@@ -334,9 +343,9 @@
 __BEGIN_DECLS
 struct svc_req;
 struct rpc_msg;
-enum auth_stat _svcauth_null __P((struct svc_req *, struct rpc_msg *));
-enum auth_stat _svcauth_short __P((struct svc_req *, struct rpc_msg *));
-enum auth_stat _svcauth_unix __P((struct svc_req *, struct rpc_msg *));
+enum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *);
+enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *);
+enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *);
 __END_DECLS

 #define AUTH_NONE	0		/* no authentication */
Index: include/rpc/rpc_com.h
===================================================================
RCS file: /usr/home/ncvs/src/include/rpc/rpc_com.h,v
retrieving revision 1.3
diff -u -r1.3 rpc_com.h
--- include/rpc/rpc_com.h	19 Mar 2001 12:49:47 -0000	1.3
+++ include/rpc/rpc_com.h	6 Oct 2001 14:25:10 -0000
@@ -59,6 +59,7 @@
 __BEGIN_DECLS
 extern u_int __rpc_get_a_size __P((int));
 extern int __rpc_dtbsize __P((void));
+extern int _rpc_dtablesize __P((void));
 extern struct netconfig * __rpcgettp __P((int));
 extern  int  __rpc_get_default_domain __P((char **));

Index: lib/libc/gen/getpwent.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/gen/getpwent.c,v
retrieving revision 1.60
diff -u -r1.60 getpwent.c
--- lib/libc/gen/getpwent.c	18 Jun 2001 16:09:24 -0000	1.60
+++ lib/libc/gen/getpwent.c	6 Oct 2001 14:25:11 -0000
@@ -68,6 +68,7 @@
 extern void setnetgrent __P((char *));
 extern int getnetgrent __P((char **, char **, char **));
 extern int innetgr __P((const char *, const char *, const char *, const char *));
+extern int _yp_check __P((char **));

 #include "pw_scan.h"

Index: lib/libc/net/getaddrinfo.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/net/getaddrinfo.c,v
retrieving revision 1.21
diff -u -r1.21 getaddrinfo.c
--- lib/libc/net/getaddrinfo.c	10 Jun 2001 20:25:23 -0000	1.21
+++ lib/libc/net/getaddrinfo.c	6 Oct 2001 14:25:12 -0000
@@ -91,6 +91,9 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
 #include <netdb.h>
 #include <resolv.h>
 #include <string.h>
@@ -245,6 +248,7 @@
 #ifdef YP
 static struct addrinfo *_yphostent __P((char *, const struct addrinfo *));
 static int _yp_getaddrinfo __P((void *, void *, va_list));
+extern int _yp_check __P(char **));
 #endif

 static int res_queryN __P((const char *, struct res_target *));
Index: lib/libc/rpc/auth_time.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/auth_time.c,v
retrieving revision 1.6
diff -u -r1.6 auth_time.c
--- lib/libc/rpc/auth_time.c	19 Mar 2001 12:49:50 -0000	1.6
+++ lib/libc/rpc/auth_time.c	6 Oct 2001 14:25:12 -0000
@@ -1,4 +1,4 @@
-#pragma ident	"@(#)auth_time.c	1.4	92/11/10 SMI"
+/* #pragma ident	"@(#)auth_time.c	1.4	92/11/10 SMI" */

 /*
  *	auth_time.c
@@ -25,9 +25,6 @@
  *	and destroyed. Two strings "netid" and "uaddr" are malloc'd
  *	and returned. The SIGALRM processing is modified only if
  *	needed to deal with TCP connections.
- *
- * NOTE: This code has had the crap beaten out it in order to convert
- *       it from TI-RPC back to TD-RPC for use on FreeBSD.
  *
  * $FreeBSD: src/lib/libc/rpc/auth_time.c,v 1.6 2001/03/19 12:49:50 alfred Exp $
  */
Index: lib/libc/rpc/clnt_bcast.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/clnt_bcast.c,v
retrieving revision 1.1
diff -u -r1.1 clnt_bcast.c
--- lib/libc/rpc/clnt_bcast.c	19 Mar 2001 12:49:50 -0000	1.1
+++ lib/libc/rpc/clnt_bcast.c	6 Oct 2001 14:25:12 -0000
@@ -269,13 +269,14 @@
 	size_t fdlistno = 0;
 	struct r_rpcb_rmtcallargs barg;	/* Remote arguments */
 	struct r_rpcb_rmtcallres bres; /* Remote results */
-	size_t outlen, outlen_pmap;
+	size_t outlen;
 	struct netconfig *nconf;
 	int msec;
 	int pollretval;
 	int fds_found;

 #ifdef PORTMAP
+	size_t outlen_pmap = 0;
 	u_long port;		/* Remote port number */
 	int pmap_flag = 0;	/* UDP exists ? */
 	char *outbuf_pmap = NULL;
Index: lib/libc/rpc/clnt_dg.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/clnt_dg.c,v
retrieving revision 1.7
diff -u -r1.7 clnt_dg.c
--- lib/libc/rpc/clnt_dg.c	23 Jun 2001 19:43:21 -0000	1.7
+++ lib/libc/rpc/clnt_dg.c	6 Oct 2001 14:25:13 -0000
@@ -311,7 +311,6 @@
 	struct timeval retransmit_time;
 	struct timeval startime, curtime;
 	int firsttimeout = 1;
-	int dtbsize = __rpc_dtbsize();
 	struct sockaddr *sa;
 	sigset_t mask;
 	sigset_t newmask;
@@ -320,6 +319,7 @@
 	int rpc_lock_value;
 	u_int32_t xid;

+	outlen = 0;
 	sigfillset(&newmask);
 	thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
 	mutex_lock(&clnt_fd_lock);
Index: lib/libc/rpc/des_crypt.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/des_crypt.c,v
retrieving revision 1.3
diff -u -r1.3 des_crypt.c
--- lib/libc/rpc/des_crypt.c	28 Aug 1999 00:00:38 -0000	1.3
+++ lib/libc/rpc/des_crypt.c	6 Oct 2001 14:25:13 -0000
@@ -42,7 +42,7 @@

 static int common_crypt	__P(( char *, char *, register unsigned, unsigned, struct desparams * ));
 int (*__des_crypt_LOCAL)() = 0;
-extern _des_crypt_call __P(( char *, int, struct desparams * ));
+extern int _des_crypt_call __P((char *, int, struct desparams *));
 /*
  * Copy 8 bytes
  */
Index: lib/libc/rpc/getpublickey.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/getpublickey.c,v
retrieving revision 1.4
diff -u -r1.4 getpublickey.c
--- lib/libc/rpc/getpublickey.c	19 Mar 2001 12:49:51 -0000	1.4
+++ lib/libc/rpc/getpublickey.c	6 Oct 2001 14:25:13 -0000
@@ -168,7 +168,7 @@
 }

 int getpublickey(netname, publickey)
-	char *netname;
+	const char *netname;
 	char *publickey;
 {
 	if (__getpublickey_LOCAL != NULL)
Index: lib/libc/rpc/key_call.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/key_call.c,v
retrieving revision 1.8
diff -u -r1.8 key_call.c
--- lib/libc/rpc/key_call.c	2 Apr 2001 21:41:43 -0000	1.8
+++ lib/libc/rpc/key_call.c	6 Oct 2001 14:25:13 -0000
@@ -32,7 +32,7 @@

 #ident	"@(#)key_call.c	1.25	94/04/24 SMI"

-#ifndef lint
+#if defined(LIBC_SCCS) && !defined(lint)
 static char rcsid[] =
   "$FreeBSD: src/lib/libc/rpc/key_call.c,v 1.8 2001/04/02 21:41:43 iedowse Exp $";
 #endif /* not lint */
@@ -379,8 +379,7 @@
 		endnetconfig(localhandle);
 		return ((CLIENT *) NULL);
         }
-
-	while (nconf = getnetconfig(localhandle)) {
+	while ((nconf = getnetconfig(localhandle)) != NULL) {
 		if (strcmp(nconf->nc_protofmly, NC_LOOPBACK) == 0) {
 			/*
 			 * We use COTS_ORD here so that the caller can
Index: lib/libc/rpc/key_prot_xdr.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/key_prot_xdr.c,v
retrieving revision 1.2
diff -u -r1.2 key_prot_xdr.c
--- lib/libc/rpc/key_prot_xdr.c	19 Mar 2001 12:49:51 -0000	1.2
+++ lib/libc/rpc/key_prot_xdr.c	6 Oct 2001 14:25:13 -0000
@@ -106,6 +106,8 @@
 		if (!xdr_des_block(xdrs, &objp->cryptkeyres_u.deskey))
 			return (FALSE);
 		break;
+	default:
+		break;
 	}
 	return (TRUE);
 }
@@ -135,6 +137,8 @@
 		if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
 			return (FALSE);
 		break;
+	default:
+		break;
 	}
 	return (TRUE);
 }
@@ -162,6 +166,8 @@
 	case KEY_SUCCESS:
 		if (!xdr_key_netstarg(xdrs, &objp->key_netstres_u.knet))
 			return (FALSE);
+		break;
+	default:
 		break;
 	}
 	return (TRUE);
Index: lib/libc/rpc/netname.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/netname.c,v
retrieving revision 1.5
diff -u -r1.5 netname.c
--- lib/libc/rpc/netname.c	19 Mar 2001 12:49:51 -0000	1.5
+++ lib/libc/rpc/netname.c	6 Oct 2001 14:25:13 -0000
@@ -109,7 +109,7 @@
 	char *dfltdom;

 	if (domain == NULL) {
-		if (_rpc_get_default_domain(&dfltdom) != 0) {
+		if (__rpc_get_default_domain(&dfltdom) != 0) {
 			return (0);
 		}
 		domain = dfltdom;
@@ -135,7 +135,7 @@
 	char hostname[MAXHOSTNAMELEN+1];

 	if (domain == NULL) {
-		if (_rpc_get_default_domain(&dfltdom) != 0) {
+		if (__rpc_get_default_domain(&dfltdom) != 0) {
 			return (0);
 		}
 		domain = dfltdom;
Index: lib/libc/rpc/netnamer.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/netnamer.c,v
retrieving revision 1.5
diff -u -r1.5 netnamer.c
--- lib/libc/rpc/netnamer.c	19 Mar 2001 12:49:51 -0000	1.5
+++ lib/libc/rpc/netnamer.c	6 Oct 2001 14:25:13 -0000
@@ -126,7 +126,7 @@
 	(void) strncpy(val, val1, 1024);
 	val[vallen] = 0;

-	err = _rpc_get_default_domain(&domain);	/* change to rpc */
+	err = __rpc_get_default_domain(&domain);	/* change to rpc */
 	if (err)
 		return (0);

@@ -227,7 +227,7 @@
 	(void) strncpy(hostname, val, vallen);
 	hostname[vallen] = 0;

-	err = _rpc_get_default_domain(&domain);	/* change to rpc */
+	err = __rpc_get_default_domain(&domain);	/* change to rpc */
 	if (err)
 		return (0);

Index: lib/libc/rpc/rpc_generic.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/rpc_generic.c,v
retrieving revision 1.5
diff -u -r1.5 rpc_generic.c
--- lib/libc/rpc/rpc_generic.c	12 May 2001 20:05:26 -0000	1.5
+++ lib/libc/rpc/rpc_generic.c	6 Oct 2001 14:25:13 -0000
@@ -646,6 +646,8 @@
 #endif
 	struct sockaddr_un *sun;

+	port = 0;
+	sin = NULL;
 	addrstr = strdup(uaddr);
 	if (addrstr == NULL)
 		return NULL;
Index: lib/libc/rpc/rpc_soc.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/rpc_soc.c,v
retrieving revision 1.4
diff -u -r1.4 rpc_soc.c
--- lib/libc/rpc/rpc_soc.c	4 Oct 2001 21:03:17 -0000	1.4
+++ lib/libc/rpc/rpc_soc.c	6 Oct 2001 14:25:13 -0000
@@ -463,13 +463,13 @@
 	u_int recvsz;
 {
 	struct netbuf *svcaddr;
-	void *localhandle;
 	struct netconfig *nconf;
 	CLIENT *cl;
 	int len;

-	nconf = NULL;
 	cl = NULL;
+	nconf = NULL;
+	svcaddr = NULL;
 	if ((raddr->sun_len == 0) ||
 	   ((svcaddr = malloc(sizeof(struct netbuf))) == NULL ) ||
 	   ((svcaddr->buf = malloc(sizeof(struct sockaddr_un))) == NULL)) {
Index: lib/libc/rpc/rpcb_prot.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/rpcb_prot.c,v
retrieving revision 1.1
diff -u -r1.1 rpcb_prot.c
--- lib/libc/rpc/rpcb_prot.c	19 Mar 2001 12:49:51 -0000	1.1
+++ lib/libc/rpc/rpcb_prot.c	6 Oct 2001 14:25:13 -0000
@@ -116,6 +116,7 @@
 	rpcblist_ptr next;
 	rpcblist_ptr next_copy;

+	next = NULL;
 	for (;;) {
 		more_elements = (bool_t)(*rp != NULL);
 		if (! xdr_bool(xdrs, &more_elements)) {
@@ -204,6 +205,7 @@
 	rpcb_entry_list_ptr next;
 	rpcb_entry_list_ptr next_copy;

+	next = NULL;
 	for (;;) {
 		more_elements = (bool_t)(*rp != NULL);
 		if (! xdr_bool(xdrs, &more_elements)) {
Index: lib/libc/rpc/rpcdname.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/rpcdname.c,v
retrieving revision 1.2
diff -u -r1.2 rpcdname.c
--- lib/libc/rpc/rpcdname.c	19 Mar 2001 12:49:52 -0000	1.2
+++ lib/libc/rpc/rpcdname.c	6 Oct 2001 14:25:13 -0000
@@ -71,7 +71,7 @@
  * get rejected elsewhere in the NIS client package.
  */
 int
-_rpc_get_default_domain(domain)
+__rpc_get_default_domain(domain)
 	char **domain;
 {
 	if ((*domain = get_default_domain()) != 0)
Index: lib/libc/rpc/svc_auth_des.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/svc_auth_des.c,v
retrieving revision 1.6
diff -u -r1.6 svc_auth_des.c
--- lib/libc/rpc/svc_auth_des.c	2 Apr 2001 21:41:44 -0000	1.6
+++ lib/libc/rpc/svc_auth_des.c	6 Oct 2001 14:25:13 -0000
@@ -69,6 +69,8 @@
 static const char rcsid[] = "$FreeBSD: src/lib/libc/rpc/svc_auth_des.c,v 1.6 2001/04/02 21:41:44 iedowse Exp $";
 #endif

+extern int key_decryptsession_pk(const char *, netobj *, des_block *);
+
 #define debug(msg)	 printf("svcauth_des: %s\n", msg)

 #define USEC_PER_SEC ((u_long) 1000000L)
Index: lib/libc/rpc/svc_simple.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/svc_simple.c,v
retrieving revision 1.11
diff -u -r1.11 svc_simple.c
--- lib/libc/rpc/svc_simple.c	2 Apr 2001 21:41:44 -0000	1.11
+++ lib/libc/rpc/svc_simple.c	6 Oct 2001 14:25:13 -0000
@@ -133,7 +133,9 @@

 		madenow = FALSE;
 		svcxprt = NULL;
-		for (pl = proglst; pl; pl = pl->p_nxt)
+		recvsz = 0;
+		xdrbuf = netid = NULL;
+		for (pl = proglst; pl; pl = pl->p_nxt) {
 			if (strcmp(pl->p_netid, nconf->nc_netid) == 0) {
 				svcxprt = pl->p_transp;
 				xdrbuf = pl->p_xdrbuf;
@@ -141,6 +143,7 @@
 				netid = pl->p_netid;
 				break;
 			}
+		}

 		if (svcxprt == NULL) {
 			struct __rpc_sockinfo si;
Index: lib/libc/rpc/svc_vc.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/rpc/svc_vc.c,v
retrieving revision 1.6
diff -u -r1.6 svc_vc.c
--- lib/libc/rpc/svc_vc.c	4 Oct 2001 13:11:41 -0000	1.6
+++ lib/libc/rpc/svc_vc.c	6 Oct 2001 14:25:13 -0000
@@ -129,7 +129,6 @@
 	struct __rpc_sockinfo si;
 	struct sockaddr_storage sslocal;
 	socklen_t slen;
-	int one = 1;

 	r = mem_alloc(sizeof(*r));
 	if (r == NULL) {
Index: lib/libc/yp/xdryp.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/yp/xdryp.c,v
retrieving revision 1.9
diff -u -r1.9 xdryp.c
--- lib/libc/yp/xdryp.c	28 Aug 1999 00:02:58 -0000	1.9
+++ lib/libc/yp/xdryp.c	6 Oct 2001 14:25:13 -0000
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */

-#ifndef LINT
+#if defined(LIBC_SCCS) && !defined(lint)
 static char *rcsid = "$FreeBSD: src/lib/libc/yp/xdryp.c,v 1.9 1999/08/28 00:02:58 peter Exp $";
 #endif

Index: lib/libc/yp/yplib.c
===================================================================
RCS file: /usr/home/ncvs/src/lib/libc/yp/yplib.c,v
retrieving revision 1.36
diff -u -r1.36 yplib.c
--- lib/libc/yp/yplib.c	23 May 2001 15:37:10 -0000	1.36
+++ lib/libc/yp/yplib.c	6 Oct 2001 14:25:13 -0000
@@ -28,7 +28,7 @@
  * SUCH DAMAGE.
  */

-#ifndef LINT
+#if defined(LIBC_SCCS) && !defined(lint)
 static char *rcsid = "$FreeBSD: src/lib/libc/yp/yplib.c,v 1.36 2001/05/23 15:37:10 pirzyk Exp $";
 #endif
Comment 2 Martin Blapp freebsd_committer freebsd_triage 2002-02-09 20:44:00 UTC
State Changed
From-To: open->closed

Patch comitted by Alfred.