diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-15 06:10:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-15 06:10:47 +0000 |
commit | 922441d1f8a1fee372fbabd2bc2847427c615021 (patch) | |
tree | d238dad6c670df972d60933dbd365b716ada61ec /usr.sbin | |
parent | d87819fc35744dfcf59693c3497e2bbca6c7f933 (diff) |
protos and repairs
Diffstat (limited to 'usr.sbin')
22 files changed, 180 insertions, 188 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c index dfe7205c5a7..f5fae6b3e85 100644 --- a/usr.sbin/ypbind/ypbind.c +++ b/usr.sbin/ypbind/ypbind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypbind.c,v 1.49 2003/06/25 21:45:47 deraadt Exp $ */ +/* $OpenBSD: ypbind.c,v 1.50 2003/07/15 06:10:45 deraadt Exp $ */ /* * Copyright (c) 1992, 1993, 1996, 1997, 1998 Theo de Raadt <deraadt@openbsd.org> @@ -27,7 +27,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypbind.c,v 1.49 2003/06/25 21:45:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypbind.c,v 1.50 2003/07/15 06:10:45 deraadt Exp $"; #endif #include <sys/param.h> @@ -123,7 +123,7 @@ u_int32_t unique_xid(struct _dom_binding *ypdb); * declare sun's interface insufficient and roll our own. */ -void * +static void * ypbindproc_null_2x(SVCXPRT *transp, void *argp, CLIENT *clnt) { static char res; @@ -132,7 +132,7 @@ ypbindproc_null_2x(SVCXPRT *transp, void *argp, CLIENT *clnt) return (void *)&res; } -struct ypbind_resp * +static struct ypbind_resp * ypbindproc_domain_2x(SVCXPRT *transp, domainname *argp, CLIENT *clnt) { static struct ypbind_resp res; @@ -214,7 +214,7 @@ ypbindproc_domain_2x(SVCXPRT *transp, domainname *argp, CLIENT *clnt) return &res; } -bool_t * +static bool_t * ypbindproc_setdom_2x(SVCXPRT *transp, struct ypbind_setdom *argp, CLIENT *clnt) { struct sockaddr_in *fromsin, bindsin; @@ -261,26 +261,28 @@ ypbindproc_setdom_2x(SVCXPRT *transp, struct ypbind_setdom *argp, CLIENT *clnt) static void ypbindprog_2(struct svc_req *rqstp, SVCXPRT *transp) { - union { + union argument { domainname ypbindproc_domain_2_arg; struct ypbind_setdom ypbindproc_setdom_2_arg; } argument; struct authunix_parms *creds; char *result; - bool_t (*xdr_argument)(), (*xdr_result)(); - char *(*local)(); + xdrproc_t xdr_argument, xdr_result; + char *(*local)(SVCXPRT *, union argument *, struct svc_req *); switch (rqstp->rq_proc) { case YPBINDPROC_NULL: xdr_argument = xdr_void; xdr_result = xdr_void; - local = (char *(*)()) ypbindproc_null_2x; + local = (char *(*)(SVCXPRT *, union argument *, struct svc_req *)) + ypbindproc_null_2x; break; case YPBINDPROC_DOMAIN: xdr_argument = xdr_domainname; xdr_result = xdr_ypbind_resp; - local = (char *(*)()) ypbindproc_domain_2x; + local = (char *(*)(SVCXPRT *, union argument *, struct svc_req *)) + ypbindproc_domain_2x; break; case YPBINDPROC_SETDOM: @@ -299,7 +301,8 @@ ypbindprog_2(struct svc_req *rqstp, SVCXPRT *transp) xdr_argument = xdr_ypbind_setdom; xdr_result = xdr_void; - local = (char *(*)()) ypbindproc_setdom_2x; + local = (char *(*)(SVCXPRT *, union argument *, struct svc_req *)) + ypbindproc_setdom_2x; break; default: @@ -318,7 +321,7 @@ ypbindprog_2(struct svc_req *rqstp, SVCXPRT *transp) return; } -void +static void usage(void) { fprintf(stderr, "usage: ypbind [-ypset] [-ypsetme] [-insecure]\n"); diff --git a/usr.sbin/ypserv/common/ypdb.c b/usr.sbin/ypserv/common/ypdb.c index f2e62f32176..3753cdcd9b8 100644 --- a/usr.sbin/ypserv/common/ypdb.c +++ b/usr.sbin/ypserv/common/ypdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypdb.c,v 1.10 2003/06/04 16:08:08 deraadt Exp $ */ +/* $OpenBSD: ypdb.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1990, 1993 @@ -201,26 +201,6 @@ ypdb_setkey(DBM *db, datum key) * Returns: * 0 on success * <0 failure - */ -int -ypdb_delete(DBM *db, datum key) -{ - int status; - DBT nk; - - nk.data = key.dptr; - nk.size = key.dsize; - status = (db->del)(db, &nk, 0); - if (status) - return (-1); - else - return (0); -} - -/* - * Returns: - * 0 on success - * <0 failure * 1 if YPDB_INSERT and entry exists */ int diff --git a/usr.sbin/ypserv/common/ypdb.h b/usr.sbin/ypserv/common/ypdb.h index ece6ed3f90e..c38935c93b2 100644 --- a/usr.sbin/ypserv/common/ypdb.h +++ b/usr.sbin/ypserv/common/ypdb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ypdb.h,v 1.8 2003/06/04 16:08:08 deraadt Exp $ */ +/* $OpenBSD: ypdb.h,v 1.9 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1990, 1993 @@ -68,6 +68,7 @@ datum ypdb_setkey(DBM *, datum); DBM *ypdb_open(const char *, int, int); DBM *ypdb_open_suf(const char *, int, int); int ypdb_store(DBM *, datum, datum, int); + __END_DECLS #endif /* !_YPDB_H_ */ diff --git a/usr.sbin/ypserv/common/yplib_host.c b/usr.sbin/ypserv/common/yplib_host.c index 1bb201cca8d..601132b7479 100644 --- a/usr.sbin/ypserv/common/yplib_host.c +++ b/usr.sbin/ypserv/common/yplib_host.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yplib_host.c,v 1.13 2003/06/02 04:12:38 deraadt Exp $ */ +/* $OpenBSD: yplib_host.c,v 1.14 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: yplib_host.c,v 1.13 2003/06/02 04:12:38 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: yplib_host.c,v 1.14 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <sys/param.h> @@ -48,14 +48,9 @@ static const char rcsid[] = "$OpenBSD: yplib_host.c,v 1.13 2003/06/02 04:12:38 d #include <rpc/xdr.h> #include <rpcsvc/yp.h> #include <rpcsvc/ypclnt.h> +#include "yplib_host.h" -extern bool_t xdr_domainname(), xdr_ypbind_resp(); -extern bool_t xdr_ypreq_key(), xdr_ypresp_val(); -extern bool_t xdr_ypreq_nokey(), xdr_ypresp_key_val(); -extern bool_t xdr_ypresp_all(), xdr_ypresp_all_seq(); -extern bool_t xdr_ypresp_master(); - -extern int (*ypresp_allfn)(); +extern int (*ypresp_allfn)(u_long, char *, int, char *, int, void *); extern void *ypresp_data; int _yplib_host_timeout = 10; diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c index 83bb3333528..8fb78f60872 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.c +++ b/usr.sbin/ypserv/makedbm/makedbm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makedbm.c,v 1.21 2003/06/02 21:58:26 maja Exp $ */ +/* $OpenBSD: makedbm.c,v 1.22 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1994-97 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: makedbm.c,v 1.21 2003/06/02 21:58:26 maja Exp $"; +static const char rcsid[] = "$OpenBSD: makedbm.c,v 1.22 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <stdio.h> @@ -80,7 +80,7 @@ read_line(FILE *fp, char *buf, int size) return done; } -void +static void add_record(DBM *db, char *str1, char *str2, int check) { datum key, val; @@ -126,7 +126,7 @@ file_date(char *filename) return datestr; } -void +static void list_database(char *database, int Uflag) { DBM *db; @@ -156,7 +156,7 @@ list_database(char *database, int Uflag) ypdb_close(db); } -void +static void create_database(char *infile, char *database, char *yp_input_file, char *yp_output_file, char *yp_master_name, char *yp_domain_name, int bflag, int lflag, int sflag) @@ -289,7 +289,7 @@ create_database(char *infile, char *database, char *yp_input_file, } -void +static void usage(void) { fprintf(stderr,"usage: makedbm [-u | -U] file\n" diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c index e27cd6adadf..5e58e5a15dd 100644 --- a/usr.sbin/ypserv/mkalias/mkalias.c +++ b/usr.sbin/ypserv/mkalias/mkalias.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkalias.c,v 1.14 2003/06/02 21:58:26 maja Exp $ */ +/* $OpenBSD: mkalias.c,v 1.15 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: mkalias.c,v 1.14 2003/06/02 21:58:26 maja Exp $"; +static const char rcsid[] = "$OpenBSD: mkalias.c,v 1.15 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <ctype.h> @@ -44,7 +44,7 @@ static const char rcsid[] = "$OpenBSD: mkalias.c,v 1.14 2003/06/02 21:58:26 maja #include "ypdb.h" #include "ypdef.h" -void +static void split_address(char *address, int len, char *user, char *host) { char *c, *s, *r; @@ -79,7 +79,7 @@ split_address(char *address, int len, char *user, char *host) } } -int +static int check_host(char *address, char *host, int dflag, int uflag, int Eflag) { u_char answer[PACKETSZ]; @@ -103,7 +103,7 @@ check_host(char *address, char *host, int dflag, int uflag, int Eflag) return(status == -1); } -void +static void capitalize(char *name, int len) { char last = ' '; @@ -126,7 +126,7 @@ capitalize(char *name, int len) } } -void +static void usage(void) { fprintf(stderr, diff --git a/usr.sbin/ypserv/mknetid/mknetid.c b/usr.sbin/ypserv/mknetid/mknetid.c index 1cd3e52a22f..50a606c41cf 100644 --- a/usr.sbin/ypserv/mknetid/mknetid.c +++ b/usr.sbin/ypserv/mknetid/mknetid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mknetid.c,v 1.11 2003/06/02 21:58:26 maja Exp $ */ +/* $OpenBSD: mknetid.c,v 1.12 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: mknetid.c,v 1.11 2003/06/02 21:58:26 maja Exp $"; +static const char rcsid[] = "$OpenBSD: mknetid.c,v 1.12 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <sys/param.h> @@ -82,7 +82,7 @@ char *NetidFile = "/etc/netid"; struct user *root = NULL, *tail = NULL; struct user *hroot[HASHMAX], *htail[HASHMAX]; -int +static int read_line(FILE *fp, char *buf, int size) { int done = 0; @@ -114,7 +114,7 @@ read_line(FILE *fp, char *buf, int size) return done; } -int +static int hashidx(char key) { if (key < 'A') @@ -128,7 +128,7 @@ hashidx(char key) return (54); } -void +static void add_user(char *username, char *uid, char *gid) { struct user *u; @@ -161,7 +161,8 @@ add_user(char *username, char *uid, char *gid) } } -void add_group(char *username, char *gid) +static void +add_group(char *username, char *gid) { struct user *u; int idx, g; @@ -184,7 +185,7 @@ void add_group(char *username, char *gid) } } -void +static void read_passwd(FILE *pfile, char *fname) { char line[1024]; @@ -259,7 +260,7 @@ read_passwd(FILE *pfile, char *fname) } } -int +static int isgsep(char ch) { switch (ch) { @@ -273,7 +274,7 @@ isgsep(char ch) } } -void +static void read_group(FILE *gfile, char *fname) { char line[2048]; @@ -356,7 +357,7 @@ read_group(FILE *gfile, char *fname) } } -void +static void print_passwd_group(int qflag, char *domain) { struct user *u, *p; @@ -391,7 +392,7 @@ print_passwd_group(int qflag, char *domain) } } -void +static void print_hosts(FILE *pfile, char *fname, char *domain) { char line[1024]; @@ -444,7 +445,7 @@ print_hosts(FILE *pfile, char *fname, char *domain) } } -void +static void print_netid(FILE *mfile, char *fname) { char line[1024]; @@ -497,7 +498,7 @@ print_netid(FILE *mfile, char *fname) } } -void +static void usage(void) { fprintf(stderr, diff --git a/usr.sbin/ypserv/revnetgroup/hash.c b/usr.sbin/ypserv/revnetgroup/hash.c index 588a9904298..df247b12332 100644 --- a/usr.sbin/ypserv/revnetgroup/hash.c +++ b/usr.sbin/ypserv/revnetgroup/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.3 2002/07/19 02:38:40 deraadt Exp $ */ +/* $OpenBSD: hash.c,v 1.4 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -40,7 +40,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: hash.c,v 1.3 2002/07/19 02:38:40 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: hash.c,v 1.4 2003/07/15 06:10:46 deraadt Exp $"; #endif /* @@ -52,7 +52,7 @@ static const char rcsid[] = "$OpenBSD: hash.c,v 1.3 2002/07/19 02:38:40 deraadt /* * OZ's original sdbm hash */ -u_int32_t +static u_int32_t hash(const void *keyarg, size_t len) { const u_char *key; @@ -102,7 +102,7 @@ hash(const void *keyarg, size_t len) * We mask off all but the lower 8 bits since our table array * can only hold 256 elements. */ -u_int32_t +static u_int32_t hashkey(char *key) { diff --git a/usr.sbin/ypserv/revnetgroup/parse_netgroup.c b/usr.sbin/ypserv/revnetgroup/parse_netgroup.c index 1ca04947652..35676433abc 100644 --- a/usr.sbin/ypserv/revnetgroup/parse_netgroup.c +++ b/usr.sbin/ypserv/revnetgroup/parse_netgroup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse_netgroup.c,v 1.8 2003/06/02 23:36:55 millert Exp $ */ +/* $OpenBSD: parse_netgroup.c,v 1.9 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -47,7 +47,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: parse_netgroup.c,v 1.8 2003/06/02 23:36:55 millert Exp $"; +static const char rcsid[] = "$OpenBSD: parse_netgroup.c,v 1.9 2003/07/15 06:10:46 deraadt Exp $"; #endif /* @@ -82,10 +82,11 @@ static struct { (struct netgrp *)0, (char *)0, }; -static int parse_netgrp(); -static struct linelist *read_for_group(); -void __setnetgrent(), __endnetgrent(); -int __getnetgrent(); + +static int parse_netgrp(char *); +static struct linelist *read_for_group(char *); +void __setnetgrent(char *), __endnetgrent(void); +int __getnetgrent(char **, char **, char **); extern struct group_entry *gtable[]; /* diff --git a/usr.sbin/ypserv/revnetgroup/revnetgroup.c b/usr.sbin/ypserv/revnetgroup/revnetgroup.c index 97776c85dae..15ad5fab7ed 100644 --- a/usr.sbin/ypserv/revnetgroup/revnetgroup.c +++ b/usr.sbin/ypserv/revnetgroup/revnetgroup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: revnetgroup.c,v 1.4 2002/07/19 20:59:40 deraadt Exp $ */ +/* $OpenBSD: revnetgroup.c,v 1.5 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -47,7 +47,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: revnetgroup.c,v 1.4 2002/07/19 20:59:40 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: revnetgroup.c,v 1.5 2003/07/15 06:10:46 deraadt Exp $"; #endif /* Default location of netgroup file. */ @@ -62,7 +62,7 @@ struct group_entry *gtable[TABLESIZE]; */ struct member_entry *mtable[TABLESIZE]; -void +static void usage(void) { fprintf (stderr,"usage: revnetgroup -u|-h [-f netgroup file]\n"); diff --git a/usr.sbin/ypserv/stdethers/stdethers.c b/usr.sbin/ypserv/stdethers/stdethers.c index 45233258711..db9e6acdc50 100644 --- a/usr.sbin/ypserv/stdethers/stdethers.c +++ b/usr.sbin/ypserv/stdethers/stdethers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdethers.c,v 1.9 2003/06/02 21:58:26 maja Exp $ */ +/* $OpenBSD: stdethers.c,v 1.10 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: stdethers.c,v 1.9 2003/06/02 21:58:26 maja Exp $"; +static const char rcsid[] = "$OpenBSD: stdethers.c,v 1.10 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <sys/types.h> @@ -52,7 +52,7 @@ extern char *ether_ntoa(struct ether_addr *); when asking YP but not when returning string from ether_ntoa. */ -char * +static char * working_ntoa(u_char *e) { static char a[] = "xx:xx:xx:xx:xx:xx"; @@ -96,7 +96,7 @@ read_line(FILE *fp, char *buf, int size) return (done); } -void +static void usage(void) { fprintf(stderr, "usage: stdethers [file]\n"); diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c index d901b5078e9..d449cf514fc 100644 --- a/usr.sbin/ypserv/yppush/yppush.c +++ b/usr.sbin/ypserv/yppush/yppush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.c,v 1.20 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: yppush.c,v 1.21 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: yppush.c,v 1.20 2003/06/02 21:58:27 maja Exp $"; +static const char rcsid[] = "$OpenBSD: yppush.c,v 1.21 2003/07/15 06:10:46 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -63,14 +63,14 @@ char *master; extern void yppush_xfrrespprog_1(struct svc_req *request, SVCXPRT *xprt); extern bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *); -void +static void usage(void) { fprintf(stderr, "usage: yppush [-d domainname] [-h host] [-v] mapname\n"); exit(1); } -void +static void _svc_run(void) { fd_set *readfdsp = NULL; @@ -110,7 +110,7 @@ _svc_run(void) } } -void +static void req_xfr(pid_t pid, u_int prog, SVCXPRT *transp, char *host, CLIENT *client) { struct ypreq_xfr request; @@ -144,7 +144,7 @@ req_xfr(pid_t pid, u_int prog, SVCXPRT *transp, char *host, CLIENT *client) } } -void +static void push(int inlen, char *indata) { char host[MAXHOSTNAMELEN]; @@ -209,7 +209,7 @@ push(int inlen, char *indata) } -int +static int pushit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen, void *indata) { diff --git a/usr.sbin/ypserv/yppush/yppush.h b/usr.sbin/ypserv/yppush/yppush.h index 2049a6ad808..aa07f04036f 100644 --- a/usr.sbin/ypserv/yppush/yppush.h +++ b/usr.sbin/ypserv/yppush/yppush.h @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.h,v 1.8 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: yppush.h,v 1.9 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -31,32 +31,6 @@ #include <rpc/rpc.h> -enum yppush_status { - YPPUSH_SUCC = 1, - YPPUSH_AGE = 2, - YPPUSH_NOMAP = -1, - YPPUSH_NODOM = -2, - YPPUSH_RSRC = -3, - YPPUSH_RPC = -4, - YPPUSH_MADDR = -5, - YPPUSH_YPERR = -6, - YPPUSH_BADARGS = -7, - YPPUSH_DBM = -8, - YPPUSH_FILE = -9, - YPPUSH_SKEW = -10, - YPPUSH_CLEAR = -11, - YPPUSH_FORCE = -12, - YPPUSH_XFRERR = -13, - YPPUSH_REFUSED = -14 -}; -typedef enum yppush_status yppush_status; - -struct yppushresp_xfr { - u_int transid; - yppush_status status; -}; -typedef struct yppushresp_xfr yppushresp_xfr; - #define YPPUSH_XFRRESPPROG ((u_long)0x40000000) #define YPPUSH_XFRRESPVERS ((u_long)1) #define YPPUSHPROC_NULL ((u_long)0) @@ -67,9 +41,8 @@ bool_t xdr_yppush_status(XDR *, yppush_status *); bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr *); void * yppushproc_null_1(void *, CLIENT *); void * yppushproc_null_1_svc(void *, struct svc_req *); -void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *); -void * yppushproc_xfrresp_1_svc(yppushresp_xfr *, struct svc_req *); char * yppush_err_string(enum yppush_status y); +void yppush_xfrrespprog_1(struct svc_req *, SVCXPRT *); __END_DECLS #endif /* !_YPPUSH_H_RPCGEN */ diff --git a/usr.sbin/ypserv/yppush/yppush_err.c b/usr.sbin/ypserv/yppush/yppush_err.c index 5c909eee7ee..074aaed8d75 100644 --- a/usr.sbin/ypserv/yppush/yppush_err.c +++ b/usr.sbin/ypserv/yppush/yppush_err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush_err.c,v 1.6 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: yppush_err.c,v 1.7 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -27,10 +27,11 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: yppush_err.c,v 1.6 2003/06/02 21:58:27 maja Exp $"; +static const char rcsid[] = "$OpenBSD: yppush_err.c,v 1.7 2003/07/15 06:10:46 deraadt Exp $"; #endif /* not lint */ #include <rpcsvc/yp.h> +#include "yppush.h" char * yppush_err_string(enum yppush_status y) diff --git a/usr.sbin/ypserv/yppush/yppush_proc.c b/usr.sbin/ypserv/yppush/yppush_proc.c index ecb557980aa..8e2309f3834 100644 --- a/usr.sbin/ypserv/yppush/yppush_proc.c +++ b/usr.sbin/ypserv/yppush/yppush_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush_proc.c,v 1.7 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: yppush_proc.c,v 1.8 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -27,9 +27,11 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.7 2003/06/02 21:58:27 maja Exp $"; +static const char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.8 2003/07/15 06:10:46 deraadt Exp $"; #endif /* not lint */ +#include <sys/types.h> +#include <rpcsvc/yp.h> #include <stdio.h> #include "yppush.h" @@ -46,9 +48,10 @@ yppushproc_null_1_svc(void *argp, struct svc_req *rqstp) return((void *) &result); } -void * -yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp) +yppushresp_xfr * +yppushproc_xfrresp_1_svc(void *v, struct svc_req *rqstp) { + yppushresp_xfr *argp = (yppushresp_xfr *)v; static char *result; /* @@ -57,5 +60,5 @@ yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp) if ((argp->status < YPPUSH_SUCC) || Verbose) fprintf(stderr, "yppush: %s\n", yppush_err_string(argp->status)); - return((void *) &result); + return((yppushresp_xfr *) &result); } diff --git a/usr.sbin/ypserv/yppush/yppush_svc.c b/usr.sbin/ypserv/yppush/yppush_svc.c index b272282c15d..d42dc65941a 100644 --- a/usr.sbin/ypserv/yppush/yppush_svc.c +++ b/usr.sbin/ypserv/yppush/yppush_svc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush_svc.c,v 1.10 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: yppush_svc.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -27,11 +27,9 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.10 2003/06/02 21:58:27 maja Exp $"; +static const char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $"; #endif /* not lint */ -#include "yppush.h" - #include <sys/types.h> #include <sys/ttycom.h> #include <sys/socket.h> @@ -41,6 +39,9 @@ static const char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.10 2003/06/02 21:58:27 m #include <netdb.h> #include <memory.h> #include <syslog.h> +#include <rpcsvc/yp.h> + +#include "yppush.h" #ifdef DEBUG #define RPC_SVC_FG @@ -67,25 +68,27 @@ void _msgout(char *msg) void yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp) { - union { + union argument { int fill; } argument; char *result; - bool_t (*xdr_argument)(), (*xdr_result)(); - char *(*local)(); + xdrproc_t xdr_argument, xdr_result; + char *(*local)(union argument *, struct svc_req *); _rpcsvcdirty = 1; switch (rqstp->rq_proc) { case YPPUSHPROC_NULL: xdr_argument = xdr_void; xdr_result = xdr_void; - local = (char *(*)()) yppushproc_null_1_svc; + local = (char *(*)(union argument *, struct svc_req *)) + yppushproc_null_1_svc; break; case YPPUSHPROC_XFRRESP: xdr_argument = xdr_yppushresp_xfr; xdr_result = xdr_void; - local = (char *(*)()) yppushproc_xfrresp_1_svc; + local = (char *(*)(union argument *, struct svc_req *)) + yppushproc_xfrresp_1_svc; break; default: diff --git a/usr.sbin/ypserv/ypserv/acl.c b/usr.sbin/ypserv/ypserv/acl.c index 07143a2e81e..2f0735ee104 100644 --- a/usr.sbin/ypserv/ypserv/acl.c +++ b/usr.sbin/ypserv/ypserv/acl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acl.c,v 1.10 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: acl.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: acl.c,v 1.10 2003/06/02 21:58:27 maja Exp $"; +static const char rcsid[] = "$OpenBSD: acl.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <sys/types.h> @@ -103,7 +103,7 @@ acl_check_host(struct in_addr *addr) return(TRUE); } -void +static void acl_add_net(int allow, struct in_addr *addr, struct in_addr *mask) { struct aclent *acl, *p; @@ -124,7 +124,7 @@ acl_add_net(int allow, struct in_addr *addr, struct in_addr *mask) } } -void +static void acl_add_host(int allow, struct in_addr *addr) { struct in_addr mask; diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c index 523067c9c53..c7528bb7bb8 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.c +++ b/usr.sbin/ypserv/ypserv/ypserv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv.c,v 1.30 2003/06/22 23:57:07 maja Exp $ */ +/* $OpenBSD: ypserv.c,v 1.31 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv.c,v 1.30 2003/06/22 23:57:07 maja Exp $"; +static const char rcsid[] = "$OpenBSD: ypserv.c,v 1.31 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <sys/types.h> @@ -328,7 +328,7 @@ ypprog_2(struct svc_req *rqstp, SVCXPRT *transp) _rpcsvcdirty = 0; } -void +static void hup(void) { /* Handle the log. */ @@ -345,7 +345,7 @@ hup(void) } } -void +static void my_svc_run(void) { fd_set *fds; @@ -384,7 +384,7 @@ my_svc_run(void) } } -void +static void usage(void) { (void)fprintf(stderr, "usage: ypserv [-a aclfile] [-d] [-x]\n"); diff --git a/usr.sbin/ypserv/ypserv/ypserv.h b/usr.sbin/ypserv/ypserv/ypserv.h new file mode 100644 index 00000000000..819b134bdb1 --- /dev/null +++ b/usr.sbin/ypserv/ypserv/ypserv.h @@ -0,0 +1,39 @@ +/* $OpenBSD: ypserv.h,v 1.1 2003/07/15 06:10:46 deraadt Exp $ */ + +/* + * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +void ypdb_init(void); +void ypdb_close_all(void); +struct opt_map; +DBM *ypdb_open_db(domainname, mapname, ypstat *, struct opt_map **); +ypresp_val ypdb_get_record(domainname, mapname, keydat, int); +ypresp_key_val ypdb_get_first(domainname, mapname, int); +ypresp_key_val ypdb_get_next(domainname, mapname, keydat, int); +ypresp_order ypdb_get_order(domainname, mapname); +ypresp_master ypdb_get_master(domainname, mapname); +bool_t ypdb_xdr_get_all(XDR *, ypreq_nokey *); +int ypdb_secure(domainname, mapname); diff --git a/usr.sbin/ypserv/ypserv/ypserv_db.c b/usr.sbin/ypserv/ypserv/ypserv_db.c index f71e7be83aa..79d6dd5b98b 100644 --- a/usr.sbin/ypserv/ypserv/ypserv_db.c +++ b/usr.sbin/ypserv/ypserv/ypserv_db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv_db.c,v 1.19 2003/05/05 08:37:05 avsm Exp $ */ +/* $OpenBSD: ypserv_db.c,v 1.20 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -34,7 +34,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.19 2003/05/05 08:37:05 avsm Exp $"; +static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.20 2003/07/15 06:10:46 deraadt Exp $"; #endif /* @@ -65,25 +65,26 @@ static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.19 2003/05/05 08:37:05 av #include "yplog.h" #include "ypdb.h" #include "ypdef.h" +#include "ypserv.h" LIST_HEAD(domainlist, opt_domain); /* LIST of domains */ LIST_HEAD(maplist, opt_map); /* LIST of maps (in a domain) */ CIRCLEQ_HEAD(mapq, opt_map); /* CIRCLEQ of maps (LRU) */ struct opt_map { - mapname map; /* map name (malloc'd) */ - DBM *db; /* database */ - struct opt_domain *dom; /* back ptr to our domain */ - int host_lookup; /* host lookup */ - int secure; /* secure map? */ - CIRCLEQ_ENTRY(opt_map) mapsq; /* map queue pointers */ - LIST_ENTRY(opt_map) mapsl; /* map list pointers */ + mapname map; /* map name (malloc'd) */ + DBM *db; /* database */ + struct opt_domain *dom; /* back ptr to our domain */ + int host_lookup; /* host lookup */ + int secure; /* secure map? */ + CIRCLEQ_ENTRY(opt_map) mapsq; /* map queue pointers */ + LIST_ENTRY(opt_map) mapsl; /* map list pointers */ }; struct opt_domain { - domainname domain; /* domain name (malloc'd) */ - struct maplist dmaps; /* the domain's active maps */ - LIST_ENTRY(opt_domain) domsl; /* global linked list of domains */ + domainname domain; /* domain name (malloc'd) */ + struct maplist dmaps; /* the domain's active maps */ + LIST_ENTRY(opt_domain) domsl; /* global linked list of domains */ }; struct domainlist doms; /* global list of domains */ @@ -96,7 +97,6 @@ extern int usedns; */ void ypdb_init(void) - { LIST_INIT(&doms); CIRCLEQ_INIT(&maps); @@ -107,7 +107,7 @@ ypdb_init(void) * Check if key is a YP private key. Return TRUE if it is and * ypprivate is FALSE. */ -int +static int yp_private(datum key, int ypprivate) { if (ypprivate) @@ -144,7 +144,7 @@ yp_private(datum key, int ypprivate) * Close least recent used map. This routine is called when we have * no more file descripotors free, or we want to close all maps. */ -void +static void ypdb_close_last(void) { struct opt_map *last = maps.cqh_last; @@ -187,7 +187,7 @@ ypdb_close_all(void) /* * Close Database if Open/Close Optimization isn't turned on. */ -void +static void ypdb_close_db(DBM *db) { #ifdef DEBUG @@ -369,7 +369,7 @@ ypdb_open_db(domainname domain, mapname map, ypstat *status, /* * lookup host */ -ypstat +static ypstat lookup_host(int nametable, int host_lookup, DBM *db, char *keystr, ypresp_val *result) { diff --git a/usr.sbin/ypserv/ypserv/ypserv_proc.c b/usr.sbin/ypserv/ypserv/ypserv_proc.c index 2527fe80238..53753e4a63c 100644 --- a/usr.sbin/ypserv/ypserv/ypserv_proc.c +++ b/usr.sbin/ypserv/ypserv/ypserv_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv_proc.c,v 1.22 2003/06/22 23:57:07 maja Exp $ */ +/* $OpenBSD: ypserv_proc.c,v 1.23 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.22 2003/06/22 23:57:07 maja Exp $"; +static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.23 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <rpc/rpc.h> @@ -49,6 +49,7 @@ static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.22 2003/06/22 23:57:07 #include <stdlib.h> #include "yplog.h" #include "ypdef.h" +#include "ypserv.h" #ifdef DEBUG #define YPLOG yplog @@ -56,15 +57,6 @@ static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.22 2003/06/22 23:57:07 #define YPLOG if (!ok) yplog #endif /* DEBUG */ -extern ypresp_val ypdb_get_record(); -extern ypresp_key_val ypdb_get_first(); -extern ypresp_key_val ypdb_get_next(); -extern ypresp_order ypdb_get_order(); -extern ypresp_master ypdb_get_master(); -extern bool_t ypdb_xdr_get_all(); -extern void ypdb_close_all(); -extern int ypdb_secure(); - static char *True = "true"; static char *False = "FALSE"; #define TORF(N) ((N) ? True : False) diff --git a/usr.sbin/ypserv/ypxfr/ypxfr.c b/usr.sbin/ypserv/ypxfr/ypxfr.c index 73a198b50fd..17ea1085305 100644 --- a/usr.sbin/ypserv/ypxfr/ypxfr.c +++ b/usr.sbin/ypserv/ypxfr/ypxfr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypxfr.c,v 1.30 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: ypxfr.c,v 1.31 2003/07/15 06:10:46 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.30 2003/06/02 21:58:27 maja Exp $"; +static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.31 2003/07/15 06:10:46 deraadt Exp $"; #endif #include <sys/types.h> @@ -78,7 +78,7 @@ ypxfr_foreach(u_long status, char *keystr, int keylen, char *valstr, int vallen, return 0; } -int +static int get_local_ordernum(char *domain, char *map, u_int32_t *lordernum) { char map_path[MAXPATHLEN], order[MAX_LAST_LEN+1]; @@ -138,7 +138,7 @@ bail: } -int +static int get_remote_ordernum(CLIENT *client, char *domain, char *map, u_int32_t lordernum, u_int32_t *rordernum) { @@ -155,7 +155,7 @@ get_remote_ordernum(CLIENT *client, char *domain, char *map, return status; } -int +static int get_map(CLIENT *client, char *domain, char *map, struct ypall_callback *incallback) { @@ -169,13 +169,13 @@ get_map(CLIENT *client, char *domain, char *map, return (status); } -DBM * +static DBM * create_db(char *domain, char *map, char *temp_map) { return ypdb_open_suf(temp_map, O_RDWR, 0444); } -int +static int install_db(char *domain, char *map, char *temp_map) { char db_name[MAXPATHLEN]; @@ -186,7 +186,7 @@ install_db(char *domain, char *map, char *temp_map) return YPPUSH_SUCC; } -int +static int add_order(DBM *db, u_int32_t ordernum) { char datestr[11]; @@ -210,7 +210,7 @@ add_order(DBM *db, u_int32_t ordernum) return (status); } -int +static int add_master(CLIENT *client, char *domain, char *map, DBM *db) { char keystr[] = YP_MASTER_KEY, *master; @@ -239,7 +239,7 @@ add_master(CLIENT *client, char *domain, char *map, DBM *db) return (status); } -int +static int add_interdomain(CLIENT *client, char *domain, char *map, DBM *db) { char keystr[] = YP_INTERDOMAIN_KEY, *value; @@ -268,7 +268,7 @@ add_interdomain(CLIENT *client, char *domain, char *map, DBM *db) return 1; } -int +static int add_secure(CLIENT *client, char *domain, char *map, DBM *db) { char keystr[] = YP_SECURE_KEY, *value; @@ -297,7 +297,7 @@ add_secure(CLIENT *client, char *domain, char *map, DBM *db) return status; } -int +static int send_clear(CLIENT *client) { struct timeval tv; @@ -316,7 +316,7 @@ send_clear(CLIENT *client) } -int +static int send_reply(CLIENT *client, u_long status, u_long tid) { struct ypresp_xfr resp; @@ -337,7 +337,7 @@ send_reply(CLIENT *client, u_long status, u_long tid) } -void +static void usage(void) { fprintf(stderr, "usage: ypxfr [-cf] [-d domain] [-h host] [-s domain] " |