summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-02-06 15:26:07 +0000
committerdes <des@FreeBSD.org>2002-02-06 15:26:07 +0000
commitd7b064e238d98e1c9942cfb6e53c0767893310b1 (patch)
tree9c2a46d61c0b1ec2538854e870b6861acfd2ee7a /usr.sbin/ypserv
parent0f2cb9b020b907000a28323fc57a82fdb7d6626d (diff)
downloadFreeBSD-src-d7b064e238d98e1c9942cfb6e53c0767893310b1.zip
FreeBSD-src-d7b064e238d98e1c9942cfb6e53c0767893310b1.tar.gz
ANSIfy and remove some dead code.
Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'usr.sbin/ypserv')
-rw-r--r--usr.sbin/ypserv/yp_access.c21
-rw-r--r--usr.sbin/ypserv/yp_dblookup.c101
-rw-r--r--usr.sbin/ypserv/yp_dnslookup.c43
-rw-r--r--usr.sbin/ypserv/yp_error.c26
-rw-r--r--usr.sbin/ypserv/yp_main.c16
-rw-r--r--usr.sbin/ypserv/yp_server.c19
-rw-r--r--usr.sbin/ypserv/yp_svc_udp.c7
7 files changed, 93 insertions, 140 deletions
diff --git a/usr.sbin/ypserv/yp_access.c b/usr.sbin/ypserv/yp_access.c
index 610f209..d5e8f5a 100644
--- a/usr.sbin/ypserv/yp_access.c
+++ b/usr.sbin/ypserv/yp_access.c
@@ -90,7 +90,8 @@ char *yp_procs[] = { "ypoldproc_null",
#ifdef TCP_WRAPPER
-void load_securenets()
+void
+load_securenets(void)
{
}
#else
@@ -109,7 +110,8 @@ struct securenet *securenets;
* list. If the file doesn't exist, we set up a dummy entry that
* allows all hosts to connect.
*/
-void load_securenets()
+void
+load_securenets(void)
{
FILE *fp;
char path[MAXPATHLEN + 2];
@@ -211,15 +213,12 @@ void load_securenets()
*/
#ifdef DB_CACHE
-int yp_access(map, domain, rqstp)
+int
+yp_access(const char *map, const char *domain, const struct svc_req *rqstp)
#else
-int yp_access(map, rqstp)
+int
+yp_access(const char *map, const struct svc_req *rqstp)
#endif
- const char *map;
-#ifdef DB_CACHE
- const char *domain;
-#endif
- const struct svc_req *rqstp;
{
struct sockaddr_in *rqhost;
int status = 0;
@@ -304,8 +303,8 @@ not privileged", map, inet_ntoa(rqhost->sin_addr), ntohs(rqhost->sin_port));
}
-int yp_validdomain(domain)
- const char *domain;
+int
+yp_validdomain(const char *domain)
{
struct stat statbuf;
char dompath[MAXPATHLEN + 2];
diff --git a/usr.sbin/ypserv/yp_dblookup.c b/usr.sbin/ypserv/yp_dblookup.c
index 984736b..23ab2a2 100644
--- a/usr.sbin/ypserv/yp_dblookup.c
+++ b/usr.sbin/ypserv/yp_dblookup.c
@@ -89,7 +89,8 @@ struct circleq_entry {
/*
* Initialize the circular queue.
*/
-void yp_init_dbs()
+void
+yp_init_dbs(void)
{
TAILQ_INIT(&qhead);
return;
@@ -99,7 +100,8 @@ void yp_init_dbs()
* Dynamically allocate an entry for the circular queue.
* Return a NULL pointer on failure.
*/
-static struct circleq_entry *yp_malloc_qent()
+static struct circleq_entry *
+yp_malloc_qent(void)
{
register struct circleq_entry *q;
@@ -124,8 +126,8 @@ static struct circleq_entry *yp_malloc_qent()
* Free a previously allocated circular queue
* entry.
*/
-static void yp_free_qent(q)
- struct circleq_entry *q;
+static void
+yp_free_qent(struct circleq_entry *q)
{
/*
* First, close the database. In theory, this is also
@@ -162,7 +164,8 @@ static void yp_free_qent(q)
* all its resources. (This always removes the last entry
* in the queue.)
*/
-static void yp_flush()
+static void
+yp_flush(void)
{
register struct circleq_entry *qptr;
@@ -177,7 +180,8 @@ static void yp_flush()
/*
* Close all databases, erase all database names and empty the queue.
*/
-void yp_flush_all()
+void
+yp_flush_all(void)
{
register struct circleq_entry *qptr;
@@ -196,8 +200,8 @@ static char *secure_string = "YP_SECURE";
static int inter_sz = sizeof("YP_INTERDOMAIN") - 1;
static int secure_sz = sizeof("YP_SECURE") - 1;
-static int yp_setflags(dbp)
- DB *dbp;
+static int
+yp_setflags(DB *dbp)
{
DBT key = { NULL, 0 }, data = { NULL, 0 };
int flags = 0;
@@ -217,10 +221,8 @@ static int yp_setflags(dbp)
return(flags);
}
-int yp_testflag(map, domain, flag)
- char *map;
- char *domain;
- int flag;
+int
+yp_testflag(char *map, char *domain, int flag)
{
char buf[MAXPATHLEN + 2];
register struct circleq_entry *qptr;
@@ -256,10 +258,8 @@ int yp_testflag(map, domain, flag)
* a new entry when all our slots are already filled, we have to kick
* out the entry in the last slot to make room.
*/
-static int yp_cache_db(dbp, name, size)
- DB *dbp;
- char *name;
- int size;
+static int
+yp_cache_db(DB *dbp, char *name, int size)
{
register struct circleq_entry *qptr;
@@ -317,10 +317,8 @@ static int yp_cache_db(dbp, name, size)
* so that it will be easier to find if another request for
* the same database comes in later.
*/
-static DB *yp_find_db(name, key, size)
- char *name;
- char *key;
- int size;
+static DB *
+yp_find_db(char *name, char *key, int size)
{
register struct circleq_entry *qptr;
@@ -351,11 +349,9 @@ static DB *yp_find_db(name, key, size)
* If so, we fetch the handle from the cache. If not, we try to open
* the database and save the handle in the cache for later use.
*/
-DB *yp_open_db_cache(domain, map, key, size)
- const char *domain;
- const char *map;
- const char *key;
- const int size;
+DB *
+yp_open_db_cache(const char *domain, const char *map, const char *key,
+ const int size)
{
DB *dbp = NULL;
char buf[MAXPATHLEN + 2];
@@ -387,9 +383,8 @@ DB *yp_open_db_cache(domain, map, key, size)
/*
* Open a DB database.
*/
-DB *yp_open_db(domain, map)
- const char *domain;
- const char *map;
+DB *
+yp_open_db(const char *domain, const char *map)
{
DB *dbp = NULL;
char buf[MAXPATHLEN + 2];
@@ -455,16 +450,13 @@ again:
*/
#ifdef DB_CACHE
-int yp_get_record(dbp,key,data,allow)
- DB *dbp;
+int
+yp_get_record(DB *dbp, const DBT *key, DBT *data, int allow)
#else
-int yp_get_record(domain,map,key,data,allow)
- const char *domain;
- const char *map;
+int
+yp_get_record(const char *domain, const char *map,
+ const DBT *key, DBT *data, int allow)
#endif
- const DBT *key;
- DBT *data;
- int allow;
{
#ifndef DB_CACHE
DB *dbp;
@@ -522,11 +514,8 @@ int yp_get_record(domain,map,key,data,allow)
return(YP_TRUE);
}
-int yp_first_record(dbp,key,data,allow)
- const DB *dbp;
- DBT *key;
- DBT *data;
- int allow;
+int
+yp_first_record(const DB *dbp, DBT *key, DBT *data, int allow)
{
int rval;
#ifndef DB_CACHE
@@ -576,12 +565,8 @@ int yp_first_record(dbp,key,data,allow)
return(YP_TRUE);
}
-int yp_next_record(dbp,key,data,all,allow)
- const DB *dbp;
- DBT *key;
- DBT *data;
- int all;
- int allow;
+int
+yp_next_record(const DB *dbp, DBT *key, DBT *data, int all, int allow)
{
static DBT lkey = { NULL, 0 };
static DBT ldata = { NULL, 0 };
@@ -672,11 +657,8 @@ int yp_next_record(dbp,key,data,all,allow)
static DB *yp_currmap_db = NULL;
static int yp_allow_db = 0;
-ypstat yp_select_map(map, domain, key, allow)
- char *map;
- char *domain;
- keydat *key;
- int allow;
+ypstat
+yp_select_map(char *map, char *domain, keydat *key, int allow)
{
if (key == NULL)
yp_currmap_db = yp_open_db_cache(domain, map, NULL, 0);
@@ -689,9 +671,8 @@ ypstat yp_select_map(map, domain, key, allow)
return(yp_errno);
}
-ypstat yp_getbykey(key, val)
- keydat *key;
- valdat *val;
+ypstat
+yp_getbykey(keydat *key, valdat *val)
{
DBT db_key = { NULL, 0 }, db_val = { NULL, 0 };
ypstat rval;
@@ -710,9 +691,8 @@ ypstat yp_getbykey(key, val)
return(rval);
}
-ypstat yp_firstbykey(key, val)
- keydat *key;
- valdat *val;
+ypstat
+yp_firstbykey(keydat *key, valdat *val)
{
DBT db_key = { NULL, 0 }, db_val = { NULL, 0 };
ypstat rval;
@@ -729,9 +709,8 @@ ypstat yp_firstbykey(key, val)
return(rval);
}
-ypstat yp_nextbykey(key, val)
- keydat *key;
- valdat *val;
+ypstat
+yp_nextbykey(keydat *key, valdat *val)
{
DBT db_key = { NULL, 0 }, db_val = { NULL, 0 };
ypstat rval;
diff --git a/usr.sbin/ypserv/yp_dnslookup.c b/usr.sbin/ypserv/yp_dnslookup.c
index 0abffcd..016cbb0c 100644
--- a/usr.sbin/ypserv/yp_dnslookup.c
+++ b/usr.sbin/ypserv/yp_dnslookup.c
@@ -66,8 +66,8 @@ static const char rcsid[] =
#include <rpcsvc/yp.h>
#include "yp_extern.h"
-static char *parse(hp)
- struct hostent *hp;
+static char *
+parse(struct hostent *hp)
{
static char result[MAXHOSTNAMELEN * 2];
int len,i;
@@ -124,7 +124,8 @@ struct circleq_dnsentry {
static int pending = 0;
-int yp_init_resolver()
+int
+yp_init_resolver(void)
{
TAILQ_INIT(&qhead);
if (!(_res.options & RES_INIT) && res_init() == -1) {
@@ -142,7 +143,8 @@ int yp_init_resolver()
return(0);
}
-static struct circleq_dnsentry *yp_malloc_dnsent()
+static struct
+circleq_dnsentry *yp_malloc_dnsent(void)
{
register struct circleq_dnsentry *q;
@@ -159,9 +161,8 @@ static struct circleq_dnsentry *yp_malloc_dnsent()
/*
* Transmit a query.
*/
-static unsigned long yp_send_dns_query(name, type)
- char *name;
- int type;
+static unsigned long
+yp_send_dns_query(char *name, int type)
{
char buf[MAXPACKET];
int n;
@@ -195,9 +196,8 @@ static unsigned long yp_send_dns_query(name, type)
return(id);
}
-static struct circleq_dnsentry *yp_find_dnsqent(id, type)
- unsigned long id;
- int type;
+static struct circleq_dnsentry *
+yp_find_dnsqent(unsigned long id, int type)
{
register struct circleq_dnsentry *q;
@@ -217,9 +217,8 @@ static struct circleq_dnsentry *yp_find_dnsqent(id, type)
return (NULL);
}
-static void yp_send_dns_reply(q, buf)
- struct circleq_dnsentry *q;
- char *buf;
+static void
+yp_send_dns_reply(struct circleq_dnsentry *q, char *buf)
{
ypresponse result_v1;
ypresp_val result_v2;
@@ -254,8 +253,8 @@ static void yp_send_dns_reply(q, buf)
*/
bzero((char *)&result_v1, sizeof(result_v1));
result_v1.yp_resptype = YPRESP_VAL;
-# define YPVAL ypresponse_u.yp_resp_valtype
+#define YPVAL ypresponse_u.yp_resp_valtype
if (buf == NULL)
result_v1.YPVAL.stat = YP_NOKEY;
else {
@@ -314,7 +313,8 @@ static void yp_send_dns_reply(q, buf)
* Decrement TTL on all queue entries, possibly nuking
* any that have been around too long without being serviced.
*/
-void yp_prune_dnsq()
+void
+yp_prune_dnsq(void)
{
register struct circleq_dnsentry *q, *n;
@@ -341,7 +341,8 @@ void yp_prune_dnsq()
* Data is pending on the DNS socket; check for valid replies
* to our queries and dispatch them to waiting clients.
*/
-void yp_run_dnsq()
+void
+yp_run_dnsq(void)
{
register struct circleq_dnsentry *q;
char buf[sizeof(HEADER) + MAXPACKET];
@@ -425,9 +426,8 @@ void yp_run_dnsq()
/*
* Queue and transmit an asynchronous DNS hostname lookup.
*/
-ypstat yp_async_lookup_name(rqstp, name)
- struct svc_req *rqstp;
- char *name;
+ypstat
+yp_async_lookup_name(struct svc_req *rqstp, char *name)
{
register struct circleq_dnsentry *q;
int type, len;
@@ -479,9 +479,8 @@ ypstat yp_async_lookup_name(rqstp, name)
/*
* Queue and transmit an asynchronous DNS IP address lookup.
*/
-ypstat yp_async_lookup_addr(rqstp, addr)
- struct svc_req *rqstp;
- char *addr;
+ypstat
+yp_async_lookup_addr(struct svc_req *rqstp, char *addr)
{
register struct circleq_dnsentry *q;
char buf[MAXHOSTNAMELEN];
diff --git a/usr.sbin/ypserv/yp_error.c b/usr.sbin/ypserv/yp_error.c
index ce5b343..020d5f7 100644
--- a/usr.sbin/ypserv/yp_error.c
+++ b/usr.sbin/ypserv/yp_error.c
@@ -41,8 +41,9 @@ static const char rcsid[] =
* stolen from /usr/libexec/mail.local via ypserv
*/
-#include <stdio.h>
#include <sys/types.h>
+#include <stdio.h>
+#include <stdarg.h>
#include <syslog.h>
#include "yp_extern.h"
@@ -51,18 +52,9 @@ extern int _rpcpmstart;
extern char *progname;
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-static void __verr(const char *fmt, _BSD_VA_LIST_ ap) __printflike(1, 0);
-
-static void __verr(fmt, ap)
- const char *fmt;
- _BSD_VA_LIST_ ap;
+static void __verr(const char *fmt, va_list ap) __printflike(1, 0);
+static void __verr(const char *fmt, va_list ap)
{
if (debug && !_rpcpmstart) {
fprintf(stderr,"%s: ",progname);
@@ -74,20 +66,10 @@ static void __verr(fmt, ap)
}
void
-#ifdef __STDC__
yp_error(const char *fmt, ...)
-#else
-yp_error(fmt, va_list)
- const char *fmt;
- va_dcl
-#endif
{
va_list ap;
-#ifdef __STDC__
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
__verr(fmt,ap);
va_end(ap);
}
diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c
index c31e3fd..e7f6b0b 100644
--- a/usr.sbin/ypserv/yp_main.c
+++ b/usr.sbin/ypserv/yp_main.c
@@ -101,7 +101,7 @@ void _msgout(char* msg)
pid_t yp_pid;
static void
-yp_svc_run()
+yp_svc_run(void)
{
#ifdef FD_SETSIZE
fd_set readfds;
@@ -152,14 +152,15 @@ yp_svc_run()
}
}
-static void unregister()
+static void
+unregister(void)
{
(void) pmap_unset(YPPROG, YPVERS);
(void) pmap_unset(YPPROG, YPOLDVERS);
}
-static void reaper(sig)
- int sig;
+static void
+reaper(int sig)
{
int status;
int saved_errno;
@@ -186,7 +187,8 @@ static void reaper(sig)
return;
}
-static void usage()
+static void
+usage(void)
{
fprintf(stderr, "usage: ypserv [-h] [-d] [-n] [-p path]\n");
exit(1);
@@ -223,9 +225,7 @@ closedown(int sig)
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
register SVCXPRT *transp = NULL;
int sock;
diff --git a/usr.sbin/ypserv/yp_server.c b/usr.sbin/ypserv/yp_server.c
index 37ab7ef..80d9da9 100644
--- a/usr.sbin/ypserv/yp_server.c
+++ b/usr.sbin/ypserv/yp_server.c
@@ -56,7 +56,8 @@ int children = 0;
#define ORDER_STRING "YP_LAST_MODIFIED"
#define ORDER_SZ sizeof(ORDER_STRING) - 1
-static pid_t yp_fork()
+static pid_t
+yp_fork(void)
{
if (yp_pid != getpid()) {
yp_error("child %d trying to fork!", getpid());
@@ -259,12 +260,9 @@ ypproc_next_2_svc(ypreq_key *argp, struct svc_req *rqstp)
return (&result);
}
-static void ypxfr_callback(rval,addr,transid,prognum,port)
- ypxfrstat rval;
- struct sockaddr_in *addr;
- unsigned int transid;
- unsigned int prognum;
- unsigned long port;
+static void
+ypxfr_callback(ypxfrstat rval, struct sockaddr_in *addr, unsigned int transid,
+ unsigned int prognum, unsigned long port)
{
CLIENT *clnt;
int sock = RPC_ANYSOCK;
@@ -655,8 +653,7 @@ ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
return (&result);
}
-static void yp_maplist_free(yp_maplist)
- struct ypmaplist *yp_maplist;
+static void yp_maplist_free(struct ypmaplist *yp_maplist)
{
register struct ypmaplist *next;
@@ -669,8 +666,8 @@ static void yp_maplist_free(yp_maplist)
return;
}
-static struct ypmaplist *yp_maplist_create(domain)
- const char *domain;
+static struct ypmaplist *
+yp_maplist_create(const char *domain)
{
char yp_mapdir[MAXPATHLEN + 2];
char yp_mapname[MAXPATHLEN + 2];
diff --git a/usr.sbin/ypserv/yp_svc_udp.c b/usr.sbin/ypserv/yp_svc_udp.c
index b62f9f9..ea4fbcb 100644
--- a/usr.sbin/ypserv/yp_svc_udp.c
+++ b/usr.sbin/ypserv/yp_svc_udp.c
@@ -48,8 +48,7 @@ static const char rcsid[] =
*/
unsigned long
-svcudp_get_xid(xprt)
- SVCXPRT *xprt;
+svcudp_get_xid(SVCXPRT *xprt)
{
struct svc_dg_data *su;
@@ -60,9 +59,7 @@ svcudp_get_xid(xprt)
}
unsigned long
-svcudp_set_xid(xprt, xid)
- SVCXPRT *xprt;
- unsigned long xid;
+svcudp_set_xid(SVCXPRT *xprt, unsigned long xid)
{
struct svc_dg_data *su;
unsigned long old_xid;
OpenPOWER on IntegriCloud