From 0f2cb9b020b907000a28323fc57a82fdb7d6626d Mon Sep 17 00:00:00 2001 From: des Date: Wed, 6 Feb 2002 13:30:31 +0000 Subject: Apply the following mechanical transformations in preparation for ansification and constification: s{\s+__P\((\(.*?\))\)}{$1}g; s{\(\s+}{\(}g; s{\s+\)}{\)}g; s{\s+,}{,}g; s{(\s+)(for|if|switch|while)\(}{$1$2 \(}g; s{return ([^\(].*?);}{return ($1);}g; s{([\w\)])([!=+/\*-]?=)([\w\(+-])}{$1 $2 $3}g; s{\s+$}{\n};g Also add $FreeBSD$ where needed. MFC after: 1 week --- usr.sbin/rpc.yppasswdd/pw_util.c | 2 +- usr.sbin/rpc.yppasswdd/yppasswdd_extern.h | 18 ++--- usr.sbin/rpc.yppasswdd/yppasswdd_main.c | 2 +- usr.sbin/rpc.yppasswdd/yppasswdd_server.c | 12 ++-- usr.sbin/rpc.ypupdated/update.c | 4 +- usr.sbin/rpc.ypupdated/yp_dbdelete.c | 2 +- usr.sbin/rpc.ypupdated/yp_dbupdate.c | 4 +- usr.sbin/rpc.ypupdated/ypupdated_extern.h | 8 +-- usr.sbin/rpc.ypupdated/ypupdated_main.c | 2 +- usr.sbin/rpc.ypupdated/ypupdated_server.c | 2 +- usr.sbin/rpc.ypxfrd/ypxfrd_extern.h | 10 +-- usr.sbin/rpc.ypxfrd/ypxfrd_main.c | 2 +- usr.sbin/rpc.ypxfrd/ypxfrd_server.c | 2 +- usr.sbin/yp_mkdb/yp_mkdb.c | 10 +-- usr.sbin/ypbind/yp_ping.c | 2 +- usr.sbin/ypbind/yp_ping.h | 6 +- usr.sbin/ypbind/ypbind.c | 110 +++++++++++++++--------------- usr.sbin/yppoll/yppoll.c | 6 +- usr.sbin/yppush/yppush_extern.h | 4 +- usr.sbin/yppush/yppush_main.c | 24 +++---- usr.sbin/ypserv/yp_access.c | 10 +-- usr.sbin/ypserv/yp_dblookup.c | 12 ++-- usr.sbin/ypserv/yp_dnslookup.c | 10 +-- usr.sbin/ypserv/yp_extern.h | 54 +++++++-------- usr.sbin/ypserv/yp_main.c | 8 +-- usr.sbin/ypserv/yp_server.c | 12 ++-- usr.sbin/ypset/ypset.c | 26 +++---- 27 files changed, 184 insertions(+), 180 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/rpc.yppasswdd/pw_util.c b/usr.sbin/rpc.yppasswdd/pw_util.c index f65f03d..86535b8 100644 --- a/usr.sbin/rpc.yppasswdd/pw_util.c +++ b/usr.sbin/rpc.yppasswdd/pw_util.c @@ -150,7 +150,7 @@ pw_mkdb(username) /* Temporarily turn off SIGCHLD catching */ install_reaper(0); if (!(pid = vfork())) { - if(!username) { + if (!username) { execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname, (char *)NULL); } else { diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h b/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h index eec2684..5590639 100644 --- a/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h +++ b/usr.sbin/rpc.yppasswdd/yppasswdd_extern.h @@ -57,14 +57,14 @@ extern char *yp_dir; extern char *progname; -extern void do_master __P(( void )); -extern void yppasswdprog_1 __P(( struct svc_req *, register SVCXPRT * )); -extern void master_yppasswdprog_1 __P(( struct svc_req *, - register SVCXPRT * )); -extern void reaper __P(( int )); -extern void install_reaper __P(( int )); -extern int pw_copy __P(( int, int, struct passwd * )); -extern char *ok_shell __P (( char * )); +extern void do_master(void); +extern void yppasswdprog_1(struct svc_req *, register SVCXPRT *); +extern void master_yppasswdprog_1 __P((struct svc_req *, + register SVCXPRT *)); +extern void reaper(int); +extern void install_reaper(int); +extern int pw_copy(int, int, struct passwd *); +extern char *ok_shell __P ((char *)); extern char *passfile; extern char *passfile_default; extern char *tempname; @@ -76,4 +76,4 @@ extern int multidomain; extern int resvport; extern int inplace; extern int verbose; -extern int _rpc_dtablesize __P((void)); +extern int _rpc_dtablesize(void); diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_main.c b/usr.sbin/rpc.yppasswdd/yppasswdd_main.c index 8684810..be42263 100644 --- a/usr.sbin/rpc.yppasswdd/yppasswdd_main.c +++ b/usr.sbin/rpc.yppasswdd/yppasswdd_main.c @@ -169,7 +169,7 @@ main(argc, argv) debug = 1; while ((ch = getopt(argc, argv, "t:d:p:sfamuivh")) != -1) { - switch(ch) { + switch (ch) { case 't': passfile_default = optarg; break; diff --git a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c index d61390d..ab70560 100644 --- a/usr.sbin/rpc.yppasswdd/yppasswdd_server.c +++ b/usr.sbin/rpc.yppasswdd/yppasswdd_server.c @@ -76,7 +76,7 @@ void reaper(sig) if (sig > 0) { if (sig == SIGCHLD) - while(wait3(&st, WNOHANG, NULL) > 0) ; + while (wait3(&st, WNOHANG, NULL) > 0) ; } else { pid = waitpid(pid, &pstat, 0); } @@ -538,7 +538,7 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_req *rqstp) key.data = argp->newpw.pw_name; key.size = strlen(argp->newpw.pw_name); - if ((rval=yp_get_record(domain,"master.passwd.byname", + if ((rval = yp_get_record(domain,"master.passwd.byname", &key, &data, 0)) != YP_TRUE) { if (rval == YP_NOKEY) { yp_error("user %s not found in passwd database", @@ -642,7 +642,7 @@ cleaning up and bailing out"); } } - switch((pid = fork())) { + switch ((pid = fork())) { case 0: if (inplace && !rval) { execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile, @@ -733,7 +733,7 @@ procedure!\n", inet_ntoa(rqhost->sin_addr), rqhost->sin_port); svcerr_auth(transp, AUTH_BADCRED); return(&result); } - + if (uid) { yp_error("caller euid is %d, expecting 0 -- rejecting request", uid); @@ -794,7 +794,7 @@ allow additions to be made to the password database"); snprintf(passfile_buf, sizeof(passfile_buf), "%s/%s/master.passwd", yp_dir, argp->domain); passfile = (char *)&passfile_buf; - } + } if ((pfd = pw_lock()) < 0) { return (&result); @@ -828,7 +828,7 @@ cleaning up and bailing out"); } } - switch((pid = fork())) { + switch ((pid = fork())) { case 0: if (inplace && !rval) { execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile, diff --git a/usr.sbin/rpc.ypupdated/update.c b/usr.sbin/rpc.ypupdated/update.c index 376743b..6566f46 100644 --- a/usr.sbin/rpc.ypupdated/update.c +++ b/usr.sbin/rpc.ypupdated/update.c @@ -78,7 +78,7 @@ static char PKFILE[] = "/etc/publickey"; #endif /* YP */ #ifdef YP -static int _openchild __P(( char *, FILE **, FILE ** )); +static int _openchild(char *, FILE **, FILE **); /* * Determine if requester is allowed to update the given map, @@ -247,7 +247,7 @@ basename(path) extern char *malloc(); #endif -static int match __P(( char * , char * )); +static int match(char *, char *); /* * Determine if requester is allowed to update the given map, diff --git a/usr.sbin/rpc.ypupdated/yp_dbdelete.c b/usr.sbin/rpc.ypupdated/yp_dbdelete.c index f66b974..8a97b19 100644 --- a/usr.sbin/rpc.ypupdated/yp_dbdelete.c +++ b/usr.sbin/rpc.ypupdated/yp_dbdelete.c @@ -55,7 +55,7 @@ int yp_del_record(dbp,key) int rval; if ((rval = (dbp->del)(dbp,key,0))) { - switch(rval) { + switch (rval) { case 1: return(YP_FALSE); break; diff --git a/usr.sbin/rpc.ypupdated/yp_dbupdate.c b/usr.sbin/rpc.ypupdated/yp_dbupdate.c index 8fb1eba..b94b4b7 100644 --- a/usr.sbin/rpc.ypupdated/yp_dbupdate.c +++ b/usr.sbin/rpc.ypupdated/yp_dbupdate.c @@ -55,7 +55,7 @@ static int yp_domake(map, domain) { int pid; - switch((pid = fork())) { + switch ((pid = fork())) { case 0: execlp(MAP_UPDATE_PATH, MAP_UPDATE, map, domain, (char *)NULL); yp_error("couldn't exec map update process: %s", @@ -104,7 +104,7 @@ int ypmap_update(netname, map, op, keylen, keyval, datlen, datval) data.data = datval; data.size = datlen; - switch(op) { + switch (op) { case YPOP_DELETE: /* delete this entry */ rval = yp_del_record(dbp, &key); if (rval == YP_TRUE) diff --git a/usr.sbin/rpc.ypupdated/ypupdated_extern.h b/usr.sbin/rpc.ypupdated/ypupdated_extern.h index 17e9ee9..6906f1c 100644 --- a/usr.sbin/rpc.ypupdated/ypupdated_extern.h +++ b/usr.sbin/rpc.ypupdated/ypupdated_extern.h @@ -24,7 +24,7 @@ #define MAP_UPDATE_PATH YPLIBDIR MAP_UPDATE extern int children; -extern void ypu_prog_1 __P(( struct svc_req *, register SVCXPRT * )); -extern int localupdate __P(( char *, char *, u_int, u_int, char *, u_int, char * )); -extern int ypmap_update __P(( char *, char *, u_int, u_int, char *, u_int, char * )); -extern int yp_del_record __P(( DB *, DBT * )); +extern void ypu_prog_1(struct svc_req *, register SVCXPRT *); +extern int localupdate(char *, char *, u_int, u_int, char *, u_int, char *); +extern int ypmap_update(char *, char *, u_int, u_int, char *, u_int, char *); +extern int yp_del_record(DB *, DBT *); diff --git a/usr.sbin/rpc.ypupdated/ypupdated_main.c b/usr.sbin/rpc.ypupdated/ypupdated_main.c index 4d3f126..85cd7bf 100644 --- a/usr.sbin/rpc.ypupdated/ypupdated_main.c +++ b/usr.sbin/rpc.ypupdated/ypupdated_main.c @@ -197,7 +197,7 @@ main(argc, argv) int ch; while ((ch = getopt(argc, argv, "p:h")) != -1) { - switch(ch) { + switch (ch) { case 'p': yp_dir = optarg; break; diff --git a/usr.sbin/rpc.ypupdated/ypupdated_server.c b/usr.sbin/rpc.ypupdated/ypupdated_server.c index b306268..08f9f56 100644 --- a/usr.sbin/rpc.ypupdated/ypupdated_server.c +++ b/usr.sbin/rpc.ypupdated/ypupdated_server.c @@ -136,7 +136,7 @@ unsigned int *ypu_insert_1_svc(args, svcreq) static int res; char *netname; enum auth_stat astat; - + res = 0; astat = yp_checkauth(svcreq); diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h b/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h index 4fb51ec..5aba934 100644 --- a/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h +++ b/usr.sbin/rpc.ypxfrd/ypxfrd_extern.h @@ -42,9 +42,9 @@ extern int forked; extern int children; -extern void load_securenets __P(( void )); -extern void yp_error __P((const char *, ...)); -extern int yp_access __P((const char *, const struct svc_req * )); -extern int yp_validdomain __P((const char * )); +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 __P(( struct svc_req *, register SVCXPRT * )); +extern void ypxfrd_freebsd_prog_1(struct svc_req *, register SVCXPRT *); diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c index e83b997..511539e 100644 --- a/usr.sbin/rpc.ypxfrd/ypxfrd_main.c +++ b/usr.sbin/rpc.ypxfrd/ypxfrd_main.c @@ -204,7 +204,7 @@ main(argc, argv) int ch; while ((ch = getopt(argc, argv, "p:h")) != -1) { - switch(ch) { + switch (ch) { case 'p': yp_dir = optarg; break; diff --git a/usr.sbin/rpc.ypxfrd/ypxfrd_server.c b/usr.sbin/rpc.ypxfrd/ypxfrd_server.c index 1a4b2e5..f1b6ba1 100644 --- a/usr.sbin/rpc.ypxfrd/ypxfrd_server.c +++ b/usr.sbin/rpc.ypxfrd/ypxfrd_server.c @@ -58,7 +58,7 @@ xdr_my_xfr(register XDR *xdrs, xfr *objp) { unsigned char buf[XFRBLOCKSIZE]; - while(1) { + while (1) { if ((objp->xfr_u.xfrblock_buf.xfrblock_buf_len = read(fp, &buf, XFRBLOCKSIZE)) != -1) { objp->ok = TRUE; diff --git a/usr.sbin/yp_mkdb/yp_mkdb.c b/usr.sbin/yp_mkdb/yp_mkdb.c index a5fed00..6f0d71b 100644 --- a/usr.sbin/yp_mkdb/yp_mkdb.c +++ b/usr.sbin/yp_mkdb/yp_mkdb.c @@ -88,7 +88,7 @@ static void unwind(map) err(1, "open_db(%s) failed", map); key.data = NULL; - while(yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) + while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) printf("%.*s %.*s\n", key.size,key.data,data.size,data.data); (void)(dbp->close)(dbp); @@ -119,7 +119,7 @@ int main (argc, argv) char hname[MAXHOSTNAMELEN + 2]; while ((ch = getopt(argc, argv, "uhcbsfd:i:o:m:")) != -1) { - switch(ch) { + switch (ch) { case 'f': filter_plusminus++; break; @@ -250,7 +250,7 @@ int main (argc, argv) yp_put_record(dbp, &key, &data, 0); } - while(fgets((char *)&buf, sizeof(buf), ifp)) { + while (fgets((char *)&buf, sizeof(buf), ifp)) { char *sep = NULL; int rval; @@ -259,7 +259,7 @@ int main (argc, argv) *sep = '\0'; /* handle backslash line continuations */ - while(buf[strlen(buf) - 1] == '\\') { + while (buf[strlen(buf) - 1] == '\\') { fgets((char *)&buf[strlen(buf) - 1], sizeof(buf) - strlen(buf), ifp); if ((sep = strchr(buf, '\n'))) @@ -312,7 +312,7 @@ int main (argc, argv) data.size = strlen(datbuf); if ((rval = yp_put_record(dbp, &key, &data, 0)) != YP_TRUE) { - switch(rval) { + switch (rval) { case YP_FALSE: warnx("duplicate key '%s' - skipping", keybuf); break; diff --git a/usr.sbin/ypbind/yp_ping.c b/usr.sbin/ypbind/yp_ping.c index be9434e..d3ea4c9 100644 --- a/usr.sbin/ypbind/yp_ping.c +++ b/usr.sbin/ypbind/yp_ping.c @@ -235,7 +235,7 @@ int __yp_ping(restricted_addrs, cnt, dom, port) char *dom; short *port; { - struct timeval tv = { 5 , 0 }; + struct timeval tv = { 5, 0 }; struct ping_req **reqs; unsigned long i; int async; diff --git a/usr.sbin/ypbind/yp_ping.h b/usr.sbin/ypbind/yp_ping.h index eadb5de..80e6a78 100644 --- a/usr.sbin/ypbind/yp_ping.h +++ b/usr.sbin/ypbind/yp_ping.h @@ -1 +1,5 @@ -extern int __yp_ping __P(( struct in_addr *, int, char *, short * )); +/* + * $FreeBSD$ + */ + +extern int __yp_ping(struct in_addr *, int, char *, short *); diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index 5d8d055..3892487 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -95,18 +95,18 @@ extern bool_t xdr_domainname(), xdr_ypbind_resp(); extern bool_t xdr_ypreq_key(), xdr_ypresp_val(); extern bool_t xdr_ypbind_setdom(); -void checkwork __P((void)); -void *ypbindproc_null_2_yp __P((SVCXPRT *, void *, CLIENT *)); -void *ypbindproc_setdom_2_yp __P((SVCXPRT *, struct ypbind_setdom *, CLIENT *)); -void rpc_received __P((char *, struct sockaddr_in *, int )); -void broadcast __P((struct _dom_binding *)); -int ping __P((struct _dom_binding *)); -int tell_parent __P((char *, struct sockaddr_in *)); -void handle_children __P(( struct _dom_binding * )); -void reaper __P((int)); -void terminate __P((int)); -void yp_restricted_mode __P((char *)); -int verify __P((struct in_addr)); +void checkwork(void); +void *ypbindproc_null_2_yp(SVCXPRT *, void *, CLIENT *); +void *ypbindproc_setdom_2_yp(SVCXPRT *, struct ypbind_setdom *, CLIENT *); +void rpc_received(char *, struct sockaddr_in *, int); +void broadcast(struct _dom_binding *); +int ping(struct _dom_binding *); +int tell_parent(char *, struct sockaddr_in *); +void handle_children(struct _dom_binding *); +void reaper(int); +void terminate(int); +void yp_restricted_mode(char *); +int verify(struct in_addr); char *domain_name; struct _dom_binding *ypbindlist; @@ -187,28 +187,28 @@ rejecting.", *argp); return(&res); } - for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) { - if( strcmp(ypdb->dom_domain, *argp) == 0) + for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) { + if (strcmp(ypdb->dom_domain, *argp) == 0) break; } - if(ypdb==NULL) { + if (ypdb == NULL) { if (yp_restricted) { syslog(LOG_NOTICE, "Running in restricted mode -- request to bind domain \"%s\" rejected.\n", *argp); - return &res; + return (&res); } if (domains >= MAX_DOMAINS) { syslog(LOG_WARNING, "domain limit (%d) exceeded", MAX_DOMAINS); res.ypbind_resp_u.ypbind_error = YPBIND_ERR_RESC; - return &res; + return (&res); } ypdb = (struct _dom_binding *)malloc(sizeof *ypdb); if (ypdb == NULL) { syslog(LOG_WARNING, "malloc: %m"); res.ypbind_resp_u.ypbind_error = YPBIND_ERR_RESC; - return &res; + return (&res); } bzero((char *)ypdb, sizeof *ypdb); strncpy(ypdb->dom_domain, *argp, sizeof ypdb->dom_domain); @@ -225,7 +225,7 @@ rejecting.", *argp); } if (ping(ypdb)) { - return &res; + return (&res); } res.ypbind_status = YPBIND_SUCC_VAL; @@ -237,7 +237,7 @@ rejecting.", *argp); /*printf("domain %s at %s/%d\n", ypdb->dom_domain, inet_ntoa(ypdb->dom_server_addr.sin_addr), ntohs(ypdb->dom_server_addr.sin_port));*/ - return &res; + return (&res); } void * @@ -256,9 +256,9 @@ rejecting.", argp->ypsetdom_domain); } fromsin = svc_getcaller(transp); - switch(ypsetmode) { + switch (ypsetmode) { case YPSET_LOCAL: - if( fromsin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { + if (fromsin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { svcerr_noprog(transp); return(NULL); } @@ -271,12 +271,12 @@ rejecting.", argp->ypsetdom_domain); return(NULL); } - if(ntohs(fromsin->sin_port) >= IPPORT_RESERVED) { + if (ntohs(fromsin->sin_port) >= IPPORT_RESERVED) { svcerr_noprog(transp); return(NULL); } - if(argp->ypsetdom_vers != YPVERS) { + if (argp->ypsetdom_vers != YPVERS) { svcerr_noprog(transp); return(NULL); } @@ -318,10 +318,10 @@ register SVCXPRT *transp; break; case YPBINDPROC_SETDOM: - switch(rqstp->rq_cred.oa_flavor) { + switch (rqstp->rq_cred.oa_flavor) { case AUTH_UNIX: creds = (struct authunix_parms *)rqstp->rq_clntcred; - if( creds->aup_uid != 0) { + if (creds->aup_uid != 0) { svcerr_auth(transp, AUTH_BADCRED); return; } @@ -358,7 +358,7 @@ int sig; { int st; - while(wait3(&st, WNOHANG, NULL) > 0) + while (wait3(&st, WNOHANG, NULL) > 0) children--; } @@ -371,7 +371,7 @@ int sig; if (ppid != getpid()) exit(0); - for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) { + for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) { close(ypdb->dom_lockfd); if (ypdb->dom_broadcast_pid) kill(ypdb->dom_broadcast_pid, SIGINT); @@ -400,16 +400,16 @@ char **argv; if ((yplockfd = (open(YPBINDLOCK, O_RDONLY|O_CREAT, 0444))) == -1) err(1, "%s", YPBINDLOCK); - if(flock(yplockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) + if (flock(yplockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) errx(1, "another ypbind is already running. Aborting"); /* XXX domainname will be overriden if we use restricted mode */ yp_get_default_domain(&domain_name); - if( domain_name[0] == '\0') + if (domain_name[0] == '\0') errx(1, "domainname not set. Aborting"); - for(i=1; idom_pnext; if (READFD > 0 && FD_ISSET(READFD, &fdsr)) { handle_children(ypdb); @@ -517,7 +517,7 @@ checkwork() { struct _dom_binding *ypdb; - for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) + for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) ping(ypdb); } @@ -555,12 +555,12 @@ struct _dom_binding *ypdb; if (d > 0 && a > 0) rpc_received((char *)&buf, &addr, 0); else { - for(y=ypbindlist; y; y=y->dom_pnext) { + for (y = ypbindlist; y; y = y->dom_pnext) { if (y == ypdb) break; prev = y; } - switch(ypdb->dom_default) { + switch (ypdb->dom_default) { case 0: if (prev == NULL) ypbindlist = y->dom_pnext; @@ -633,17 +633,17 @@ struct sockaddr_in *addr; bzero((char *)addr, sizeof(struct sockaddr_in)); if (tell_parent(broad_domain->dom_domain, addr)) syslog(LOG_WARNING, "lost connection to parent"); - return TRUE; + return (TRUE); } if (yp_restricted && verify(addr->sin_addr)) { retries++; syslog(LOG_NOTICE, "NIS server at %s not in restricted mode access list -- rejecting.\n",inet_ntoa(addr->sin_addr)); - return FALSE; + return (FALSE); } else { if (tell_parent(broad_domain->dom_domain, addr)) syslog(LOG_WARNING, "lost connection to parent"); - return TRUE; + return (TRUE); } } @@ -679,7 +679,7 @@ struct _dom_binding *ypdb; broad_domain = ypdb; flock(ypdb->dom_lockfd, LOCK_UN); - switch((ypdb->dom_broadcast_pid = fork())) { + switch ((ypdb->dom_broadcast_pid = fork())) { case 0: close(READFD); signal(SIGCHLD, SIG_DFL); @@ -698,7 +698,7 @@ struct _dom_binding *ypdb; } /* Release all locks before doing anything else. */ - while(ypbindlist) { + while (ypbindlist) { close(ypbindlist->dom_lockfd); ypbindlist = ypbindlist->dom_pnext; } @@ -833,11 +833,11 @@ int force; /*printf("returned from %s/%d about %s\n", inet_ntoa(raddrp->sin_addr), ntohs(raddrp->sin_port), dom);*/ - if(dom==NULL) + if (dom == NULL) return; - for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) { - if( strcmp(ypdb->dom_domain, dom) == 0) + for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) { + if (strcmp(ypdb->dom_domain, dom) == 0) break; prev = ypdb; } @@ -865,7 +865,7 @@ int force; } if (raddrp->sin_addr.s_addr == (long)0) { - switch(ypdb->dom_default) { + switch (ypdb->dom_default) { case 0: if (prev == NULL) ypbindlist = ypdb->dom_pnext; @@ -888,7 +888,7 @@ int force; } } - if(ypdb==NULL) { + if (ypdb == NULL) { if (force == 0) return; ypdb = (struct _dom_binding *)malloc(sizeof *ypdb); @@ -916,21 +916,21 @@ int force; ypdb->dom_alive = 1; ypdb->dom_broadcast_pid = 0; - if(ypdb->dom_lockfd != -1) + if (ypdb->dom_lockfd != -1) close(ypdb->dom_lockfd); sprintf(path, "%s/%s.%ld", BINDINGDIR, ypdb->dom_domain, ypdb->dom_vers); #ifdef O_SHLOCK - if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) { + if ((fd = open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) { (void)mkdir(BINDINGDIR, 0755); - if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) + if ((fd = open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) return; } #else - if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) { + if ((fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) { (void)mkdir(BINDINGDIR, 0755); - if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) + if ((fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) return; } flock(fd, LOCK_SH); @@ -952,7 +952,7 @@ int force; *(u_int32_t *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr = raddrp->sin_addr.s_addr; *(u_short *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port = raddrp->sin_port; - if( writev(ypdb->dom_lockfd, iov, 2) != iov[0].iov_len + iov[1].iov_len) { + if (writev(ypdb->dom_lockfd, iov, 2) != iov[0].iov_len + iov[1].iov_len) { syslog(LOG_WARNING, "write: %m"); close(ypdb->dom_lockfd); ypdb->dom_lockfd = -1; @@ -1006,7 +1006,7 @@ char *args; /* ypset and ypsetme not allowed with restricted mode */ ypsetmode = YPSET_NO; - + yp_restricted = i; return; } diff --git a/usr.sbin/yppoll/yppoll.c b/usr.sbin/yppoll/yppoll.c index 207152c..ce66c9f 100644 --- a/usr.sbin/yppoll/yppoll.c +++ b/usr.sbin/yppoll/yppoll.c @@ -67,8 +67,8 @@ char **argv; yp_get_default_domain(&domainname); - while( (c=getopt(argc, argv, "h:d:")) != -1) - switch(c) { + while ((c = getopt(argc, argv, "h:d:")) != -1) + switch (c) { case 'd': domainname = optarg; break; @@ -80,7 +80,7 @@ char **argv; /*NOTREACHED*/ } - if(optind + 1 != argc ) + if (optind + 1 != argc) usage(); inmap = argv[optind]; diff --git a/usr.sbin/yppush/yppush_extern.h b/usr.sbin/yppush/yppush_extern.h index 86ca7a2..2a4fbcc 100644 --- a/usr.sbin/yppush/yppush_extern.h +++ b/usr.sbin/yppush/yppush_extern.h @@ -40,5 +40,5 @@ #ifndef YPPUSH_RESPONSE_TIMEOUT #define YPPUSH_RESPONSE_TIMEOUT 5*60 #endif -extern int _rpc_dtablesize __P((void)); -extern void yppush_xfrrespprog_1 __P(( struct svc_req *, SVCXPRT * )); +extern int _rpc_dtablesize(void); +extern void yppush_xfrrespprog_1(struct svc_req *, SVCXPRT *); diff --git a/usr.sbin/yppush/yppush_main.c b/usr.sbin/yppush/yppush_main.c index 3e693aa..38043a5 100644 --- a/usr.sbin/yppush/yppush_main.c +++ b/usr.sbin/yppush/yppush_main.c @@ -91,7 +91,7 @@ struct jobs *yppush_joblist; /* Linked list of running jobs. */ static char *yppusherr_string(err) int err; { - switch(err) { + switch (err) { case YPPUSH_TIMEDOUT: return("transfer or callback timed out"); case YPPUSH_YPSERV: return("failed to contact ypserv"); case YPPUSH_NOHOST: return("no such host"); @@ -111,7 +111,7 @@ static int yppush_show_status(status, tid) job = yppush_joblist; - while(job) { + while (job) { if (job->tid == tid) break; job = job->next; @@ -129,14 +129,14 @@ static int yppush_show_status(status, tid) job->map, job->server, status == YPPUSH_SUCC ? "succeeded" : "failed"); yp_error("status returned by ypxfr: %s", status > YPPUSH_AGE ? - yppusherr_string(status) : + yppusherr_string(status) : ypxfrerr_string(status)); } job->polled = 1; svc_unregister(job->prognum, 1); - + yppush_running_jobs--; return(0); } @@ -149,7 +149,7 @@ static void yppush_exit(now) int still_pending = 1; /* Let all the information trickle in. */ - while(!now && still_pending) { + while (!now && still_pending) { jptr = yppush_joblist; still_pending = 0; while (jptr) { @@ -188,7 +188,7 @@ static void yppush_exit(now) /* All stats collected and reported -- kill all the stragglers. */ jptr = yppush_joblist; - while(jptr) { + while (jptr) { if (!jptr->polled) yp_error("warning: exiting with transfer \ to %s (transid = %lu) still pending", jptr->server, jptr->tid); @@ -226,8 +226,8 @@ static void yppush_svc_run() { #ifdef FD_SETSIZE fd_set readfds; -#else - int readfds; +#else + int readfds; #endif /* def FD_SETSIZE */ struct timeval timeout; @@ -295,7 +295,7 @@ yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp) /* * Transmit a YPPROC_XFR request to ypserv. - */ + */ static int yppush_send_xfr(job) struct jobs *job; { @@ -340,7 +340,7 @@ static int yppush_send_xfr(job) if ((clnt = clnt_create(job->server, YPPROG, YPVERS, "udp")) == NULL) { yp_error("%s: %s",job->server,clnt_spcreateerror("couldn't \ create udp handle to NIS server")); - switch(rpc_createerr.cf_stat) { + switch (rpc_createerr.cf_stat) { case RPC_UNKNOWNHOST: job->stat = YPPUSH_NOHOST; break; @@ -546,7 +546,7 @@ main(argc,argv) struct sigaction sa; while ((ch = getopt(argc, argv, "d:j:p:h:t:v")) != -1) { - switch(ch) { + switch (ch) { case 'd': yppush_domain = optarg; break; @@ -664,7 +664,7 @@ main(argc,argv) * kick off the transfers by hand. */ tmp = yppush_hostlist; - while(tmp) { + while (tmp) { yppush_foreach(YP_TRUE, NULL, 0, tmp->name, strlen(tmp->name)); tmp = tmp->next; diff --git a/usr.sbin/ypserv/yp_access.c b/usr.sbin/ypserv/yp_access.c index cdf3e50..610f209 100644 --- a/usr.sbin/ypserv/yp_access.c +++ b/usr.sbin/ypserv/yp_access.c @@ -74,7 +74,7 @@ char *yp_procs[] = { "ypoldproc_null", "badproc3", /* placeholder */ /* NIS v2 */ - "ypproc_null" , + "ypproc_null", "ypproc_domain", "ypproc_domain_nonack", "ypproc_match", @@ -121,7 +121,7 @@ void load_securenets() * the list; free the existing list before re-reading the * securenets file. */ - while(securenets) { + while (securenets) { tmp = securenets->next; free(securenets); securenets = tmp; @@ -144,7 +144,7 @@ void load_securenets() securenets = NULL; - while(fgets(linebuf, LINEBUFSZ, fp)) { + while (fgets(linebuf, LINEBUFSZ, fp)) { char addr1[20], addr2[20]; if ((linebuf[0] == '#') @@ -175,7 +175,7 @@ void load_securenets() } fclose(fp); - + } #endif @@ -280,7 +280,7 @@ not privileged", map, inet_ntoa(rqhost->sin_addr), ntohs(rqhost->sin_port)); inet_ntoa(rqhost->sin_addr), ""); #else tmp = securenets; - while(tmp) { + while (tmp) { if (((rqhost->sin_addr.s_addr & ~tmp->mask.s_addr) | tmp->net.s_addr) == rqhost->sin_addr.s_addr) { status = 1; diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c index b3215f9..984736b 100644 --- a/usr.sbin/ypserv/yp_dblookup.c +++ b/usr.sbin/ypserv/yp_dblookup.c @@ -181,10 +181,10 @@ void yp_flush_all() { register struct circleq_entry *qptr; - while(!TAILQ_EMPTY(&qhead)) { + while (!TAILQ_EMPTY(&qhead)) { qptr = TAILQ_FIRST(&qhead); /* save this */ TAILQ_REMOVE(&qhead, qptr, links); - yp_free_qent(qptr); + yp_free_qent(qptr); } numdbs = 0; @@ -415,7 +415,7 @@ again: dbp = dbopen(buf,O_RDONLY, PERM_SECURE, DB_HASH, NULL); if (dbp == NULL) { - switch(errno) { + switch (errno) { #ifdef DB_CACHE case ENFILE: /* @@ -449,7 +449,7 @@ again: * to match against. * * - yp_first_record(): retrieve first key/data base in a database. - * + * * - yp_next_record(): retrieve key/data pair that sequentially follows * the supplied key value in the database. */ @@ -542,7 +542,7 @@ int yp_first_record(dbp,key,data,allow) #endif if (rval == 1) return(YP_NOKEY); - else + else return(YP_BADDB); } @@ -623,7 +623,7 @@ int yp_next_record(dbp,key,data,all,allow) return(YP_NOKEY); } -#ifdef DB_CACHE +#ifdef DB_CACHE } #endif } diff --git a/usr.sbin/ypserv/yp_dnslookup.c b/usr.sbin/ypserv/yp_dnslookup.c index fdbac25..0abffcd 100644 --- a/usr.sbin/ypserv/yp_dnslookup.c +++ b/usr.sbin/ypserv/yp_dnslookup.c @@ -103,7 +103,7 @@ static char *parse(hp) #define BY_DNS_ID 1 #define BY_RPC_XID 2 -extern struct hostent *__dns_getanswer __P((char *, int, char *, int)); +extern struct hostent *__dns_getanswer(char *, int, char *, int); static TAILQ_HEAD(dns_qhead, circleq_dnsentry) qhead; @@ -202,7 +202,7 @@ static struct circleq_dnsentry *yp_find_dnsqent(id, type) register struct circleq_dnsentry *q; TAILQ_FOREACH(q, &qhead, links) { - switch(type) { + switch (type) { case BY_RPC_XID: if (id == q->xid) return(q); @@ -232,7 +232,7 @@ static void yp_send_dns_reply(q, buf) * Set up correct reply struct and * XDR filter depending on ypvers. */ - switch(q->ypvers) { + switch (q->ypvers) { case YPVERS: bzero((char *)&result_v2, sizeof(result_v2)); @@ -319,7 +319,7 @@ void yp_prune_dnsq() register struct circleq_dnsentry *q, *n; q = TAILQ_FIRST(&qhead); - while(q != NULL) { + while (q != NULL) { q->ttl--; n = TAILQ_NEXT(q, links); if (!q->ttl) { @@ -497,7 +497,7 @@ ypstat yp_async_lookup_addr(rqstp, addr) } /* Avoid transmitting dupe requests. */ - if (type == SOCK_DGRAM && + if (type == SOCK_DGRAM && yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL) return(YP_TRUE); diff --git a/usr.sbin/ypserv/yp_extern.h b/usr.sbin/ypserv/yp_extern.h index 75d2dd3..553e296 100644 --- a/usr.sbin/ypserv/yp_extern.h +++ b/usr.sbin/ypserv/yp_extern.h @@ -71,45 +71,45 @@ extern char *yp_dir; extern pid_t yp_pid; extern enum ypstat yp_errno; -extern void yp_error __P((const char *, ...)) __printflike(1, 2); +extern void yp_error(const char *, ...) __printflike(1, 2); #ifdef DB_CACHE -extern int yp_get_record __P(( DB *, const DBT *, DBT *, int)); +extern int yp_get_record(DB *, const DBT *, DBT *, int); #else -extern int yp_get_record __P(( const char *, const char *, const DBT *, DBT *, int)); +extern int yp_get_record(const char *, const char *, const DBT *, DBT *, int); #endif -extern int yp_first_record __P((const DB *, DBT *, DBT *, int)); -extern int yp_next_record __P((const DB *, DBT *, DBT *, int, int)); -extern char *yp_dnsname __P(( char * )); -extern char *yp_dnsaddr __P(( const char * )); +extern int yp_first_record(const DB *, DBT *, DBT *, int); +extern int yp_next_record(const DB *, DBT *, DBT *, int, int); +extern char *yp_dnsname(char *); +extern char *yp_dnsaddr(const char *); #ifdef DB_CACHE -extern int yp_access __P((const char *, const char *, const struct svc_req * )); +extern int yp_access(const char *, const char *, const struct svc_req *); #else -extern int yp_access __P((const char *, const struct svc_req * )); +extern int yp_access(const char *, const struct svc_req *); #endif -extern int yp_validdomain __P((const char * )); -extern DB *yp_open_db __P(( const char *, const char *)); -extern DB *yp_open_db_cache __P(( const char *, const char *, const char *, int )); -extern void yp_flush_all __P(( void )); -extern void yp_init_dbs __P(( void )); -extern int yp_testflag __P(( char *, char *, int )); -extern void load_securenets __P(( void )); +extern int yp_validdomain(const char *); +extern DB *yp_open_db(const char *, const char *); +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 void load_securenets(void); #ifdef DB_CACHE -extern ypstat yp_select_map __P(( char *, char *, keydat *, int )); -extern ypstat yp_getbykey __P(( keydat *, valdat * )); -extern ypstat yp_firstbykey __P(( keydat *, valdat * )); -extern ypstat yp_nextbykey __P(( keydat *, valdat * )); +extern ypstat yp_select_map(char *, char *, keydat *, int); +extern ypstat yp_getbykey(keydat *, valdat *); +extern ypstat yp_firstbykey(keydat *, valdat *); +extern ypstat yp_nextbykey(keydat *, valdat *); #endif -extern unsigned long svcudp_set_xid __P(( SVCXPRT *, unsigned long )); -extern unsigned long svcudp_get_xid __P(( SVCXPRT * )); +extern unsigned long svcudp_set_xid(SVCXPRT *, unsigned long); +extern unsigned long svcudp_get_xid(SVCXPRT *); #ifndef RESOLVER_TIMEOUT #define RESOLVER_TIMEOUT 3600 #endif -extern int yp_init_resolver __P(( void )); -extern void yp_run_dnsq __P(( void )); -extern void yp_prune_dnsq __P(( void )); -extern ypstat yp_async_lookup_name __P(( struct svc_req *, char * )); -extern ypstat yp_async_lookup_addr __P(( struct svc_req *, char * )); +extern int yp_init_resolver(void); +extern void yp_run_dnsq(void); +extern void yp_prune_dnsq(void); +extern ypstat yp_async_lookup_name(struct svc_req *, char *); +extern ypstat yp_async_lookup_addr(struct svc_req *, char *); diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c index 07b2089..c31e3fd 100644 --- a/usr.sbin/ypserv/yp_main.c +++ b/usr.sbin/ypserv/yp_main.c @@ -76,9 +76,9 @@ static int _rpcfdtype; #define _SERVED 1 #define _SERVING 2 -extern void ypprog_1 __P((struct svc_req *, register SVCXPRT *)); -extern void ypprog_2 __P((struct svc_req *, register SVCXPRT *)); -extern int _rpc_dtablesize __P((void)); +extern void ypprog_1(struct svc_req *, register SVCXPRT *); +extern void ypprog_2(struct svc_req *, register SVCXPRT *); +extern int _rpc_dtablesize(void); extern int _rpcsvcstate; /* Set when a request is serviced */ char *progname = "ypserv"; char *yp_dir = _PATH_YP; @@ -235,7 +235,7 @@ main(argc, argv) int ch; while ((ch = getopt(argc, argv, "hdnp:")) != -1) { - switch(ch) { + switch (ch) { case 'd': debug = ypdb_debug = 1; break; diff --git a/usr.sbin/ypserv/yp_server.c b/usr.sbin/ypserv/yp_server.c index 5c57b0b..37ab7ef 100644 --- a/usr.sbin/ypserv/yp_server.c +++ b/usr.sbin/ypserv/yp_server.c @@ -172,7 +172,7 @@ ypproc_match_2_svc(ypreq_key *argp, struct svc_req *rqstp) if (do_dns && result.stat != YP_TRUE && strstr(argp->map, "hosts")) { #endif char nbuf[YPMAXRECORD]; - + /* NUL terminate! NUL terminate!! NUL TERMINATE!!! */ bcopy(argp->key.keydat_val, nbuf, argp->key.keydat_len); nbuf[argp->key.keydat_len] = '\0'; @@ -360,7 +360,7 @@ ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp) YPXFR_RETURN(YPXFR_REFUSED) } - switch(yp_fork()) { + switch (yp_fork()) { case 0: { char g[11], t[11], p[11]; @@ -522,7 +522,7 @@ ypproc_all_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) * async socket I/O?) */ if (!debug) { - switch(yp_fork()) { + switch (yp_fork()) { case 0: break; case -1: @@ -632,7 +632,7 @@ ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) result.stat = YP_BADARGS; return (&result); } - + /* * We could just check the timestamp on the map file, * but that's a hack: we'll only know the last time the file @@ -660,7 +660,7 @@ static void yp_maplist_free(yp_maplist) { register struct ypmaplist *next; - while(yp_maplist) { + while (yp_maplist) { next = yp_maplist->next; free(yp_maplist->map); free(yp_maplist); @@ -736,7 +736,7 @@ ypproc_maplist_2_svc(domainname *argp, struct svc_req *rqstp) result.stat = YP_BADARGS; return (&result); } - + if (yp_validdomain(*argp)) { result.stat = YP_NODOM; return (&result); diff --git a/usr.sbin/ypset/ypset.c b/usr.sbin/ypset/ypset.c index c7a3e04..5b3e7cb 100644 --- a/usr.sbin/ypset/ypset.c +++ b/usr.sbin/ypset/ypset.c @@ -69,17 +69,17 @@ char *dom, *server; int r; unsigned long server_addr; - if( (port=htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0) + if ((port = htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0) errx(1, "%s not running ypserv", server); bzero(&ypsd, sizeof ypsd); - if( (hp = gethostbyname (server)) != NULL ) { + if ((hp = gethostbyname (server)) != NULL) { /* is this the most compatible way?? */ bcopy (hp->h_addr_list[0], (u_long *)&ypsd.ypsetdom_binding.ypbind_binding_addr, sizeof (unsigned long)); - } else if( (long)(server_addr = inet_addr (server)) == -1) { + } else if ((long)(server_addr = inet_addr (server)) == -1) { errx(1, "can't find address for %s", server); } else bcopy (&server_addr, @@ -95,21 +95,21 @@ char *dom, *server; tv.tv_usec = 0; sock = RPC_ANYSOCK; client = clntudp_create(sin, YPBINDPROG, YPBINDVERS, tv, &sock); - if (client==NULL) { + if (client == NULL) { warnx("can't yp_bind, reason: %s", yperr_string(YPERR_YPBIND)); - return YPERR_YPBIND; + return (YPERR_YPBIND); } client->cl_auth = authunix_create_default(); r = clnt_call(client, YPBINDPROC_SETDOM, xdr_ypbind_setdom, &ypsd, xdr_void, NULL, tv); - if(r) { + if (r) { warnx("sorry, cannot ypset for domain %s on host", dom); clnt_destroy(client); - return YPERR_YPBIND; + return (YPERR_YPBIND); } clnt_destroy(client); - return 0; + return (0); } int @@ -127,15 +127,15 @@ char **argv; sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - while( (c=getopt(argc, argv, "h:d:")) != -1) - switch(c) { + while ((c = getopt(argc, argv, "h:d:")) != -1) + switch (c) { case 'd': domainname = optarg; break; case 'h': - if( (sin.sin_addr.s_addr=inet_addr(optarg)) == -1) { + if ((sin.sin_addr.s_addr = inet_addr(optarg)) == -1) { hent = gethostbyname(optarg); - if(hent==NULL) + if (hent == NULL) errx(1, "host %s unknown", optarg); bcopy(&hent->h_addr_list[0], &sin.sin_addr, sizeof sin.sin_addr); @@ -145,7 +145,7 @@ char **argv; usage(); } - if(optind + 1 != argc ) + if (optind + 1 != argc) usage(); if (bind_tohost(&sin, domainname, argv[optind])) -- cgit v1.1