Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 May 2011 02:41:04 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r222471 - in user/hrs/ipv6: libexec/ypxfr usr.sbin/rpc.yppasswdd usr.sbin/rpc.ypupdated usr.sbin/rpc.ypxfrd usr.sbin/yppush usr.sbin/ypserv
Message-ID:  <201105300241.p4U2f4Vk056562@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Mon May 30 02:41:04 2011
New Revision: 222471
URL: http://svn.freebsd.org/changeset/base/222471

Log:
  Various consistency and style fixes for WARNS=6.

Modified:
  user/hrs/ipv6/libexec/ypxfr/ypxfr_extern.h
  user/hrs/ipv6/libexec/ypxfr/ypxfr_main.c
  user/hrs/ipv6/usr.sbin/rpc.yppasswdd/Makefile
  user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h
  user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
  user/hrs/ipv6/usr.sbin/rpc.ypupdated/ypupdated_main.c
  user/hrs/ipv6/usr.sbin/rpc.ypxfrd/Makefile
  user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h
  user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
  user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_server.c
  user/hrs/ipv6/usr.sbin/yppush/Makefile
  user/hrs/ipv6/usr.sbin/yppush/yppush_main.c
  user/hrs/ipv6/usr.sbin/ypserv/Makefile
  user/hrs/ipv6/usr.sbin/ypserv/yp_access.c
  user/hrs/ipv6/usr.sbin/ypserv/yp_dblookup.c
  user/hrs/ipv6/usr.sbin/ypserv/yp_dnslookup.c
  user/hrs/ipv6/usr.sbin/ypserv/yp_error.c
  user/hrs/ipv6/usr.sbin/ypserv/yp_extern.h
  user/hrs/ipv6/usr.sbin/ypserv/yp_main.c
  user/hrs/ipv6/usr.sbin/ypserv/yp_server.c

Modified: user/hrs/ipv6/libexec/ypxfr/ypxfr_extern.h
==============================================================================
--- user/hrs/ipv6/libexec/ypxfr/ypxfr_extern.h	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/libexec/ypxfr/ypxfr_extern.h	Mon May 30 02:41:04 2011	(r222471)
@@ -44,7 +44,7 @@ extern BTREEINFO openinfo_b;
 #define _PATH_YP "/var/yp/"
 #endif
 
-extern char	*yp_dir;
+extern const char	*yp_dir;
 extern int	debug;
 extern enum ypstat	yp_errno;
 extern void	yp_error(const char *, ...);

Modified: user/hrs/ipv6/libexec/ypxfr/ypxfr_main.c
==============================================================================
--- user/hrs/ipv6/libexec/ypxfr/ypxfr_main.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/libexec/ypxfr/ypxfr_main.c	Mon May 30 02:41:04 2011	(r222471)
@@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$");
 #include <rpcsvc/ypxfrd.h>
 #include "ypxfr_extern.h"
 
-char *progname = "ypxfr";
-char *yp_dir = _PATH_YP;
+const char *progname = "ypxfr";
+const char *yp_dir = _PATH_YP;
 int _rpcpmstart = 0;
 int ypxfr_use_yplib = 0; /* Assume the worst. */
 int ypxfr_clear = 1;

Modified: user/hrs/ipv6/usr.sbin/rpc.yppasswdd/Makefile
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.yppasswdd/Makefile	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.yppasswdd/Makefile	Mon May 30 02:41:04 2011	(r222471)
@@ -5,12 +5,20 @@ RPCDIR=	${DESTDIR}/usr/include/rpcsvc
 .PATH: ${.CURDIR}/../../usr.sbin/ypserv ${.CURDIR}/../../usr.bin/chpass \
        ${.CURDIR}/../../libexec/ypxfr ${RPCDIR}
 
+.include <bsd.own.mk>
+
 PROG=	rpc.yppasswdd
 SCRIPTS=yppwupdate
 SCRIPTSDIR= /usr/libexec
 MAN=	rpc.yppasswdd.8
 SRCS=	util.c yp_access.c yp_dblookup.c yp_dbwrite.c \
 	yp_error.c yppasswdd_main.c yppasswdd_server.c ypxfr_misc.c ${GENSRCS}
+.if ${MK_INET_SUPPORT} != "no"
+SRCS+=	yp_access_inet.c
+.endif
+.if ${MK_INET6_SUPPORT} != "no"
+SRCS+=	yp_access_inet6.c
+.endif
 GENSRCS=yp.h yp_clnt.c yppasswd.h yppasswd_private.h yppasswd_private_svc.c \
 	yppasswd_private_xdr.c yppasswd_svc.c
 

Modified: user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h	Mon May 30 02:41:04 2011	(r222471)
@@ -46,8 +46,6 @@
 #define MAP_UPDATE "yppwupdate"
 #define MAP_UPDATE_PATH YPLIBDIR "yppwupdate"
 
-extern char	*yp_dir;
-extern char	*progname;
 extern void	do_master(void);
 extern void	yppasswdprog_1(struct svc_req *, register SVCXPRT *);
 extern void     master_yppasswdprog_1(struct svc_req *, register SVCXPRT *);

Modified: user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_main.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_main.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.yppasswdd/yppasswdd_main.c	Mon May 30 02:41:04 2011	(r222471)
@@ -86,10 +86,8 @@ static int _rpcfdtype;
 static char _localhost[] = "localhost";
 static char _passwd_byname[] = "passwd.byname";
 extern int _rpcsvcstate;	 /* Set when a request is serviced */
-static char _progname[] = "rpc.yppasswdd";
-char *progname = _progname;
-static char _yp_dir[] = _PATH_YP;
-char *yp_dir = _yp_dir;
+const char *progname = "rpc.yppasswdd";
+const char *yp_dir = _PATH_YP;
 static char _passfile_default[] = _PATH_YP "master.passwd";
 char *passfile_default = _passfile_default;
 char *passfile;

Modified: user/hrs/ipv6/usr.sbin/rpc.ypupdated/ypupdated_main.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.ypupdated/ypupdated_main.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.ypupdated/ypupdated_main.c	Mon May 30 02:41:04 2011	(r222471)
@@ -75,8 +75,8 @@ static int _rpcfdtype;
 
 extern int _rpcsvcstate;	 /* Set when a request is serviced */
 
-char *progname = "rpc.ypupdated";
-char *yp_dir = "/var/yp/";
+const char *progname = "rpc.ypupdated";
+const char *yp_dir = "/var/yp/";
 
 static void
 _msgout(char* msg)

Modified: user/hrs/ipv6/usr.sbin/rpc.ypxfrd/Makefile
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.ypxfrd/Makefile	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.ypxfrd/Makefile	Mon May 30 02:41:04 2011	(r222471)
@@ -1,13 +1,21 @@
 # $FreeBSD$
 
-.PATH: ${.CURDIR}/../../usr.sbin/ypserv
+.PATH: ${.CURDIR}/../ypserv
+
+.include <bsd.own.mk>
 
 PROG=	rpc.ypxfrd
 MAN=	rpc.ypxfrd.8
 SRCS=	ypxfrd_svc.c ypxfrd.h ypxfrd_server.c yp_error.c \
 	yp_access.c ypxfrd_main.c
+.if ${MK_INET_SUPPORT} != "no"
+SRCS+=	yp_access_inet.c
+.endif
+.if ${MK_INET6_SUPPORT} != "no"
+SRCS+=	yp_access_inet6.c
+.endif
 
-CFLAGS+= -I. -DXFRBLOCKSIZE=65535
+CFLAGS+= -I. -I${.CURDIR}/../ypserv -DXFRBLOCKSIZE=65535
 
 WARNS?=	2
 

Modified: user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h	Mon May 30 02:41:04 2011	(r222471)
@@ -42,9 +42,4 @@
 
 extern int	forked;
 extern int	children;
-extern void     load_securenets(void);
-extern void     yp_error(const char *, ...);
-extern int      yp_access(const char *, const struct svc_req *);
-extern int      yp_validdomain(const char *);
-extern char	*yp_dir;
 extern void	ypxfrd_freebsd_prog_1(struct svc_req *, register SVCXPRT *);

Modified: user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_main.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_main.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_main.c	Mon May 30 02:41:04 2011	(r222471)
@@ -52,10 +52,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <syslog.h>
-#include "ypxfrd_extern.h"
 #include <sys/wait.h>
 #include <errno.h>
 
+#include "ypxfrd_extern.h"
+#include "yp_extern.h"
+
 #ifndef SIG_PF
 #define	SIG_PF void(*)(int)
 #endif
@@ -76,8 +78,8 @@ static int _rpcfdtype;
 
 extern int _rpcsvcstate;	 /* Set when a request is serviced */
 
-char *progname = "rpc.ypxfrd";
-char *yp_dir = "/var/yp/";
+const char *progname = "rpc.ypxfrd";
+const char *yp_dir = _PATH_YP;
 
 static void
 _msgout(char *msg)

Modified: user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_server.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_server.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/rpc.ypxfrd/ypxfrd_server.c	Mon May 30 02:41:04 2011	(r222471)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/fcntl.h>
 #include <machine/endian.h>
 #include "ypxfrd_extern.h"
+#include "yp_extern.h"
 
 int forked = 0;
 int children = 0;

Modified: user/hrs/ipv6/usr.sbin/yppush/Makefile
==============================================================================
--- user/hrs/ipv6/usr.sbin/yppush/Makefile	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/yppush/Makefile	Mon May 30 02:41:04 2011	(r222471)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 RPCDIR=	${.CURDIR}/../../include/rpcsvc
-.PATH: ${RPCDIR} ${.CURDIR}/../../usr.sbin/ypserv \
+.PATH: ${RPCDIR} ${.CURDIR}/../ypserv \
        ${.CURDIR}/../../libexec/ypxfr
 
 PROG=	yppush

Modified: user/hrs/ipv6/usr.sbin/yppush/yppush_main.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/yppush/yppush_main.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/yppush/yppush_main.c	Mon May 30 02:41:04 2011	(r222471)
@@ -53,10 +53,10 @@ __FBSDID("$FreeBSD$");
 #include "ypxfr_extern.h"
 #include "yppush_extern.h"
 
-char *progname = "yppush";
 int debug = 1;
 int _rpcpmstart = 0;
-char *yp_dir = _PATH_YP;
+const char *progname = "yppush";
+const char *yp_dir = _PATH_YP;
 
 char *yppush_mapname = NULL;	/* Map to transfer. */
 char *yppush_domain = NULL;	/* Domain in which map resides. */

Modified: user/hrs/ipv6/usr.sbin/ypserv/Makefile
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/Makefile	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/Makefile	Mon May 30 02:41:04 2011	(r222471)
@@ -18,7 +18,7 @@ SRCS+=	yp_access_inet6.c
 
 CFLAGS+= -DDB_CACHE -DTCP_WRAPPER -I.
 
-WARNS?=	0
+WARNS?=	6
 
 DPADD=	${LIBWRAP}
 LDADD=	-lwrap

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_access.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_access.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_access.c	Mon May 30 02:41:04 2011	(r222471)
@@ -56,10 +56,11 @@ __FBSDID("$FreeBSD$");
 #include "yp_extern.h"
 #ifdef TCP_WRAPPER
 #include "tcpd.h"
+extern int hosts_ctl(const char *, const char *, const char *, const char *);
 #endif
 
-extern int hosts_ctl(char *, char *, char *, char *);
-extern int debug;
+char securenets_path[MAXPATHLEN];
+enum yp_snf_format securenets_format = YP_SNF_NATIVE;
 
 const char *yp_procs[] = {
 	/* NIS v1 */
@@ -143,6 +144,7 @@ void
 yp_debug_sa(const struct sockaddr *sap)
 {
 	int error;
+	int plen;
 	char host[NI_MAXHOST + 1];
 	char serv[NI_MAXSERV + 1];
 
@@ -150,8 +152,9 @@ yp_debug_sa(const struct sockaddr *sap)
 		    sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV);
 	if (error)
 		yp_error("sockaddr: %s", gai_strerror(error));
-	else
-		yp_error("sockaddr: %d/%s/%s", sap->sa_family, host, serv);
+	mask2prefixlen(sap, &plen);
+	yp_error("sockaddr: %d:[%s]:%s(/%d)",
+		 sap->sa_family, host, serv, plen);
 }
 
 void
@@ -224,8 +227,13 @@ load_securenets(void)
 				return (1);
 			}
 			for (res = res0; res; res = res->ai_next) {
-				struct sockaddr *sap;
 				snp = malloc(sizeof(*snp));
+				if (snp == NULL) {
+					yp_error("malloc failed: %s",
+						 strerror(errno));
+					freeaddrinfo(res0);
+					return (1);
+				}
 				memset(snp, 0, sizeof(*snp));
 				memcpy(&snp->sn_addr, res->ai_addr,
 				   sizeof(res->ai_addrlen));
@@ -247,8 +255,8 @@ load_securenets(void)
 	line = 0;
 	while (fgets(linebuf, sizeof(linebuf), fp)) {
 		int nitems;
-		char *col_host;
-		char *col_mask;
+		const char *col_host;
+		const char *col_mask;
 		char addr1[NI_MAXHOST + 1];
 		char addr2[NI_MAXHOST + 1];
 		int plen;
@@ -300,7 +308,7 @@ load_securenets(void)
 			if (error) {
 				yp_error("line %d: "
 					 "badly formatted securenets entry: "
-					 "%s: %s: %s", line, linebuf,
+					 "%s: %s", line, linebuf,
 					 gai_strerror(error));
 				freeaddrinfo(res0);
 				free(snp);
@@ -339,7 +347,7 @@ load_securenets(void)
 			if (error) {
 				yp_error("line %d: "
 				    "badly formatted securenets entry: "
-				    "%s: %s: %s", line, linebuf,
+				    "%s: %s", line, linebuf,
 				    gai_strerror(error));
 				freeaddrinfo(res0);
 				free(snp);
@@ -448,7 +456,7 @@ compare_subnet(struct sockaddr *addr1,
 	u_char a1[sizeof(struct sockaddr_storage)];
 	u_char a2[sizeof(struct sockaddr_storage)];
 	u_char m[sizeof(struct sockaddr_storage)];
-	size_t len;
+	ssize_t len;
 	int i;
 	int samescope;
 
@@ -602,7 +610,7 @@ yp_access(const char *map, const struct 
 			return (1);
 		}
 #ifdef DB_CACHE
-		if ((yp_testflag((char *)map, (char *)domain, YP_SECURE) ||
+		if ((yp_testflag((const char *)map, (const char *)domain, YP_SECURE) ||
 #else
 		if ((strstr(map, "master.passwd.") || strstr(map, "shadow.") ||
 #endif

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_dblookup.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_dblookup.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_dblookup.c	Mon May 30 02:41:04 2011	(r222471)
@@ -67,6 +67,7 @@ HASHINFO openinfo = {
 #define MAXDBS 20
 #endif
 
+static char nullbuf[] = "";
 static int numdbs = 0;
 
 struct dbent {
@@ -193,10 +194,8 @@ yp_flush_all(void)
 	return;
 }
 
-static char *inter_string = "YP_INTERDOMAIN";
-static char *secure_string = "YP_SECURE";
-static int inter_sz = sizeof("YP_INTERDOMAIN") - 1;
-static int secure_sz = sizeof("YP_SECURE") - 1;
+static char inter_string[] = "YP_INTERDOMAIN";
+static char secure_string[] = "YP_SECURE";
 
 static int
 yp_setflags(DB *dbp)
@@ -205,13 +204,13 @@ yp_setflags(DB *dbp)
 	int flags = 0;
 
 	key.data = inter_string;
-	key.size = inter_sz;
+	key.size = sizeof(inter_string) - 1;
 
 	if (!(dbp->get)(dbp, &key, &data, 0))
 		flags |= YP_INTERDOMAIN;
 
 	key.data = secure_string;
-	key.size = secure_sz;
+	key.size = sizeof(secure_string) - 1;
 
 	if (!(dbp->get)(dbp, &key, &data, 0))
 		flags |= YP_SECURE;
@@ -220,7 +219,7 @@ yp_setflags(DB *dbp)
 }
 
 int
-yp_testflag(char *map, char *domain, int flag)
+yp_testflag(const char *map, const char *domain, int flag)
 {
 	char buf[MAXPATHLEN + 2];
 	register struct circleq_entry *qptr;
@@ -501,7 +500,7 @@ yp_get_record(const char *domain, const 
 
 #ifdef DB_CACHE
 	if (TAILQ_FIRST(&qhead)->dbptr->size) {
-		TAILQ_FIRST(&qhead)->dbptr->key = "";
+		TAILQ_FIRST(&qhead)->dbptr->key = nullbuf;
 		TAILQ_FIRST(&qhead)->dbptr->size = 0;
 	}
 #else

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_dnslookup.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_dnslookup.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_dnslookup.c	Mon May 30 02:41:04 2011	(r222471)
@@ -223,7 +223,7 @@ yp_send_dns_reply(struct circleq_dnsentr
 {
 	ypresponse result_v1;
 	ypresp_val result_v2;
-	unsigned long xid;
+	unsigned long xid = 0;
 	struct sockaddr_in client_addr;
 	xdrproc_t xdrfunc;
 	char *result;
@@ -456,7 +456,7 @@ yp_async_lookup_name(struct svc_req *rqs
 	pending++;
 
 	if (debug)
-		yp_error("queueing async DNS name lookup (%d)", q->id);
+		yp_error("queueing async DNS name lookup (%lu)", q->id);
 
 	yp_prune_dnsq();
 	return(YP_TRUE);
@@ -544,7 +544,7 @@ yp_async_lookup_addr(struct svc_req *rqs
 	pending++;
 
 	if (debug)
-		yp_error("queueing async DNS address lookup (%d)", q->id);
+		yp_error("queueing async DNS address lookup (%lu)", q->id);
 
 	yp_prune_dnsq();
 	return(YP_TRUE);

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_error.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_error.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_error.c	Mon May 30 02:41:04 2011	(r222471)
@@ -48,8 +48,6 @@ __FBSDID("$FreeBSD$");
 int debug;
 extern int _rpcpmstart;
 
-extern char *progname;
-
 static void __verr(const char *fmt, va_list ap) __printflike(1, 0);
 
 static void __verr(const char *fmt, va_list ap)

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_extern.h
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_extern.h	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_extern.h	Mon May 30 02:41:04 2011	(r222471)
@@ -69,8 +69,8 @@ extern int	ypdb_debug;
 extern int	do_dns;
 extern int	children;
 extern int	resfd;
-extern char 	*progname;
-extern char	*yp_dir;
+extern const char 	*progname;
+extern const char	*yp_dir;
 extern pid_t	yp_pid;
 extern char	securenets_path[MAXPATHLEN];
 extern enum yp_snf_format {
@@ -111,8 +111,9 @@ extern DB	*yp_open_db(const char *, cons
 extern DB	*yp_open_db_cache(const char *, const char *, const char *, int);
 extern void	yp_flush_all(void);
 extern void	yp_init_dbs(void);
-extern int	yp_testflag(char *, char *, int);
+extern int	yp_testflag(const char *, const char *, int);
 extern int	load_securenets(void);
+extern void	show_securenets(void);
 
 #ifdef DB_CACHE
 extern ypstat	yp_select_map(char *, char *, keydat *, int);

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_main.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_main.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_main.c	Mon May 30 02:41:04 2011	(r222471)
@@ -84,15 +84,9 @@ static enum rpcsvcstate {
 	_SERVING,
 } _rpcsvcstate;
 
-extern void ypprog_1(struct svc_req *, SVCXPRT *);
-extern void ypprog_2(struct svc_req *, SVCXPRT *);
-extern int _rpc_dtablesize(void);
-
-char securenets_path[MAXPATHLEN];
-enum yp_snf_format securenets_format = YP_SNF_NATIVE;
-char *progname = "ypserv";
-char *yp_dir = _PATH_YP;
-static char *servname = "0";
+const char *progname = "ypserv";
+const char *yp_dir = _PATH_YP;
+static char *servname = NULL;
 
 int do_dns = 0;
 int resfd;
@@ -117,7 +111,7 @@ static SLIST_HEAD(, bindaddrlistent) ble
 	SLIST_HEAD_INITIALIZER(ble_head);
 
 static void
-_msgout(char* msg, ...)
+_msgout(const char* msg, ...)
 {
 	va_list ap;
 
@@ -226,8 +220,9 @@ usage(void)
 static void
 closedown(int sig)
 {
+	if (sig != SIGALRM)
+		return;
 	if (_rpcsvcstate == _IDLE) {
-		extern fd_set svc_fdset;
 		static int size;
 		int i, openfd;
 
@@ -264,10 +259,13 @@ create_service(const int sock, const str
 	struct socklistent *slep;
 	struct bindaddrlistent *blep;
 	struct netbuf svcaddr;
+	char nullserv[] = "0";
 
 	SLIST_INIT(&sle_head);
 	memset(&hints, 0, sizeof(hints));
 	memset(&svcaddr, 0, sizeof(svcaddr));
+	if (servname == NULL)
+		servname = nullserv;
 
 	hints.ai_family = si->si_af;
 	hints.ai_socktype = si->si_socktype;
@@ -285,8 +283,9 @@ create_service(const int sock, const str
 			error = getaddrinfo(blep->ble_hostname, servname,
 				    &hints, &res0);
 			if (error) {
-				_msgout("getaddrinfo(): %s",
-				    gai_strerror(error));
+				_msgout("%s: getaddrinfo(): %s",
+					__func__,
+					gai_strerror(error));
 				return (-1);
 			}
 			for (res = res0; res; res = res->ai_next) {
@@ -341,7 +340,8 @@ create_service(const int sock, const str
 				 * If servname == "0", redefine it by using
 				 * the bound socket.
 				 */
-				if (strncmp("0", servname, 1) == 0) {
+				if (servname == NULL ||
+				    strncmp("0", servname, 1) == 0) {
 					struct sockaddr *sap;
 					socklen_t slen;
 					char *sname;

Modified: user/hrs/ipv6/usr.sbin/ypserv/yp_server.c
==============================================================================
--- user/hrs/ipv6/usr.sbin/ypserv/yp_server.c	Mon May 30 02:02:15 2011	(r222470)
+++ user/hrs/ipv6/usr.sbin/ypserv/yp_server.c	Mon May 30 02:41:04 2011	(r222471)
@@ -48,11 +48,10 @@ __FBSDID("$FreeBSD$");
 #include <rpc/rpc.h>
 
 int children = 0;
+static char nullbuf[] = "";
 
 #define	MASTER_STRING	"YP_MASTER_NAME"
-#define	MASTER_SZ	sizeof(MASTER_STRING) - 1
 #define	ORDER_STRING	"YP_LAST_MODIFIED"
-#define	ORDER_SZ	sizeof(ORDER_STRING) - 1
 
 static pid_t
 yp_fork(void)
@@ -76,6 +75,7 @@ ypproc_null_2_svc(void *argp, struct svc
 	static char * result;
 	static char rval = 0;
 
+	argp = NULL;
 #ifdef DB_CACHE
 	if (yp_access(NULL, NULL, (struct svc_req *)rqstp))
 #else
@@ -135,7 +135,7 @@ ypproc_match_2_svc(ypreq_key *argp, stru
 {
 	static ypresp_val  result;
 
-	result.val.valdat_val = "";
+	result.val.valdat_val = nullbuf;
 	result.val.valdat_len = 0;
 
 #ifdef DB_CACHE
@@ -205,7 +205,7 @@ ypproc_first_2_svc(ypreq_nokey *argp, st
 {
 	static ypresp_key_val  result;
 
-	result.val.valdat_val = result.key.keydat_val = "";
+	result.val.valdat_val = result.key.keydat_val = nullbuf;
 	result.val.valdat_len = result.key.keydat_len = 0;
 
 #ifdef DB_CACHE
@@ -237,7 +237,7 @@ ypproc_next_2_svc(ypreq_key *argp, struc
 {
 	static ypresp_key_val  result;
 
-	result.val.valdat_val = result.key.keydat_val = "";
+	result.val.valdat_val = result.key.keydat_val = nullbuf;
 	result.val.valdat_len = result.key.keydat_len = 0;
 
 #ifdef DB_CACHE
@@ -426,6 +426,7 @@ ypproc_clear_2_svc(void *argp, struct sv
 	static char * result;
 	static char rval = 0;
 
+	argp = NULL;
 #ifdef DB_CACHE
 	if (yp_access(NULL, NULL, (struct svc_req *)rqstp))
 #else
@@ -494,7 +495,7 @@ ypproc_all_2_svc(ypreq_nokey *argp, stru
 	 */
 	result.more = TRUE;
 	result.ypresp_all_u.val.key.keydat_len = 0;
-	result.ypresp_all_u.val.key.keydat_val = "";
+	result.ypresp_all_u.val.key.keydat_val = nullbuf;
 
 #ifdef DB_CACHE
 	if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
@@ -574,10 +575,11 @@ ypproc_master_2_svc(ypreq_nokey *argp, s
 {
 	static ypresp_master  result;
 	static char ypvalbuf[YPMAXRECORD];
-	keydat key = { MASTER_SZ, MASTER_STRING };
+	char keybuf[] = MASTER_STRING;
+	keydat key = { sizeof(keybuf) - 1, keybuf };
 	valdat val;
 
-	result.peer = "";
+	result.peer = nullbuf;
 
 #ifdef DB_CACHE
 	if (yp_access(argp->map, argp->domain, (struct svc_req *)rqstp)) {
@@ -612,7 +614,7 @@ ypproc_master_2_svc(ypreq_nokey *argp, s
 		ypvalbuf[val.valdat_len] = '\0';
 		result.peer = ypvalbuf;
 	} else
-		result.peer = "";
+		result.peer = nullbuf;
 
 	return (&result);
 }
@@ -621,7 +623,8 @@ ypresp_order *
 ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
 {
 	static ypresp_order  result;
-	keydat key = { ORDER_SZ, ORDER_STRING };
+	char keybuf[] = ORDER_STRING;
+	keydat key = { sizeof(keybuf) - 1, keybuf };
 	valdat val;
 
 	result.ordernum = 0;
@@ -662,7 +665,8 @@ ypproc_order_2_svc(ypreq_nokey *argp, st
 	return (&result);
 }
 
-static void yp_maplist_free(struct ypmaplist *yp_maplist)
+static void
+yp_maplist_free(struct ypmaplist *yp_maplist)
 {
 	register struct ypmaplist *next;
 
@@ -815,7 +819,7 @@ ypoldproc_match_1_svc(yprequest *argp, s
 	ypresp_val *v2_result;
 
 	result.yp_resptype = YPRESP_VAL;
-	result.ypresponse_u.yp_resp_valtype.val.valdat_val = "";
+	result.ypresponse_u.yp_resp_valtype.val.valdat_val = nullbuf;
 	result.ypresponse_u.yp_resp_valtype.val.valdat_len = 0;
 
 	if (argp->yp_reqtype != YPREQ_KEY) {
@@ -844,7 +848,7 @@ ypoldproc_first_1_svc(yprequest *argp, s
 
 	result.yp_resptype = YPRESP_KEY_VAL;
 	result.ypresponse_u.yp_resp_key_valtype.val.valdat_val =
-	result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = "";
+	result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = nullbuf;
 	result.ypresponse_u.yp_resp_key_valtype.val.valdat_len =
 	result.ypresponse_u.yp_resp_key_valtype.key.keydat_len = 0;
 
@@ -875,7 +879,7 @@ ypoldproc_next_1_svc(yprequest *argp, st
 
 	result.yp_resptype = YPRESP_KEY_VAL;
 	result.ypresponse_u.yp_resp_key_valtype.val.valdat_val =
-	result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = "";
+	result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = nullbuf;
 	result.ypresponse_u.yp_resp_key_valtype.val.valdat_len =
 	result.ypresponse_u.yp_resp_key_valtype.key.keydat_len = 0;
 
@@ -916,7 +920,7 @@ ypoldproc_poll_1_svc(yprequest *argp, st
 	 * I hope this is right.
 	 */
 	result.ypresponse_u.yp_resp_map_parmstype.ordernum = 0;
-	result.ypresponse_u.yp_resp_map_parmstype.peer = "";
+	result.ypresponse_u.yp_resp_map_parmstype.peer = nullbuf;
 
 	if (argp->yp_reqtype != YPREQ_MAP_PARMS) {
 		return(&result);
@@ -956,6 +960,8 @@ ypoldproc_push_1_svc(yprequest *argp, st
 	/*
 	 * Not implemented.
 	 */
+	argp = NULL;
+	rqstp = NULL;
 
 	return (&result);
 }
@@ -968,6 +974,8 @@ ypoldproc_pull_1_svc(yprequest *argp, st
 	/*
 	 * Not implemented.
 	 */
+	argp = NULL;
+	rqstp = NULL;
 
 	return (&result);
 }
@@ -980,6 +988,8 @@ ypoldproc_get_1_svc(yprequest *argp, str
 	/*
 	 * Not implemented.
 	 */
+	argp = NULL;
+	rqstp = NULL;
 
 	return (&result);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105300241.p4U2f4Vk056562>