From e2e599c8ed62c4886dfcebc74b0d3bf7436b418e Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 19 Jul 2002 02:38:41 +0000 Subject: 4344 lines of KNF diff --- usr.sbin/ypserv/common/ypdb.c | 47 ++--- usr.sbin/ypserv/common/ypdb.h | 12 +- usr.sbin/ypserv/common/ypdef.h | 46 ++--- usr.sbin/ypserv/common/yplib_host.c | 88 +++------ usr.sbin/ypserv/common/yplib_host.h | 3 +- usr.sbin/ypserv/common/yplog.c | 18 +- usr.sbin/ypserv/makedbm/db.c | 9 +- usr.sbin/ypserv/makedbm/db.h | 4 +- usr.sbin/ypserv/makedbm/makedbm.c | 121 ++++++------ usr.sbin/ypserv/mkalias/mkalias.c | 105 +++++------ usr.sbin/ypserv/mknetid/mknetid.c | 53 ++---- usr.sbin/ypserv/revnetgroup/hash.c | 35 ++-- usr.sbin/ypserv/revnetgroup/parse_netgroup.c | 18 +- usr.sbin/ypserv/revnetgroup/revnetgroup.c | 41 ++--- usr.sbin/ypserv/stdethers/stdethers.c | 42 ++--- usr.sbin/ypserv/stdhosts/stdhosts.c | 23 +-- usr.sbin/ypserv/ypinit/Makefile.main | 4 +- usr.sbin/ypserv/ypinit/README | 3 +- usr.sbin/ypserv/ypinit/ypinit.sh | 19 +- usr.sbin/ypserv/yppush/yppush.c | 51 ++---- usr.sbin/ypserv/yppush/yppush.h | 6 +- usr.sbin/ypserv/yppush/yppush_err.c | 11 +- usr.sbin/ypserv/yppush/yppush_proc.c | 27 +-- usr.sbin/ypserv/yppush/yppush_svc.c | 12 +- usr.sbin/ypserv/ypserv/acl.c | 112 +++++------- usr.sbin/ypserv/ypserv/acl.h | 4 +- usr.sbin/ypserv/ypserv/securenet.5 | 3 +- usr.sbin/ypserv/ypserv/yp.h | 264 +++++++++++++-------------- usr.sbin/ypserv/ypserv/ypserv.acl | 3 +- usr.sbin/ypserv/ypserv/ypserv.acl.5 | 3 +- usr.sbin/ypserv/ypserv/ypserv.c | 34 ++-- usr.sbin/ypserv/ypserv/ypserv_db.c | 156 ++++++---------- usr.sbin/ypserv/ypserv/ypserv_proc.c | 95 +++------- usr.sbin/ypserv/ypserv/ypv1.h | 46 ++--- usr.sbin/ypserv/yptest/yptest.c | 40 ++-- usr.sbin/ypserv/ypxfr/ypxfr.c | 198 +++++++------------- usr.sbin/ypserv/ypxfr/ypxfr_1perday.sh | 4 +- usr.sbin/ypserv/ypxfr/ypxfr_1perhour.sh | 6 +- 38 files changed, 705 insertions(+), 1061 deletions(-) diff --git a/usr.sbin/ypserv/common/ypdb.c b/usr.sbin/ypserv/common/ypdb.c index 4d498c02660..2ad55aee289 100644 --- a/usr.sbin/ypserv/common/ypdb.c +++ b/usr.sbin/ypserv/common/ypdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypdb.c,v 1.7 2002/03/04 12:14:01 maja Exp $ */ +/* $OpenBSD: ypdb.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1990, 1993 @@ -51,14 +51,11 @@ /* * Returns: - * *DBM on success - * NULL on failure + * *DBM on success + * NULL on failure */ - extern DBM * -ypdb_open(file, flags, mode) - const char *file; - int flags, mode; +ypdb_open(const char *file, int flags, int mode) { BTREEINFO info; char path[MAXPATHLEN]; @@ -79,14 +76,11 @@ ypdb_open(file, flags, mode) /* * Returns: - * *DBM on success - * NULL on failure + * *DBM on success + * NULL on failure */ - extern DBM * -ypdb_open_suf(file, flags, mode) - const char *file; - int flags, mode; +ypdb_open_suf(const char *file, int flags, int mode) { BTREEINFO info; DBM *db; @@ -104,8 +98,7 @@ ypdb_open_suf(file, flags, mode) } extern void -ypdb_close(db) - DBM *db; +ypdb_close(DBM *db) { (void)(db->close)(db); } @@ -115,11 +108,8 @@ ypdb_close(db) * DATUM on success * NULL on failure */ - extern datum -ypdb_fetch(db, key) - DBM *db; - datum key; +ypdb_fetch(DBM *db, datum key) { datum retval; DBT nk, nd; @@ -146,8 +136,7 @@ ypdb_fetch(db, key) */ extern datum -ypdb_firstkey(db) - DBM *db; +ypdb_firstkey(DBM *db) { int status; datum retkey; @@ -171,8 +160,7 @@ ypdb_firstkey(db) */ extern datum -ypdb_nextkey(db) - DBM *db; +ypdb_nextkey(DBM *db) { int status; datum retkey; @@ -196,9 +184,7 @@ ypdb_nextkey(db) */ extern datum -ypdb_setkey(db, key) - DBM *db; - datum key; +ypdb_setkey(DBM *db, datum key) { int status; DBT nk, nd; @@ -219,9 +205,7 @@ ypdb_setkey(db, key) * <0 failure */ int -ypdb_delete(db, key) - DBM *db; - datum key; +ypdb_delete(DBM *db, datum key) { int status; DBT nk; @@ -242,10 +226,7 @@ ypdb_delete(db, key) * 1 if YPDB_INSERT and entry exists */ int -ypdb_store(db, key, content, flags) - DBM *db; - datum key, content; - int flags; +ypdb_store(DBM *db, datum key, datum content, int flags) { DBT nk, nd; diff --git a/usr.sbin/ypserv/common/ypdb.h b/usr.sbin/ypserv/common/ypdb.h index d3a74f7bdc7..548ae97f241 100644 --- a/usr.sbin/ypserv/common/ypdb.h +++ b/usr.sbin/ypserv/common/ypdb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ypdb.h,v 1.6 2002/02/16 21:28:11 millert Exp $ */ +/* $OpenBSD: ypdb.h,v 1.7 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1990, 1993 @@ -50,8 +50,8 @@ #define YPDB_SUFFIX ".db" /* Flags to ypdb_store(). */ -#define YPDB_INSERT 0 -#define YPDB_REPLACE 1 +#define YPDB_INSERT 0 +#define YPDB_REPLACE 1 #ifndef DATUM typedef struct { @@ -69,9 +69,9 @@ datum ypdb_fetch(DBM *, datum); datum ypdb_firstkey(DBM *); datum ypdb_nextkey(DBM *); 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); +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/ypdef.h b/usr.sbin/ypserv/common/ypdef.h index 813b11424e9..2ed2c9d199e 100644 --- a/usr.sbin/ypserv/common/ypdef.h +++ b/usr.sbin/ypserv/common/ypdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ypdef.h,v 1.7 2001/12/01 23:27:24 miod Exp $ */ +/* $OpenBSD: ypdef.h,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -34,26 +34,26 @@ #ifndef _YPDEF_H_ #define _YPDEF_H_ -#define YP_DB_PATH "/var/yp" -#define YP_LAST_KEY "YP_LAST_MODIFIED" -#define YP_LAST_LEN (sizeof(YP_LAST_KEY)-1) -#define YP_INPUT_KEY "YP_INPUT_FILE" -#define YP_INPUT_LEN (sizeof(YP_INPUT_KEY)-1) -#define YP_OUTPUT_KEY "YP_OUTPUT_FILE" -#define YP_OUTPUT_LEN (sizeof(YP_OUTPUT_KEY)-1) -#define YP_MASTER_KEY "YP_MASTER_NAME" -#define YP_MASTER_LEN (sizeof(YP_MASTER_KEY)-1) -#define YP_DOMAIN_KEY "YP_DOMAIN_NAME" -#define YP_DOMAIN_LEN (sizeof(YP_DOMAIN_KEY)-1) -#define YP_INTERDOMAIN_KEY "YP_INTERDOMAIN" -#define YP_INTERDOMAIN_LEN (sizeof(YP_INTERDOMAIN_KEY)-1) -#define YP_SECURE_KEY "YP_SECURE" -#define YP_SECURE_LEN (sizeof(YP_SECURE_KEY)-1) +#define YP_DB_PATH "/var/yp" +#define YP_LAST_KEY "YP_LAST_MODIFIED" +#define YP_LAST_LEN (sizeof(YP_LAST_KEY)-1) +#define YP_INPUT_KEY "YP_INPUT_FILE" +#define YP_INPUT_LEN (sizeof(YP_INPUT_KEY)-1) +#define YP_OUTPUT_KEY "YP_OUTPUT_FILE" +#define YP_OUTPUT_LEN (sizeof(YP_OUTPUT_KEY)-1) +#define YP_MASTER_KEY "YP_MASTER_NAME" +#define YP_MASTER_LEN (sizeof(YP_MASTER_KEY)-1) +#define YP_DOMAIN_KEY "YP_DOMAIN_NAME" +#define YP_DOMAIN_LEN (sizeof(YP_DOMAIN_KEY)-1) +#define YP_INTERDOMAIN_KEY "YP_INTERDOMAIN" +#define YP_INTERDOMAIN_LEN (sizeof(YP_INTERDOMAIN_KEY)-1) +#define YP_SECURE_KEY "YP_SECURE" +#define YP_SECURE_LEN (sizeof(YP_SECURE_KEY)-1) -#define MAX_LAST_LEN 10 -#define MAX_MASTER_LEN 255 -#define YP_HOSTNAME "hosts.byname" -#define YP_HOSTADDR "hosts.byaddr" +#define MAX_LAST_LEN 10 +#define MAX_MASTER_LEN 255 +#define YP_HOSTNAME "hosts.byname" +#define YP_HOSTADDR "hosts.byaddr" #ifndef TRUE #define TRUE 1 @@ -63,8 +63,8 @@ #define FALSE 0 #endif -#define YPXFR_PROC "/usr/sbin/ypxfr" -#define YPPUSH_PROC "/usr/sbin/yppush" -#define YP_SECURENET_FILE "/var/yp/securenet" +#define YPXFR_PROC "/usr/sbin/ypxfr" +#define YPPUSH_PROC "/usr/sbin/yppush" +#define YP_SECURENET_FILE "/var/yp/securenet" #endif /* !_YPDEF_H_ */ diff --git a/usr.sbin/ypserv/common/yplib_host.c b/usr.sbin/ypserv/common/yplib_host.c index d91ecc9dd03..f92d9ebe2c8 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.10 2001/11/19 09:03:03 deraadt Exp $ */ +/* $OpenBSD: yplib_host.c,v 1.11 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 Theo de Raadt @@ -32,7 +32,7 @@ */ #ifndef LINT -static char *rcsid = "$OpenBSD: yplib_host.c,v 1.10 2001/11/19 09:03:03 deraadt Exp $"; +static char *rcsid = "$OpenBSD: yplib_host.c,v 1.11 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -66,17 +66,14 @@ extern void *ypresp_data; int _yplib_host_timeout = 10; CLIENT * -yp_bind_host(server, program, version, port, usetcp) - char *server; - u_long program, version; - u_short port; - int usetcp; +yp_bind_host(char *server, u_long program, u_long version, u_short port, + int usetcp) { struct sockaddr_in rsrv_sin; - int rsrv_sock; + static CLIENT *client; struct hostent *h; struct timeval tv; - static CLIENT *client; + int rsrv_sock; memset(&rsrv_sin, 0, sizeof rsrv_sin); rsrv_sin.sin_len = sizeof rsrv_sin; @@ -116,19 +113,16 @@ yp_bind_host(server, program, version, port, usetcp) server); exit(1); } - return(client); - } CLIENT * -yp_bind_local(program, version) - u_long program, version; +yp_bind_local(u_long program, u_long version) { struct sockaddr_in rsrv_sin; - int rsrv_sock; - struct timeval tv; static CLIENT *client; + struct timeval tv; + int rsrv_sock; memset(&rsrv_sin, 0, sizeof rsrv_sin); rsrv_sin.sin_len = sizeof rsrv_sin; @@ -148,18 +142,12 @@ yp_bind_local(program, version) } int -yp_match_host(client, indomain, inmap, inkey, inkeylen, outval, outvallen) - CLIENT *client; - char *indomain; - char *inmap; - const char *inkey; - int inkeylen; - char **outval; - int *outvallen; +yp_match_host(CLIENT *client, char *indomain, char *inmap, const char *inkey, + int inkeylen, char **outval, int *outvallen) { struct ypresp_val yprv; - struct timeval tv; struct ypreq_key yprk; + struct timeval tv; int r; *outval = NULL; @@ -190,14 +178,8 @@ yp_match_host(client, indomain, inmap, inkey, inkeylen, outval, outvallen) } int -yp_first_host(client, indomain, inmap, outkey, outkeylen, outval, outvallen) - CLIENT *client; - char *indomain; - char *inmap; - char **outkey; - int *outkeylen; - char **outval; - int *outvallen; +yp_first_host(CLIENT *client, char *indomain, char *inmap, char **outkey, + int *outkeylen, char **outval, int *outvallen) { struct ypresp_key_val yprkv; struct ypreq_nokey yprnk; @@ -233,17 +215,8 @@ yp_first_host(client, indomain, inmap, outkey, outkeylen, outval, outvallen) } int -yp_next_host(client, indomain, inmap, inkey, inkeylen, outkey, - outkeylen, outval, outvallen) - CLIENT *client; - char *indomain; - char *inmap; - char *inkey; - int inkeylen; - char **outkey; - int *outkeylen; - char **outval; - int *outvallen; +yp_next_host(CLIENT *client, char *indomain, char *inmap, char *inkey, + int inkeylen, char **outkey, int *outkeylen, char **outval, int *outvallen) { struct ypresp_key_val yprkv; struct ypreq_key yprk; @@ -281,11 +254,8 @@ yp_next_host(client, indomain, inmap, inkey, inkeylen, outkey, } int -yp_all_host(client, indomain, inmap, incallback) - CLIENT *client; - char *indomain; - char *inmap; - struct ypall_callback *incallback; +yp_all_host(CLIENT *client, char *indomain, char *inmap, + struct ypall_callback *incallback) { struct ypreq_nokey yprnk; struct timeval tv; @@ -307,11 +277,7 @@ yp_all_host(client, indomain, inmap, incallback) } int -yp_order_host(client, indomain, inmap, outorder) - CLIENT *client; - char *indomain; - char *inmap; - u_int32_t *outorder; +yp_order_host(CLIENT *client, char *indomain, char *inmap, u_int32_t *outorder) { struct ypresp_order ypro; struct ypreq_nokey yprnk; @@ -336,11 +302,7 @@ yp_order_host(client, indomain, inmap, outorder) } int -yp_master_host(client, indomain, inmap, outname) - CLIENT *client; - char *indomain; - char *inmap; - char **outname; +yp_master_host(CLIENT *client, char *indomain, char *inmap, char **outname) { struct ypresp_master yprm; struct ypreq_nokey yprnk; @@ -358,17 +320,14 @@ yp_master_host(client, indomain, inmap, outname) xdr_ypreq_nokey, &yprnk, xdr_ypresp_master, &yprm, tv); if (r != RPC_SUCCESS) clnt_perror(client, "yp_master: clnt_call"); - if (!(r=ypprot_err(yprm.stat)) ) - *outname = (char *)strdup(yprm.peer); + if (!(r = ypprot_err(yprm.stat))) + *outname = (char *)strdup(yprm.peer); xdr_free(xdr_ypresp_master, (char *)&yprm); return r; } int -yp_maplist_host(client, indomain, outmaplist) - CLIENT *client; - char *indomain; - struct ypmaplist **outmaplist; +yp_maplist_host(CLIENT *client, char *indomain, struct ypmaplist **outmaplist) { struct ypresp_maplist ypml; struct timeval tv; @@ -387,4 +346,3 @@ yp_maplist_host(client, indomain, outmaplist) /* NO: xdr_free(xdr_ypresp_maplist, &ypml);*/ return ypprot_err(ypml.stat); } - diff --git a/usr.sbin/ypserv/common/yplib_host.h b/usr.sbin/ypserv/common/yplib_host.h index 8547bb52130..a5d8aa65c29 100644 --- a/usr.sbin/ypserv/common/yplib_host.h +++ b/usr.sbin/ypserv/common/yplib_host.h @@ -1,4 +1,4 @@ -/* $OpenBSD: yplib_host.h,v 1.6 2002/02/17 19:42:40 millert Exp $ */ +/* $OpenBSD: yplib_host.h,v 1.7 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 Theo de Raadt @@ -54,4 +54,3 @@ CLIENT *yp_bind_host(char *server, u_long program, u_long version, u_short port, int usetcp); #endif /* _YPLIB_HOST_H_ */ - diff --git a/usr.sbin/ypserv/common/yplog.c b/usr.sbin/ypserv/common/yplog.c index e704aa9b0d3..c5bb5a01448 100644 --- a/usr.sbin/ypserv/common/yplog.c +++ b/usr.sbin/ypserv/common/yplog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yplog.c,v 1.7 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: yplog.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Charles D. Cranor @@ -31,7 +31,7 @@ */ /* - * yplog.c: replacement yplog routines for + * yplog.c: replacement yplog routines for * Mats O Jansson's ypserv program, as added by * Chuck Cranor. */ @@ -49,7 +49,6 @@ static FILE *logfp = NULL; /* the log file */ * yplog(): like a printf, but to the log file. does the flush * and data for you. */ - void yplog(const char *fmt, ...) { @@ -63,13 +62,10 @@ yplog(const char *fmt, ...) /* * vyplog() support routine for yplog() */ - void -vyplog(fmt, ap) - const char *fmt; - va_list ap; +vyplog(const char *fmt, va_list ap) { - time_t t; + time_t t; if (logfp == NULL) return; @@ -83,9 +79,8 @@ vyplog(fmt, ap) /* * open log */ - void -ypopenlog() +ypopenlog(void) { static char logfn[] = "/var/yp/ypserv.log"; @@ -100,9 +95,8 @@ ypopenlog() /* * close log */ - void -ypcloselog() +ypcloselog(void) { if (logfp) { yplog("yplog closed"); diff --git a/usr.sbin/ypserv/makedbm/db.c b/usr.sbin/ypserv/makedbm/db.c index b32ac5a15e1..8b0b8cd003a 100644 --- a/usr.sbin/ypserv/makedbm/db.c +++ b/usr.sbin/ypserv/makedbm/db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db.c,v 1.3 2002/02/13 23:05:48 deraadt Exp $ */ +/* $OpenBSD: db.c,v 1.4 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: db.c,v 1.3 2002/02/13 23:05:48 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: db.c,v 1.4 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -48,8 +48,8 @@ static char rcsid[] = "$OpenBSD: db.c,v 1.3 2002/02/13 23:05:48 deraadt Exp $"; * by sendmail -bi. */ -int db_hash_list_database(database) -char *database; +int +db_hash_list_database(char *database) { DB *db; int status; @@ -72,4 +72,3 @@ char *database; } return(0); } - diff --git a/usr.sbin/ypserv/makedbm/db.h b/usr.sbin/ypserv/makedbm/db.h index 2a5a6569bae..63e65cc032a 100644 --- a/usr.sbin/ypserv/makedbm/db.h +++ b/usr.sbin/ypserv/makedbm/db.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db.h,v 1.2 2002/02/16 21:28:11 millert Exp $ */ +/* $OpenBSD: db.h,v 1.3 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson @@ -39,5 +39,3 @@ int db_hash_list_database(char *); __END_DECLS #endif /* !_MAKEDBM_DB_H_ */ - - diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c index 053c4ca32fe..cb3275f988c 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.c +++ b/usr.sbin/ypserv/makedbm/makedbm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makedbm.c,v 1.17 2002/03/20 14:19:30 maja Exp $ */ +/* $OpenBSD: makedbm.c,v 1.18 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994-97 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: makedbm.c,v 1.17 2002/03/20 14:19:30 maja Exp $"; +static char rcsid[] = "$OpenBSD: makedbm.c,v 1.18 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -53,10 +53,8 @@ extern char *__progname; /* from crt0.o */ * Read one line */ -static int read_line(fp, buf, size) - FILE *fp; - char *buf; - int size; +static int +read_line(FILE *fp, char *buf, int size) { int done; @@ -72,7 +70,7 @@ static int read_line(fp, buf, size) buf += len - 2; size -= len - 2; *buf = '\n'; buf[1] = '\0'; - + /* Skip leading white space on next line */ while ((ch = getc(fp)) != EOF && isascii(ch) && isspace(ch)) @@ -87,30 +85,26 @@ static int read_line(fp, buf, size) return done; } -void -add_record(db, str1, str2, check) - DBM *db; - char *str1, *str2; - int check; +void +add_record(DBM *db, char *str1, char *str2, int check) { datum key, val; int status; key.dptr = str1; key.dsize = strlen(str1); - + if (check) { val = ypdb_fetch(db,key); if (val.dptr != NULL) return; /* already there */ - } val.dptr = str2; val.dsize = strlen(str2); status = ypdb_store(db, key, val, YPDB_INSERT); - + if (status != 0) { printf("%s: problem storing %s %s\n",__progname,str1,str2); exit(1); @@ -118,13 +112,12 @@ add_record(db, str1, str2, check) } static char * -file_date(filename) - char *filename; +file_date(char *filename) { struct stat finfo; static char datestr[11]; int status; - + if (strcmp(filename,"-") == 0) { snprintf(datestr, sizeof datestr, "%010u", time(0)); } else { @@ -132,33 +125,32 @@ file_date(filename) if (status < 0) { fprintf(stderr, "%s: can't stat %s\n", __progname, filename); exit(1); - } + } snprintf(datestr, sizeof datestr, "%010u", finfo.st_mtime); } return datestr; } void -list_database(database,Uflag) - char *database; - int Uflag; +list_database(char *database, int Uflag) { DBM *db; datum key, val; - + db = ypdb_open(database, O_RDONLY, 0444); - + if (db == NULL) { if (Uflag != 0) - if (db_hash_list_database(database)) return; + if (db_hash_list_database(database)) + return; fprintf(stderr, "%s: can't open database %s: %s\n", __progname, database, strerror(errno)); exit(1); } - + key = ypdb_firstkey(db); - + while (key.dptr != NULL) { val = ypdb_fetch(db,key); printf("%*.*s %*.*s\n", @@ -166,18 +158,13 @@ list_database(database,Uflag) val.dsize, val.dsize, val.dptr); key = ypdb_nextkey(db); } - ypdb_close(db); } void - -create_database(infile, database, yp_input_file, yp_output_file, - yp_master_name, yp_domain_name, bflag, lflag, sflag) - char *infile, *database; - char *yp_input_file, *yp_output_file; - char *yp_master_name, *yp_domain_name; - int bflag, lflag, sflag; +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) { FILE *data_file; char data_line[4096]; /* XXX: DB bsize = 4096 in ypdb.c */ @@ -191,7 +178,7 @@ create_database(infile, database, yp_input_file, yp_output_file, char db_mapname[MAXPATHLEN], db_outfile[MAXPATHLEN], db_tempname[MAXPATHLEN]; char empty_str[] = ""; - + if (strcmp(infile,"-") == 0) { data_file = stdin; } else { @@ -202,7 +189,7 @@ create_database(infile, database, yp_input_file, yp_output_file, exit(1); } } - + if (strlen(database) + strlen(YPDB_SUFFIX) > MAXPATHLEN) { fprintf(stderr,"%s: %s: file name too long\n", __progname, database); @@ -211,8 +198,8 @@ create_database(infile, database, yp_input_file, yp_output_file, snprintf(db_outfile, sizeof(db_outfile), "%s%s", database, YPDB_SUFFIX); slash = strrchr(database, '/'); - if (slash != NULL) - slash[1] = 0; /* truncate to dir */ + if (slash != NULL) + slash[1] = 0; /* truncate to dir */ else *database = 0; /* elminate */ @@ -237,23 +224,22 @@ create_database(infile, database, yp_input_file, yp_output_file, __progname, db_outfile); exit(1); } - + while (read_line(data_file,data_line,sizeof(data_line))) { - line_no++; len = strlen(data_line); - - /* Check if we have the whole line */ - + + /* Check if we have the whole line */ + if (data_line[len-1] != '\n') { fprintf(stderr, "line %d in \"%s\" is too long", line_no, infile); } else { data_line[len-1] = '\0'; } - + p = (char *) &data_line; - + k = p; /* save start of key */ while (!isspace(*p)) { /* find first "space" */ if (lflag && isupper(*p)) /* if force lower case */ @@ -264,33 +250,33 @@ create_database(infile, database, yp_input_file, yp_output_file, *p = '\0'; p++; } - + v = p; /* save start of value */ while (*p != '\0') /* find end of string */ - p++; - + p++; + add_record(new_db, k, v, TRUE); /* save record */ - + } - + if (strcmp(infile,"-") != 0) (void) fclose(data_file); - + add_record(new_db, YP_LAST_KEY, file_date(infile), FALSE); if (yp_input_file) add_record(new_db, YP_INPUT_KEY, yp_input_file, FALSE); - + if (yp_output_file) add_record(new_db, YP_OUTPUT_KEY, yp_output_file, FALSE); - + if (yp_master_name) add_record(new_db, YP_MASTER_KEY, yp_master_name, FALSE); else { gethostname(myname, sizeof(myname)); add_record(new_db, YP_MASTER_KEY, myname, FALSE); } - + if (yp_domain_name) add_record(new_db, YP_DOMAIN_KEY, yp_domain_name, FALSE); if (bflag) @@ -305,13 +291,11 @@ create_database(infile, database, yp_input_file, yp_output_file, db_outfile); exit(1); } - + } int -main (argc,argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int aflag, uflag, bflag, lflag, sflag, Uflag; char *yp_input_file, *yp_output_file; @@ -322,20 +306,20 @@ main (argc,argv) extern int optind; extern char *optarg; - + yp_input_file = yp_output_file = NULL; yp_master_name = yp_domain_name = NULL; aflag = uflag = bflag = lflag = sflag = Uflag = 0; infile = outfile = NULL; - + while ((ch = getopt(argc, argv, "Ublsui:o:m:d:")) != -1) switch (ch) { - case 'U': + case 'U': uflag++; Uflag++; break; case 'b': - bflag++; + bflag++; aflag++; break; case 'l': @@ -369,11 +353,11 @@ main (argc,argv) usage++; break; } - + if ((uflag != 0) && (aflag != 0)) { usage++; } else { - + if (uflag != 0) { if (argc == (optind + 1)) { infile = argv[optind]; @@ -389,7 +373,7 @@ main (argc,argv) } } } - + if (usage) { fprintf(stderr,"%s%s%s", "usage:\tmakedbm [-u|-U] file\n\tmakedbm [-bls]", @@ -397,7 +381,7 @@ main (argc,argv) "[-d YP_DOMAIN_NAME] [-m YP_MASTER_NAME] infile outfile\n"); exit(1); } - + if (uflag != 0) { list_database(infile,Uflag); } else { @@ -405,7 +389,6 @@ main (argc,argv) yp_output_file, yp_master_name, yp_domain_name, bflag, lflag, sflag); } - + return(0); - } diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c index 2537331e8bd..2203dc52054 100644 --- a/usr.sbin/ypserv/mkalias/mkalias.c +++ b/usr.sbin/ypserv/mkalias/mkalias.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkalias.c,v 1.9 2002/06/09 02:21:55 deraadt Exp $ */ +/* $OpenBSD: mkalias.c,v 1.10 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: mkalias.c,v 1.9 2002/06/09 02:21:55 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mkalias.c,v 1.10 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -52,10 +52,7 @@ static char rcsid[] = "$OpenBSD: mkalias.c,v 1.9 2002/06/09 02:21:55 deraadt Exp extern char *__progname; /* from crt0.o */ void -split_address(address, len, user, host) - char *address; - int len; - char *user, *host; +split_address(char *address, int len, char *user, char *host) { char *c, *s, *r; int i = 0; @@ -72,10 +69,9 @@ split_address(address, len, user, host) c++; } *s = '\0'; - } - - if (r = strrchr(address, '!')) { + + if ((r = strrchr(address, '!'))) { s = host; for (c = address; i < len; i++) { if (c == r) { @@ -91,9 +87,7 @@ split_address(address, len, user, host) } int -check_host(address, host, dflag, uflag, Eflag) - char *address, *host; - int dflag, uflag, Eflag; +check_host(char *address, char *host, int dflag, int uflag, int Eflag) { char answer[PACKETSZ]; int status; @@ -117,9 +111,7 @@ check_host(address, host, dflag, uflag, Eflag) } void -capitalize(name, len) - char *name; - int len; +capitalize(char *name, int len) { char last = ' '; char *c; @@ -130,7 +122,7 @@ capitalize(name, len) last = '.'; c++; } - + i = 0; if (last == '.') { for (c = name; i < len; i++) { @@ -139,13 +131,10 @@ capitalize(name, len) last = *c++; } } - } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int usage = 0; int eflag = 0; @@ -169,9 +158,9 @@ main(argc, argv) char user[4096], host[4096]; /* XXX: DB bsize = 4096 in ypdb.c */ char datestr[11]; char myname[MAXHOSTNAMELEN]; - + while ((ch = getopt(argc, argv, "Edensuv")) != -1) - switch(ch) { + switch (ch) { case 'E': eflag++; /* Check hostname */ Eflag++; /* .. even check MX records */ @@ -211,45 +200,44 @@ main(argc, argv) if (usage) { fprintf(stderr, - "usage: %s [-v] [-e|-E [-d] [-u]] [-n] input [output]\n", - __progname); + "usage: %s [-v] [-e|-E [-d] [-u]] [-n] input [output]\n", + __progname); exit(1); } - + db = ypdb_open(input, O_RDONLY, 0444); if (db == NULL) { fprintf(stderr, - "%s: Unable to open input database %s\n", - __progname, - input); + "%s: Unable to open input database %s\n", + __progname, input); exit(1); } if (output != NULL) { if (strlen(output) + strlen(YPDB_SUFFIX) > MAXPATHLEN) { fprintf(stderr,"%s: %s: file name too long\n", - __progname, output); + __progname, output); } snprintf(db_outfile, sizeof(db_outfile), - "%s%s", output, YPDB_SUFFIX); + "%s%s", output, YPDB_SUFFIX); slash = strrchr(output, '/'); - if (slash != NULL) - slash[1] = 0; /* truncate to dir */ + if (slash != NULL) + slash[1] = 0; /* truncate to dir */ else *output = 0; /* elminate */ - + /* note: output is now directory where map goes ! */ - - if (strlen(output) + strlen(mapname) - + strlen(YPDB_SUFFIX) > MAXPATHLEN) { + + if (strlen(output) + strlen(mapname) + + strlen(YPDB_SUFFIX) > MAXPATHLEN) { fprintf(stderr,"%s: %s: directory name too long\n", __progname, output); exit(1); } - + snprintf(db_tempname, sizeof(db_tempname), "%s%s%s", output, - mapname, YPDB_SUFFIX); + mapname, YPDB_SUFFIX); fd = mkstemps(db_tempname, 3); if (fd == -1) goto fail; @@ -264,18 +252,15 @@ fail: if (fd != -1) unlink(db_tempname); fprintf(stderr, - "%s: Unable to open output database %s\n", - __progname, - db_outfile); + "%s: Unable to open output database %s\n", + __progname, db_outfile); exit(1); } } - for (key = ypdb_firstkey(db); - key.dptr != NULL; - key = ypdb_nextkey(db)) { - - val = ypdb_fetch(db, key); + for (key = ypdb_firstkey(db); key.dptr != NULL; + key = ypdb_nextkey(db)) { + val = ypdb_fetch(db, key); if (val.dptr == NULL) continue; /* No value */ @@ -295,8 +280,7 @@ fail: if (eflag && check_host(val.dptr, host, dflag, uflag, Eflag)) { printf("Invalid host %s in %*.*s:%*.*s\n", - host, - key.dsize, key.dsize, key.dptr, + host, key.dsize, key.dsize, key.dptr, val.dsize, val.dsize, val.dptr); continue; } @@ -308,22 +292,21 @@ fail: status = ypdb_store(new_db, val, key, YPDB_INSERT); if (status != 0) { printf("%s: problem storing %*.*s %*.*s\n", - __progname, - val.dsize, val.dsize, val.dptr, - key.dsize, key.dsize, key.dptr); + __progname, val.dsize, val.dsize, val.dptr, + key.dsize, key.dsize, key.dptr); } } if (vflag) { printf("%*.*s --> %*.*s\n", - val.dsize, val.dsize, val.dptr, - key.dsize, key.dsize, key.dptr); + val.dsize, val.dsize, val.dptr, + key.dsize, key.dsize, key.dptr); } } if (new_db != NULL) { - snprintf(datestr, sizeof datestr, "%010u", time(NULL)); + snprintf(datestr, sizeof datestr, "%010u", time(NULL)); key.dptr = YP_LAST_KEY; key.dsize = strlen(YP_LAST_KEY); val.dptr = datestr; @@ -331,14 +314,14 @@ fail: status = ypdb_store(new_db, key, val, YPDB_INSERT); if (status != 0) { printf("%s: problem storing %*.*s %*.*s\n", - __progname, - key.dsize, key.dsize, key.dptr, - val.dsize, val.dsize, val.dptr); + __progname, + key.dsize, key.dsize, key.dptr, + val.dsize, val.dsize, val.dptr); } } if (new_db != NULL) { - gethostname(myname, sizeof(myname)); + gethostname(myname, sizeof(myname)); key.dptr = YP_MASTER_KEY; key.dsize = strlen(YP_MASTER_KEY); val.dptr = myname; @@ -346,9 +329,9 @@ fail: status = ypdb_store(new_db, key, val, YPDB_INSERT); if (status != 0) { printf("%s: problem storing %*.*s %*.*s\n", - __progname, - key.dsize, key.dsize, key.dptr, - val.dsize, val.dsize, val.dptr); + __progname, + key.dsize, key.dsize, key.dptr, + val.dsize, val.dsize, val.dptr); } } diff --git a/usr.sbin/ypserv/mknetid/mknetid.c b/usr.sbin/ypserv/mknetid/mknetid.c index f20422cdbc6..0c1a702021a 100644 --- a/usr.sbin/ypserv/mknetid/mknetid.c +++ b/usr.sbin/ypserv/mknetid/mknetid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mknetid.c,v 1.7 2002/02/13 23:10:46 deraadt Exp $ */ +/* $OpenBSD: mknetid.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: mknetid.c,v 1.7 2002/02/13 23:10:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mknetid.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -89,10 +89,7 @@ struct user *root = NULL, *tail = NULL; struct user *hroot[HASHMAX], *htail[HASHMAX]; int -read_line(fp, buf, size) - FILE *fp; - char *buf; - int size; +read_line(FILE *fp, char *buf, int size) { int done = 0; @@ -124,8 +121,7 @@ read_line(fp, buf, size) } int -hashidx(key) -char key; +hashidx(char key) { if (key < 'A') return (0); @@ -139,8 +135,7 @@ char key; } void -add_user(username, uid, gid) -char *username, *uid, *gid; +add_user(char *username, char *uid, char *gid) { struct user *u; int idx; @@ -172,8 +167,7 @@ char *username, *uid, *gid; } } -void add_group(username, gid) -char *username, *gid; +void add_group(char *username, char *gid) { struct user *u; int idx, g; @@ -197,9 +191,7 @@ char *username, *gid; } void -read_passwd(pfile, fname) -FILE *pfile; -char *fname; +read_passwd(FILE *pfile, char *fname) { char line[1024]; int line_no = 0; @@ -217,7 +209,7 @@ char *fname; /* * Check if we have the whole line - */ + */ if (line[len-1] != '\n') { fprintf(stderr, "line %d in \"%s\" is too long\n", line_no, fname); @@ -274,10 +266,9 @@ char *fname; } int -isgsep(ch) - char ch; +isgsep(char ch) { - switch(ch) { + switch (ch) { case ',': case ' ': case '\t': @@ -289,9 +280,7 @@ isgsep(ch) } void -read_group(gfile, fname) - FILE *gfile; - char *fname; +read_group(FILE *gfile, char *fname) { char line[2048]; int line_no = 0; @@ -374,9 +363,7 @@ read_group(gfile, fname) } void -print_passwd_group(qflag, domain) - int qflag; - char *domain; +print_passwd_group(int qflag, char *domain) { struct user *u, *p; int i; @@ -411,9 +398,7 @@ print_passwd_group(qflag, domain) } void -print_hosts(pfile, fname, domain) - FILE *pfile; - char *fname, *domain; +print_hosts(FILE *pfile, char *fname, char *domain) { char line[1024]; int line_no = 0; @@ -431,7 +416,7 @@ print_hosts(pfile, fname, domain) /* * Check if we have the whole line - */ + */ if (line[len-1] != '\n') { fprintf(stderr, "line %d in \"%s\" is too long\n", line_no, fname); @@ -466,9 +451,7 @@ print_hosts(pfile, fname, domain) } void -print_netid(mfile, fname) -FILE *mfile; -char *fname; +print_netid(FILE *mfile, char *fname) { char line[1024]; int line_no = 0; @@ -486,7 +469,7 @@ char *fname; /* * Check if we have the whole line - */ + */ if (line[len-1] != '\n') { fprintf(stderr, "line %d in \"%s\" is too long\n", line_no, fname); @@ -521,9 +504,7 @@ char *fname; } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int qflag, ch, usage; char *domain; diff --git a/usr.sbin/ypserv/revnetgroup/hash.c b/usr.sbin/ypserv/revnetgroup/hash.c index 7f5f5057a31..588a9904298 100644 --- a/usr.sbin/ypserv/revnetgroup/hash.c +++ b/usr.sbin/ypserv/revnetgroup/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.2 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: hash.c,v 1.3 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul . All rights reserved. @@ -40,7 +40,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: hash.c,v 1.2 2002/03/14 16:44:25 mpech Exp $"; +static const char rcsid[] = "$OpenBSD: hash.c,v 1.3 2002/07/19 02:38:40 deraadt Exp $"; #endif /* @@ -53,9 +53,7 @@ static const char rcsid[] = "$OpenBSD: hash.c,v 1.2 2002/03/14 16:44:25 mpech Ex * OZ's original sdbm hash */ u_int32_t -hash(keyarg, len) - const void *keyarg; - size_t len; +hash(const void *keyarg, size_t len) { const u_char *key; size_t loop; @@ -104,8 +102,8 @@ hash(keyarg, len) * We mask off all but the lower 8 bits since our table array * can only hold 256 elements. */ -u_int32_t hashkey(key) - char *key; +u_int32_t +hashkey(char *key) { if (key == NULL) @@ -114,9 +112,8 @@ u_int32_t hashkey(key) } /* Find an entry in the hash table (may be hanging off a linked list). */ -char *lookup(table, key) - struct group_entry *table[]; - char *key; +char * +lookup(struct group_entry *table[], char *key) { struct group_entry *cur; @@ -148,9 +145,8 @@ char *lookup(table, key) * * That's a lot of comment for such a small piece of code, isn't it. */ -void store (table, key, data) - struct group_entry *table[]; - char *key, *data; +void +store(struct group_entry *table[], char *key, char *data) { struct group_entry *new; u_int32_t i; @@ -162,8 +158,6 @@ void store (table, key, data) new->data = strdup(data); new->next = table[i]; table[i] = new; - - return; } /* @@ -178,9 +172,8 @@ void store (table, key, data) * an entry in the table, then we just have to do one thing, which is * to update its grouplist. */ -void mstore (table, key, data, domain) - struct member_entry *table[]; - char *key, *data, *domain; +void +mstore(struct member_entry *table[], char *key, char *data, char *domain) { struct member_entry *cur, *new; struct grouplist *tmp,*p; @@ -196,8 +189,8 @@ void mstore (table, key, data, domain) /* Check if all we have to do is insert a new groupname. */ while (cur) { if (!strcmp(cur->key, key) && !strcmp(cur->domain,domain)) { - p = cur->groups; - while(p) { + p = cur->groups; + while (p) { if (!strcmp(p->groupname,data)) return; p = p->next; @@ -216,6 +209,4 @@ void mstore (table, key, data, domain) new->groups = tmp; new->next = table[i]; table[i] = new; - - return; } diff --git a/usr.sbin/ypserv/revnetgroup/parse_netgroup.c b/usr.sbin/ypserv/revnetgroup/parse_netgroup.c index b13fe325226..59aec544527 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.4 2002/05/22 09:09:32 deraadt Exp $ */ +/* $OpenBSD: parse_netgroup.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -51,7 +51,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: parse_netgroup.c,v 1.4 2002/05/22 09:09:32 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: parse_netgroup.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $"; #endif /* @@ -99,8 +99,7 @@ extern struct group_entry *gtable[]; * most of the work. */ void -__setnetgrent(group) - char *group; +__setnetgrent(char *group) { /* Sanity check */ @@ -126,8 +125,7 @@ __setnetgrent(group) * Get the next netgroup off the list. */ int -__getnetgrent(hostp, userp, domp) - char **hostp, **userp, **domp; +__getnetgrent(char **hostp, char **userp, char **domp) { if (nextgrp) { *hostp = nextgrp->ng_str[NG_HOST]; @@ -143,7 +141,7 @@ __getnetgrent(hostp, userp, domp) * __endnetgrent() - cleanup */ void -__endnetgrent() +__endnetgrent(void) { struct linelist *lp, *olp; struct netgrp *gp, *ogp; @@ -180,8 +178,7 @@ __endnetgrent() * Parse the netgroup file setting up the linked lists. */ static int -parse_netgrp(group) - char *group; +parse_netgrp(char *group) { char *spos, *epos; int len, strpos; @@ -291,8 +288,7 @@ parse_netgrp(group) * is found. Return 1 if eof is encountered. */ static struct linelist * -read_for_group(group) - char *group; +read_for_group(char *group) { char *pos, *spos, *linep = NULL, *olinep = NULL; int len, olen; diff --git a/usr.sbin/ypserv/revnetgroup/revnetgroup.c b/usr.sbin/ypserv/revnetgroup/revnetgroup.c index a727450c4c8..084ce0e38ca 100644 --- a/usr.sbin/ypserv/revnetgroup/revnetgroup.c +++ b/usr.sbin/ypserv/revnetgroup/revnetgroup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: revnetgroup.c,v 1.2 2000/06/30 16:00:27 millert Exp $ */ +/* $OpenBSD: revnetgroup.c,v 1.3 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul . All rights reserved. @@ -47,7 +47,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: revnetgroup.c,v 1.2 2000/06/30 16:00:27 millert Exp $"; +static const char rcsid[] = "$OpenBSD: revnetgroup.c,v 1.3 2002/07/19 02:38:40 deraadt Exp $"; #endif /* Default location of netgroup file. */ @@ -62,25 +62,22 @@ struct group_entry *gtable[TABLESIZE]; */ struct member_entry *mtable[TABLESIZE]; -void usage(prog) -char *prog; +void +usage(char *prog) { fprintf (stderr,"usage: %s -u|-h [-f netgroup file]\n",prog); exit(1); } -extern char *optarg; - int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FILE *fp; char readbuf[LINSIZ]; struct group_entry *gcur; struct member_entry *mcur; char *host, *user, *domain; + extern char *optarg; int ch; char *key = NULL, *data = NULL; int hosts = -1, i; @@ -89,7 +86,7 @@ main(argc, argv) usage(argv[0]); while ((ch = getopt(argc, argv, "uhf:")) != -1) { - switch(ch) { + switch (ch) { case 'u': if (hosts != -1) { warnx("please use only one of -u or -h"); @@ -129,9 +126,9 @@ main(argc, argv) if (readbuf[0] == '#') continue; /* handle backslash line continuations */ - while(readbuf[strlen(readbuf) - 2] == '\\') { + while (readbuf[strlen(readbuf) - 2] == '\\') { fgets((char *)&readbuf[strlen(readbuf) - 2], - sizeof(readbuf) - strlen(readbuf), fp); + sizeof(readbuf) - strlen(readbuf), fp); } data = NULL; if ((data = (char *)(strpbrk(readbuf, " \t") + 1)) < (char *)2) @@ -149,22 +146,22 @@ main(argc, argv) */ for (i = 0; i < TABLESIZE; i++) { gcur = gtable[i]; - while(gcur) { + while (gcur) { __setnetgrent(gcur->key); - while(__getnetgrent(&host, &user, &domain) != NULL) { + while (__getnetgrent(&host, &user, &domain) != NULL) { if (hosts) { if (!(host && !strcmp(host,"-"))) { mstore(mtable, - host ? host : "*", - gcur->key, - domain ? domain : "*"); + host ? host : "*", + gcur->key, + domain ? domain : "*"); } } else { if (!(user && !strcmp(user,"-"))) { mstore(mtable, - user ? user : "*", - gcur->key, - domain ? domain : "*"); + user ? user : "*", + gcur->key, + domain ? domain : "*"); } } } @@ -178,11 +175,11 @@ main(argc, argv) /* Spew out the results. */ for (i = 0; i < TABLESIZE; i++) { mcur = mtable[i]; - while(mcur) { + while (mcur) { struct grouplist *tmp; printf ("%s.%s\t", mcur->key, mcur->domain); tmp = mcur->groups; - while(tmp) { + while (tmp) { printf ("%s", tmp->groupname); tmp = tmp->next; if (tmp) diff --git a/usr.sbin/ypserv/stdethers/stdethers.c b/usr.sbin/ypserv/stdethers/stdethers.c index e4c92bad2f8..37c4706ce34 100644 --- a/usr.sbin/ypserv/stdethers/stdethers.c +++ b/usr.sbin/ypserv/stdethers/stdethers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdethers.c,v 1.4 2001/11/19 09:01:29 deraadt Exp $ */ +/* $OpenBSD: stdethers.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: stdethers.c,v 1.4 2001/11/19 09:01:29 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: stdethers.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -60,8 +60,7 @@ extern char *ether_ntoa(struct ether_addr *); */ char * -working_ntoa(e) - u_char *e; +working_ntoa(u_char *e) { static char a[] = "xx:xx:xx:xx:xx:xx"; @@ -71,10 +70,8 @@ working_ntoa(e) } #endif -static int read_line(fp, buf, size) -FILE *fp; -char *buf; -int size; +static int +read_line(FILE *fp, char *buf, int size) { int done = 0; @@ -85,6 +82,7 @@ int size; if (len > 1 && buf[len-2] == '\\' && buf[len-1] == '\n') { int ch; + buf += len - 2; size -= len - 2; *buf = '\n'; @@ -105,9 +103,7 @@ int size; } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FILE *data_file; char data_line[1024]; @@ -117,15 +113,15 @@ main(argc, argv) char *p, *k, *v; struct ether_addr eth_addr; char hostname[256]; - + if (argc > 2) usage++; - + if (usage) { fprintf(stderr, "usage: %s [file]\n", ProgramName); exit(1); } - + if (argc == 2) { data_file = fopen(argv[1], "r"); if (data_file == NULL) { @@ -135,19 +131,19 @@ main(argc, argv) } } else data_file = stdin; - + while (read_line(data_file, data_line, sizeof(data_line))) { line_no++; len = strlen(data_line); - + if (len > 0) { if (data_line[0] == '#') continue; } - + /* * Check if we have the whole line - */ + */ if (data_line[len-1] != '\n') { if (argc == 2) { fprintf(stderr, @@ -160,19 +156,19 @@ main(argc, argv) } } else data_line[len-1] = '\0'; - + p = (char *) &data_line; - + k = p; /* save start of key */ while (!isspace(*p)) /* find first "space" */ p++; while (isspace(*p)) /* move over "space" */ p++; - + v = p; /* save start of value */ - while(*p != '\0') /* find end of string */ + while (*p != '\0') /* find end of string */ p++; - + if (ether_line(data_line, ð_addr, hostname) == 0) { fprintf(stdout, "%s\t%s\n", NTOA(ð_addr), hostname); diff --git a/usr.sbin/ypserv/stdhosts/stdhosts.c b/usr.sbin/ypserv/stdhosts/stdhosts.c index 5b244e5c0ca..95082b861c3 100644 --- a/usr.sbin/ypserv/stdhosts/stdhosts.c +++ b/usr.sbin/ypserv/stdhosts/stdhosts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdhosts.c,v 1.7 2002/03/28 22:05:58 fgsch Exp $ */ +/* $OpenBSD: stdhosts.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: stdhosts.c,v 1.7 2002/03/28 22:05:58 fgsch Exp $"; +static char rcsid[] = "$OpenBSD: stdhosts.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -42,11 +42,9 @@ static char rcsid[] = "$OpenBSD: stdhosts.c,v 1.7 2002/03/28 22:05:58 fgsch Exp #include #include #include +#include -static int read_line(fp, buf, size) -FILE *fp; -char *buf; -int size; +static int read_line(FILE *fp, char *buf, int size) { int done = 0; @@ -76,9 +74,7 @@ int size; } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { FILE *data_file; char data_line[1024]; @@ -97,7 +93,7 @@ main(argc, argv) err(1, ""); } else data_file = stdin; - + while (read_line(data_file, data_line, sizeof(data_line))) { line_no++; len = strlen(data_line); @@ -108,8 +104,7 @@ main(argc, argv) /* * Check if we have the whole line - */ - + */ if (data_line[len-1] != '\n') { if (argc == 2) fprintf(stderr, @@ -127,9 +122,9 @@ main(argc, argv) p++; while (isspace(*p)) /* replace space with */ *p = '\0'; p++; - + v = p; /* save start of value */ - while(*p != '\0') /* find end of string */ + while (*p != '\0') /* find end of string */ p++; (void)inet_aton(k, &host_addr); diff --git a/usr.sbin/ypserv/ypinit/Makefile.main b/usr.sbin/ypserv/ypinit/Makefile.main index c882886ef3c..f965ab3c3df 100644 --- a/usr.sbin/ypserv/ypinit/Makefile.main +++ b/usr.sbin/ypserv/ypinit/Makefile.main @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile.main,v 1.8 1997/07/26 22:23:44 maja Exp $ +# $OpenBSD: Makefile.main,v 1.9 2002/07/19 02:38:40 deraadt Exp $ -SUBDIR= +SUBDIR= passwd group hosts ethers networks rpc services protocols netid netgroup amd.home aliases : _SUBDIRUSE diff --git a/usr.sbin/ypserv/ypinit/README b/usr.sbin/ypserv/ypinit/README index 0bec7666d24..65955352a05 100644 --- a/usr.sbin/ypserv/ypinit/README +++ b/usr.sbin/ypserv/ypinit/README @@ -1,4 +1,4 @@ - $OpenBSD: README,v 1.2 1999/09/14 06:21:24 pjanzen Exp $ + $OpenBSD: README,v 1.3 2002/07/19 02:38:40 deraadt Exp $ The files Makefile.yp.dist and Makefile.main.dist should NEVER be changed, since they will be overwritten by, for example, 'make build'. @@ -7,4 +7,3 @@ Local changes can be done in Makefile.yp and Makefile.main. They are replaced by 'make' in /usr/src/etc, which normally isn't done. -moj - diff --git a/usr.sbin/ypserv/ypinit/ypinit.sh b/usr.sbin/ypserv/ypinit/ypinit.sh index 787c7f59305..8f4d192b8a6 100644 --- a/usr.sbin/ypserv/ypinit/ypinit.sh +++ b/usr.sbin/ypserv/ypinit/ypinit.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: ypinit.sh,v 1.9 2002/03/23 13:58:59 deraadt Exp $ +# $Id: ypinit.sh,v 1.10 2002/07/19 02:38:40 deraadt Exp $ # # ypinit.sh - setup an master or slave server. # @@ -163,7 +163,7 @@ __notice1 esac if [ -d "${YP_DIR}/${DOMAIN}" ]; then - echo "" + echo "" echo -n "Can we destroy the existing ${YP_DIR}/${DOMAIN} and its contents? [y/n: n] " read KILL @@ -186,7 +186,6 @@ __notice1 echo "OK, please clean it up by hand and start again. Bye" exit 0 fi - fi if ! mkdir "${YP_DIR}/${DOMAIN}"; then @@ -209,7 +208,7 @@ then fi SUBDIR=`grep "^SUBDIR=" ${YP_DIR}/Makefile` - + if [ -z "${SUBDIR}" ] then echo "Can't find line starting with 'SUBDIR=' in ${YP_DIR}/Makefile. " 1>&2 @@ -224,7 +223,7 @@ then done NEWSUBDIR="${NEWSUBDIR} ${DOMAIN}" - if [ -f ${YP_DIR}/Makefile.tmp ]; then + if [ -f ${YP_DIR}/Makefile.tmp ]; then rm ${YP_DIR}/Makefile.tmp fi @@ -276,7 +275,6 @@ LIST_OK="NO" while [ "${LIST_OK}" = "NO" ]; do - if [ "${SERVERTYPE}" = "MASTER" ]; then HOST_LIST="${HOST}" @@ -315,8 +313,8 @@ do echo "Update the list of hosts running YP servers in domain ${DOMAIN}." echo "Master for this domain is ${MASTER_NAME}." echo "" - echo "First verify old servers, type \\\\ to remove a server." - echo "Then add new servers, one per line. When done type a ." + echo "First verify old servers, type \\\\ to remove a server." + echo "Then add new servers, one per line. When done type a ." echo "" echo " master server : ${HOST}" if [ "${NEW_LIST}" != "" ]; then @@ -369,13 +367,12 @@ if [ $? -ne 0 ]; then echo "" 1>&2 echo "Couldn't build yp data base ${YP_DIR}/${DOMAIN}/ypservers." 1>&2 ERROR_EXISTS="YES" - if [ "${ERROR_EXIT}" = "YES" ]; then + if [ "${ERROR_EXIT}" = "YES" ]; then exit 1 fi fi if [ "${SERVERTYPE}" = "MASTER" ]; then - CUR_PWD=`pwd` cd ${YP_DIR}/${DOMAIN} echo "Running ${YP_DIR}/${DOMAIN}/Makefile..." @@ -383,7 +380,7 @@ if [ "${SERVERTYPE}" = "MASTER" ]; then echo "" 1>&2 echo "Error running Makefile." 1>&2 ERROR_EXISTS="YES" - if [ "${ERROR_EXIT}" = "YES" ]; then + if [ "${ERROR_EXIT}" = "YES" ]; then exit 1 fi fi diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c index 6807e2e444d..641b1b9f6c2 100644 --- a/usr.sbin/ypserv/yppush/yppush.c +++ b/usr.sbin/ypserv/yppush/yppush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.c,v 1.16 2001/11/19 09:01:43 deraadt Exp $ */ +/* $OpenBSD: yppush.c,v 1.17 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush.c,v 1.16 2001/11/19 09:01:43 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yppush.c,v 1.17 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include @@ -43,6 +43,7 @@ static char rcsid[] = "$OpenBSD: yppush.c,v 1.16 2001/11/19 09:01:43 deraadt Exp #include #include #include +#include #include #include @@ -68,15 +69,14 @@ extern void yppush_xfrrespprog_1(struct svc_req *request, SVCXPRT *xprt); extern bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *); void -usage() +usage(void) { - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\typpush [-d domainname] [-h host] [-v] mapname\n"); + fprintf(stderr, "usage: yppush [-d domainname] [-h host] [-v] mapname\n"); exit(1); } void -_svc_run() +_svc_run(void) { fd_set *readfdsp = NULL; extern fd_set *__svc_fdset; @@ -116,12 +116,7 @@ _svc_run() } void -req_xfr(pid, prog, transp, host, client) -pid_t pid; -u_int prog; -SVCXPRT *transp; -char *host; -CLIENT *client; +req_xfr(pid_t pid, u_int prog, SVCXPRT *transp, char *host, CLIENT *client) { struct ypreq_xfr request; struct timeval tv; @@ -155,9 +150,7 @@ CLIENT *client; } void -push(inlen, indata) -int inlen; -char *indata; +push(int inlen, char *indata) { char host[MAXHOSTNAMELEN]; CLIENT *client; @@ -201,7 +194,7 @@ char *indata; return; } - switch(pid=fork()) { + switch (pid=fork()) { case -1: fprintf(stderr, "yppush: Cannot fork.\n"); exit(1); @@ -222,13 +215,8 @@ char *indata; } int -pushit(instatus, inkey, inkeylen, inval, invallen, indata) -int instatus; -char *inkey; -int inkeylen; -char *inval; -int invallen; -char *indata; +pushit(u_long instatus, char *inkey, int inkeylen, char *inval, int invallen, + void *indata) { if (instatus != YP_TRUE) return instatus; @@ -237,9 +225,7 @@ char *indata; } int -main(argc, argv) -int argc; -char **argv; +main(int argc, char *argv[]) { struct ypall_callback ypcb; extern char *optarg; @@ -257,7 +243,7 @@ char **argv; yp_get_default_domain(&domain); hostname = NULL; while ((c=getopt(argc, argv, "d:h:v")) != -1) - switch(c) { + switch (c) { case 'd': domain = optarg; break; @@ -291,12 +277,11 @@ char **argv; /* Check domain */ snprintf(map_path, sizeof map_path, "%s/%s", YP_DB_PATH, domain); if (!((stat(map_path, &finfo) == 0) && - ((finfo.st_mode & S_IFMT) == S_IFDIR))) { - fprintf(stderr, "yppush: Map does not exist.\n"); + ((finfo.st_mode & S_IFMT) == S_IFDIR))) { + fprintf(stderr, "yppush: Map does not exist.\n"); exit(1); } - - + /* Check map */ snprintf(map_path, sizeof map_path, "%s/%s/%s%s", YP_DB_PATH, domain, Map, YPDB_SUFFIX); @@ -304,7 +289,7 @@ char **argv; fprintf(stderr, "yppush: Map does not exist.\n"); exit(1); } - + snprintf(map_path, sizeof map_path, "%s/%s/%s", YP_DB_PATH, domain, Map); yp_databas = ypdb_open(map_path, 0, O_RDONLY); @@ -335,7 +320,6 @@ char **argv; } } } - yp_bind(Domain); @@ -362,4 +346,3 @@ char **argv; exit(0); } - diff --git a/usr.sbin/ypserv/yppush/yppush.h b/usr.sbin/ypserv/yppush/yppush.h index 5114d0f403b..5aa278e5bca 100644 --- a/usr.sbin/ypserv/yppush/yppush.h +++ b/usr.sbin/ypserv/yppush/yppush.h @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.h,v 1.5 2002/02/19 19:39:41 millert Exp $ */ +/* $OpenBSD: yppush.h,v 1.6 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson @@ -68,8 +68,8 @@ typedef struct yppushresp_xfr yppushresp_xfr; #define YPPUSHPROC_XFRRESP ((u_long)1) __BEGIN_DECLS -bool_t xdr_yppush_status(XDR *, yppush_status*); -bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); +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 *); diff --git a/usr.sbin/ypserv/yppush/yppush_err.c b/usr.sbin/ypserv/yppush/yppush_err.c index 070bba2a9ab..c910dede8f2 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.3 2000/10/12 09:47:27 deraadt Exp $ */ +/* $OpenBSD: yppush_err.c,v 1.4 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson @@ -32,17 +32,16 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush_err.c,v 1.3 2000/10/12 09:47:27 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yppush_err.c,v 1.4 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include char * -yppush_err_string(y) - enum yppush_status y; +yppush_err_string(enum yppush_status y) { - switch(y) { + switch (y) { case YPPUSH_SUCC: return ("Success"); case YPPUSH_AGE: @@ -75,6 +74,6 @@ yppush_err_string(y) return ("ypxfr error"); case YPPUSH_REFUSED: return ("Transfer request refused by ypserv"); - } + } return ("unknown error"); } diff --git a/usr.sbin/ypserv/yppush/yppush_proc.c b/usr.sbin/ypserv/yppush/yppush_proc.c index 6b5cab3abae..1c451984da9 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.4 2000/10/12 09:47:28 deraadt Exp $ */ +/* $OpenBSD: yppush_proc.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.4 2000/10/12 09:47:28 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.5 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include @@ -40,27 +40,21 @@ static char rcsid[] = "$OpenBSD: yppush_proc.c,v 1.4 2000/10/12 09:47:28 deraadt extern int Verbose; -void * -yppushproc_null_1_svc(argp, rqstp) - void *argp; - struct svc_req *rqstp; +void * +yppushproc_null_1_svc(void *argp, struct svc_req *rqstp) { - - static char* result; + static char *result; /* * insert server code here */ - return((void*) &result); + return((void *) &result); } -void * -yppushproc_xfrresp_1_svc(argp, rqstp) - yppushresp_xfr *argp; - struct svc_req *rqstp; +void * +yppushproc_xfrresp_1_svc(yppushresp_xfr *argp, struct svc_req *rqstp) { - - static char* result; + static char *result; /* * insert server code here @@ -68,6 +62,5 @@ yppushproc_xfrresp_1_svc(argp, rqstp) if ((argp->status < YPPUSH_SUCC) || Verbose) fprintf(stderr, "yppush: %s\n", yppush_err_string(argp->status)); - - return((void*) &result); + return((void *) &result); } diff --git a/usr.sbin/ypserv/yppush/yppush_svc.c b/usr.sbin/ypserv/yppush/yppush_svc.c index c900176b107..425b8ab2167 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.7 2002/03/14 16:44:25 mpech Exp $ */ +/* $OpenBSD: yppush_svc.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.7 2002/03/14 16:44:25 mpech Exp $"; +static char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $"; #endif /* not lint */ #include "yppush.h" @@ -57,8 +57,7 @@ int _rpcfdtype; /* Whether Stream or Datagram ? */ int _rpcsvcdirty; /* Still serving ? */ static -void _msgout(msg) - char *msg; +void _msgout(char *msg) { #ifdef RPC_SVC_FG if (_rpcpmstart) @@ -71,9 +70,7 @@ void _msgout(msg) } void -yppush_xfrrespprog_1(rqstp, transp) - struct svc_req *rqstp; - SVCXPRT *transp; +yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp) { union { int fill; @@ -120,5 +117,4 @@ yppush_xfrrespprog_1(rqstp, transp) _rpcsvcdirty = 0; if (rqstp->rq_proc!=YPPUSHPROC_NULL) exit(0); - return; } diff --git a/usr.sbin/ypserv/ypserv/acl.c b/usr.sbin/ypserv/ypserv/acl.c index 4ab5ab3896f..4b1341ed6bb 100644 --- a/usr.sbin/ypserv/ypserv/acl.c +++ b/usr.sbin/ypserv/ypserv/acl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acl.c,v 1.7 2001/11/19 09:03:06 deraadt Exp $ */ +/* $OpenBSD: acl.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: acl.c,v 1.7 2001/11/19 09:03:06 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: acl.c,v 1.8 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -52,10 +52,7 @@ static char rcsid[] = "$OpenBSD: acl.c,v 1.7 2001/11/19 09:03:06 deraadt Exp $"; static struct aclent *acl_root = NULL; static int -acl_read_line(fp, buf, size) - FILE *fp; - char *buf; - int size; +acl_read_line(FILE *fp, char *buf, int size) { int len = 0; char *c, *p, l; @@ -65,7 +62,7 @@ acl_read_line(fp, buf, size) do { while (fgets(buf, size, fp)) { c = buf; - while(*c != '\0') { + while (*c != '\0') { if (*c == '#' || *c == '\n') { *c = '\0'; } else { @@ -74,7 +71,7 @@ acl_read_line(fp, buf, size) } c = p = buf; l = ' '; - while(*c != '\0') { + while (*c != '\0') { if (isspace(l) && isspace(*c)) { c++; } else { @@ -82,7 +79,7 @@ acl_read_line(fp, buf, size) } } *p = '\0'; - + if (p != buf) { --p; if (isspace(*p) != 0) { @@ -98,11 +95,10 @@ acl_read_line(fp, buf, size) } int -acl_check_host(addr) -struct in_addr *addr; +acl_check_host(struct in_addr *addr) { struct aclent *p; - + p = acl_root; while (p != NULL) { if ((addr->s_addr & p->s_mask) == p->s_addr) @@ -113,18 +109,16 @@ struct in_addr *addr; } void -acl_add_net(allow, addr,mask) - int allow; - struct in_addr *addr, *mask; +acl_add_net(int allow, struct in_addr *addr, struct in_addr *mask) { struct aclent *acl, *p; - + acl = (struct aclent *) malloc(sizeof(struct aclent)); acl->next = NULL; acl->allow = allow; acl->s_addr = addr->s_addr; acl->s_mask = mask->s_addr; - + if (acl_root == NULL) { acl_root = acl; } else { @@ -133,12 +127,10 @@ acl_add_net(allow, addr,mask) p = p->next; p->next = acl; } -} +} void -acl_add_host(allow, addr) - int allow; - struct in_addr *addr; +acl_add_host(int allow, struct in_addr *addr) { struct in_addr mask; @@ -147,27 +139,22 @@ acl_add_host(allow, addr) } int -acl_init(file) - char *file; +acl_init(char *file) { - char data_line[1024]; - int line_no = 0; - int len, i; - int allow = TRUE; - int error_cnt = 0; - char *p, *k; - int state; + char data_line[1024], *p, *k; + int line_no = 0, len, i, state; + int allow = TRUE, error_cnt = 0; struct in_addr addr, mask, *host_addr; struct hostent *host; - struct netent *net; - FILE *data_file = NULL; - + struct netent *net; + FILE *data_file = NULL; + if (file != NULL) data_file = fopen(file, "r"); while (data_file != NULL && acl_read_line(data_file, data_line, sizeof(data_line))) { - + line_no++; len = strlen(data_line); if (len == 0) @@ -213,7 +200,7 @@ acl_init(file) p++; i++; } - + if (*p != '\0') *p++ = '\0'; @@ -240,7 +227,7 @@ acl_init(file) acl_add_net(allow, &addr, &mask); state = ACLE_OK; } - + /* State 6 & 7: host line */ /* State 8 & 9: net line */ @@ -253,10 +240,10 @@ acl_init(file) p++; i++; } - + if (*p != '\0') *p++ = '\0'; - + if (state == ACLS_ALLOW_HOST || state == ACLS_DENY_HOST) { if (*k >= '0' && *k <= '9') { (void)inet_aton(k, &addr); @@ -301,7 +288,7 @@ acl_init(file) if (*p == '\0' && (state == ACLS_ALLOW_HOST_DONE || state == ACLS_DENY_HOST_DONE)) state = ACLE_OK; - + /* State 12 & 13: allow/deny net line */ if (*p == '\0' && (state == ACLS_ALLOW_NET_DONE || state == ACLS_DENY_NET_DONE)) { @@ -316,14 +303,14 @@ acl_init(file) if (*p != '\0' && (state == ACLS_ALLOW_NET_DONE || state == ACLS_DENY_NET_DONE)) { - + k = p; /* save start of verb */ i = 0; while (*p != '\0' && !isspace(*p = tolower(*p))) { p++; i++; } - + if (*p != '\0') *p++ = '\0'; @@ -345,7 +332,7 @@ acl_init(file) p++; i++; } - + if (*p != '\0') *p++ = '\0'; @@ -376,7 +363,7 @@ acl_init(file) acl_add_net(allow, &addr, &mask); state = ACLE_OK; } - + switch (state) { case ACLE_NONETMASK: fprintf(stderr, @@ -433,20 +420,15 @@ acl_init(file) } int -acl_securenet(file) -char *file; +acl_securenet(char *file) { - char data_line[1024]; - int line_no = 0; - int len, i; - int allow = TRUE; - int error_cnt = 0; - char *p, *k; - int state; + char data_line[1024], *p, *k; + int line_no = 0, len, i, allow = TRUE, state; + int error_cnt = 0; struct in_addr addr, mask; - struct netent *net; - FILE *data_file = NULL; - + struct netent *net; + FILE *data_file = NULL; + if (file != NULL) data_file = fopen(file, "r"); @@ -474,12 +456,12 @@ char *file; p++; i++; } - + if (*p != '\0') { *p++ = '\0'; state = ACLS_ALLOW_NET_MASK; } - + if (state == ACLS_INIT) state = ACLE_UEOL; @@ -496,18 +478,18 @@ char *file; state = ACLS_ALLOW_NET; } } - + k = p; /* save start of verb */ i = 0; while (*p != '\0' && !isspace(*p = tolower(*p))) { p++; i++; } - + if (*p != '\0') *p++ = '\0'; } - + if (state == ACLS_ALLOW_NET_MASK) state = ACLE_UEOL; @@ -525,7 +507,7 @@ char *file; } } } - + if (state == ACLS_ALLOW_NET) state = ACLE_UEOL; @@ -533,7 +515,7 @@ char *file; acl_add_net(allow, &addr, &mask); state = ACLE_OK; } - + switch (state) { case ACLE_NONET: error_cnt++; @@ -559,7 +541,7 @@ char *file; if (data_file != NULL) { (void)fflush(stderr); (void)fclose(data_file); - + /* Always add a last deny all if file exists */ addr.s_addr = mask.s_addr = 0; allow = FALSE; @@ -567,7 +549,7 @@ char *file; } /* Always add a last allow all if file don't exists */ - + addr.s_addr = mask.s_addr = 0; allow = TRUE; acl_add_net(allow, &addr, &mask); @@ -575,7 +557,7 @@ char *file; } void -acl_reset() +acl_reset(void) { struct aclent *p; diff --git a/usr.sbin/ypserv/ypserv/acl.h b/usr.sbin/ypserv/ypserv/acl.h index c8883a21bb6..b93a6db7938 100644 --- a/usr.sbin/ypserv/ypserv/acl.h +++ b/usr.sbin/ypserv/ypserv/acl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acl.h,v 1.5 2002/02/16 21:28:11 millert Exp $ */ +/* $OpenBSD: acl.h,v 1.6 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -83,5 +83,3 @@ void acl_reset(void); __END_DECLS #endif /* !_ACL_H_ */ - - diff --git a/usr.sbin/ypserv/ypserv/securenet.5 b/usr.sbin/ypserv/ypserv/securenet.5 index 080d24b7f56..ff3f2046195 100644 --- a/usr.sbin/ypserv/ypserv/securenet.5 +++ b/usr.sbin/ypserv/ypserv/securenet.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: securenet.5,v 1.7 2000/03/23 21:39:58 aaron Exp $ +.\" $OpenBSD: securenet.5,v 1.8 2002/07/19 02:38:40 deraadt Exp $ .\" .\" Copyright (c) 1994 Mats O Jansson .\" All rights reserved. @@ -73,4 +73,3 @@ The file was added to .Tn NIS by Sun Microsystems, Inc. as a bugfix for weak security. - diff --git a/usr.sbin/ypserv/ypserv/yp.h b/usr.sbin/ypserv/ypserv/yp.h index 01c6976da31..694b9bcfb38 100644 --- a/usr.sbin/ypserv/ypserv/yp.h +++ b/usr.sbin/ypserv/ypserv/yp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: yp.h,v 1.5 1997/07/25 20:12:31 mickey Exp $ */ +/* $OpenBSD: yp.h,v 1.6 2002/07/19 02:38:40 deraadt Exp $ */ /* * Please do not edit this file. @@ -29,13 +29,13 @@ enum ypstat { YP_VERS = -8, }; typedef enum ypstat ypstat; -#ifdef __cplusplus -extern "C" bool_t xdr_ypstat(XDR *, ypstat*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypstat(XDR *, ypstat *); #elif defined(__STDC__) -extern bool_t xdr_ypstat(XDR *, ypstat*); -#else /* Old Style C */ +extern bool_t xdr_ypstat(XDR *, ypstat *); +#else /* Old Style C */ bool_t xdr_ypstat(); -#endif /* Old Style C */ +#endif /* Old Style C */ enum ypxfrstat { @@ -57,69 +57,69 @@ enum ypxfrstat { YPXFR_REFUSED = -14, }; typedef enum ypxfrstat ypxfrstat; -#ifdef __cplusplus -extern "C" bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypxfrstat(XDR *, ypxfrstat *); #elif defined(__STDC__) -extern bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); -#else /* Old Style C */ +extern bool_t xdr_ypxfrstat(XDR *, ypxfrstat *); +#else /* Old Style C */ bool_t xdr_ypxfrstat(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef char *domainname; -#ifdef __cplusplus -extern "C" bool_t xdr_domainname(XDR *, domainname*); +#ifdef __cplusplus +extern "C" bool_t xdr_domainname(XDR *, domainname *); #elif defined(__STDC__) -extern bool_t xdr_domainname(XDR *, domainname*); -#else /* Old Style C */ +extern bool_t xdr_domainname(XDR *, domainname *); +#else /* Old Style C */ bool_t xdr_domainname(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef char *mapname; -#ifdef __cplusplus -extern "C" bool_t xdr_mapname(XDR *, mapname*); +#ifdef __cplusplus +extern "C" bool_t xdr_mapname(XDR *, mapname *); #elif defined(__STDC__) -extern bool_t xdr_mapname(XDR *, mapname*); -#else /* Old Style C */ +extern bool_t xdr_mapname(XDR *, mapname *); +#else /* Old Style C */ bool_t xdr_mapname(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef char *peername; -#ifdef __cplusplus -extern "C" bool_t xdr_peername(XDR *, peername*); +#ifdef __cplusplus +extern "C" bool_t xdr_peername(XDR *, peername *); #elif defined(__STDC__) -extern bool_t xdr_peername(XDR *, peername*); -#else /* Old Style C */ +extern bool_t xdr_peername(XDR *, peername *); +#else /* Old Style C */ bool_t xdr_peername(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef struct { u_int keydat_len; char *keydat_val; } keydat; -#ifdef __cplusplus -extern "C" bool_t xdr_keydat(XDR *, keydat*); +#ifdef __cplusplus +extern "C" bool_t xdr_keydat(XDR *, keydat *); #elif defined(__STDC__) -extern bool_t xdr_keydat(XDR *, keydat*); -#else /* Old Style C */ +extern bool_t xdr_keydat(XDR *, keydat *); +#else /* Old Style C */ bool_t xdr_keydat(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef struct { u_int valdat_len; char *valdat_val; } valdat; -#ifdef __cplusplus -extern "C" bool_t xdr_valdat(XDR *, valdat*); +#ifdef __cplusplus +extern "C" bool_t xdr_valdat(XDR *, valdat *); #elif defined(__STDC__) -extern bool_t xdr_valdat(XDR *, valdat*); -#else /* Old Style C */ +extern bool_t xdr_valdat(XDR *, valdat *); +#else /* Old Style C */ bool_t xdr_valdat(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypmap_parms { @@ -129,13 +129,13 @@ struct ypmap_parms { peername peer; }; typedef struct ypmap_parms ypmap_parms; -#ifdef __cplusplus -extern "C" bool_t xdr_ypmap_parms(XDR *, ypmap_parms*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypmap_parms(XDR *, ypmap_parms *); #elif defined(__STDC__) -extern bool_t xdr_ypmap_parms(XDR *, ypmap_parms*); -#else /* Old Style C */ +extern bool_t xdr_ypmap_parms(XDR *, ypmap_parms *); +#else /* Old Style C */ bool_t xdr_ypmap_parms(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypreq_key { @@ -144,13 +144,13 @@ struct ypreq_key { keydat key; }; typedef struct ypreq_key ypreq_key; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreq_key(XDR *, ypreq_key*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypreq_key(XDR *, ypreq_key *); #elif defined(__STDC__) -extern bool_t xdr_ypreq_key(XDR *, ypreq_key*); -#else /* Old Style C */ +extern bool_t xdr_ypreq_key(XDR *, ypreq_key *); +#else /* Old Style C */ bool_t xdr_ypreq_key(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypreq_nokey { @@ -158,13 +158,13 @@ struct ypreq_nokey { mapname map; }; typedef struct ypreq_nokey ypreq_nokey; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey *); #elif defined(__STDC__) -extern bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*); -#else /* Old Style C */ +extern bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey *); +#else /* Old Style C */ bool_t xdr_ypreq_nokey(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypreq_xfr { @@ -174,13 +174,13 @@ struct ypreq_xfr { u_int port; }; typedef struct ypreq_xfr ypreq_xfr; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr *); #elif defined(__STDC__) -extern bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*); -#else /* Old Style C */ +extern bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr *); +#else /* Old Style C */ bool_t xdr_ypreq_xfr(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_val { @@ -188,13 +188,13 @@ struct ypresp_val { valdat val; }; typedef struct ypresp_val ypresp_val; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_val(XDR *, ypresp_val*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_val(XDR *, ypresp_val *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_val(XDR *, ypresp_val*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_val(XDR *, ypresp_val *); +#else /* Old Style C */ bool_t xdr_ypresp_val(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_key_val { @@ -203,13 +203,13 @@ struct ypresp_key_val { valdat val; }; typedef struct ypresp_key_val ypresp_key_val; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val *); +#else /* Old Style C */ bool_t xdr_ypresp_key_val(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_master { @@ -217,13 +217,13 @@ struct ypresp_master { peername peer; }; typedef struct ypresp_master ypresp_master; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_master(XDR *, ypresp_master*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_master(XDR *, ypresp_master *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_master(XDR *, ypresp_master*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_master(XDR *, ypresp_master *); +#else /* Old Style C */ bool_t xdr_ypresp_master(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_order { @@ -231,13 +231,13 @@ struct ypresp_order { u_int32_t ordernum; }; typedef struct ypresp_order ypresp_order; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_order(XDR *, ypresp_order*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_order(XDR *, ypresp_order *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_order(XDR *, ypresp_order*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_order(XDR *, ypresp_order *); +#else /* Old Style C */ bool_t xdr_ypresp_order(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_all { @@ -247,13 +247,13 @@ struct ypresp_all { } ypresp_all_u; }; typedef struct ypresp_all ypresp_all; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_all(XDR *, ypresp_all*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_all(XDR *, ypresp_all *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_all(XDR *, ypresp_all*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_all(XDR *, ypresp_all *); +#else /* Old Style C */ bool_t xdr_ypresp_all(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_xfr { @@ -261,13 +261,13 @@ struct ypresp_xfr { ypxfrstat xfrstat; }; typedef struct ypresp_xfr ypresp_xfr; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr *); +#else /* Old Style C */ bool_t xdr_ypresp_xfr(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypmaplist { @@ -275,13 +275,13 @@ struct ypmaplist { struct ypmaplist *next; }; typedef struct ypmaplist ypmaplist; -#ifdef __cplusplus -extern "C" bool_t xdr_ypmaplist(XDR *, ypmaplist*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypmaplist(XDR *, ypmaplist *); #elif defined(__STDC__) -extern bool_t xdr_ypmaplist(XDR *, ypmaplist*); -#else /* Old Style C */ +extern bool_t xdr_ypmaplist(XDR *, ypmaplist *); +#else /* Old Style C */ bool_t xdr_ypmaplist(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypresp_maplist { @@ -289,13 +289,13 @@ struct ypresp_maplist { ypmaplist *maps; }; typedef struct ypresp_maplist ypresp_maplist; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist *); #elif defined(__STDC__) -extern bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*); -#else /* Old Style C */ +extern bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist *); +#else /* Old Style C */ bool_t xdr_ypresp_maplist(); -#endif /* Old Style C */ +#endif /* Old Style C */ enum yppush_status { @@ -317,13 +317,13 @@ enum yppush_status { YPPUSH_REFUSED = -14, }; typedef enum yppush_status yppush_status; -#ifdef __cplusplus -extern "C" bool_t xdr_yppush_status(XDR *, yppush_status*); +#ifdef __cplusplus +extern "C" bool_t xdr_yppush_status(XDR *, yppush_status *); #elif defined(__STDC__) -extern bool_t xdr_yppush_status(XDR *, yppush_status*); -#else /* Old Style C */ +extern bool_t xdr_yppush_status(XDR *, yppush_status *); +#else /* Old Style C */ bool_t xdr_yppush_status(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct yppushresp_xfr { @@ -331,13 +331,13 @@ struct yppushresp_xfr { yppush_status status; }; typedef struct yppushresp_xfr yppushresp_xfr; -#ifdef __cplusplus -extern "C" bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); +#ifdef __cplusplus +extern "C" bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr *); #elif defined(__STDC__) -extern bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); -#else /* Old Style C */ +extern bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr *); +#else /* Old Style C */ bool_t xdr_yppushresp_xfr(); -#endif /* Old Style C */ +#endif /* Old Style C */ enum ypbind_resptype { @@ -345,13 +345,13 @@ enum ypbind_resptype { YPBIND_FAIL_VAL = 2, }; typedef enum ypbind_resptype ypbind_resptype; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype *); #elif defined(__STDC__) -extern bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*); -#else /* Old Style C */ +extern bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype *); +#else /* Old Style C */ bool_t xdr_ypbind_resptype(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypbind_binding { @@ -359,13 +359,13 @@ struct ypbind_binding { char ypbind_binding_port[2]; }; typedef struct ypbind_binding ypbind_binding; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_binding(XDR *, ypbind_binding*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypbind_binding(XDR *, ypbind_binding *); #elif defined(__STDC__) -extern bool_t xdr_ypbind_binding(XDR *, ypbind_binding*); -#else /* Old Style C */ +extern bool_t xdr_ypbind_binding(XDR *, ypbind_binding *); +#else /* Old Style C */ bool_t xdr_ypbind_binding(); -#endif /* Old Style C */ +#endif /* Old Style C */ struct ypbind_resp { @@ -376,13 +376,13 @@ struct ypbind_resp { } ypbind_resp_u; }; typedef struct ypbind_resp ypbind_resp; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_resp(XDR *, ypbind_resp*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypbind_resp(XDR *, ypbind_resp *); #elif defined(__STDC__) -extern bool_t xdr_ypbind_resp(XDR *, ypbind_resp*); -#else /* Old Style C */ +extern bool_t xdr_ypbind_resp(XDR *, ypbind_resp *); +#else /* Old Style C */ bool_t xdr_ypbind_resp(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPBIND_ERR_ERR 1 #define YPBIND_ERR_NOSERV 2 @@ -394,13 +394,13 @@ struct ypbind_setdom { u_int ypsetdom_vers; }; typedef struct ypbind_setdom ypbind_setdom; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom *); #elif defined(__STDC__) -extern bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*); -#else /* Old Style C */ +extern bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom *); +#else /* Old Style C */ bool_t xdr_ypbind_setdom(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPPROG ((u_long)100004) @@ -482,7 +482,7 @@ extern ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *); extern ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *); extern ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPPROC_NULL ((u_long)0) extern void * ypproc_null_2(); extern void * ypproc_null_2_svc(); @@ -519,7 +519,7 @@ extern ypresp_order * ypproc_order_2_svc(); #define YPPROC_MAPLIST ((u_long)11) extern ypresp_maplist * ypproc_maplist_2(); extern ypresp_maplist * ypproc_maplist_2_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPPUSH_XFRRESPPROG ((u_long)0x40000000) #define YPPUSH_XFRRESPVERS ((u_long)1) @@ -540,14 +540,14 @@ extern void * yppushproc_null_1_svc(void *, struct svc_req *); extern yppushresp_xfr * yppushproc_xfrresp_1(void *, CLIENT *); extern yppushresp_xfr * yppushproc_xfrresp_1_svc(void *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPPUSHPROC_NULL ((u_long)0) extern void * yppushproc_null_1(); extern void * yppushproc_null_1_svc(); #define YPPUSHPROC_XFRRESP ((u_long)1) extern yppushresp_xfr * yppushproc_xfrresp_1(); extern yppushresp_xfr * yppushproc_xfrresp_1_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPBINDPROG ((u_long)100007) #define YPBINDVERS ((u_long)2) @@ -574,7 +574,7 @@ extern ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *); extern void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *); extern void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPBINDPROC_NULL ((u_long)0) extern void * ypbindproc_null_2(); extern void * ypbindproc_null_2_svc(); @@ -584,6 +584,6 @@ extern ypbind_resp * ypbindproc_domain_2_svc(); #define YPBINDPROC_SETDOM ((u_long)2) extern void * ypbindproc_setdom_2(); extern void * ypbindproc_setdom_2_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ #endif /* !_YP_H_RPCGEN */ diff --git a/usr.sbin/ypserv/ypserv/ypserv.acl b/usr.sbin/ypserv/ypserv/ypserv.acl index afeb86fcb1b..fc78be31fe9 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.acl +++ b/usr.sbin/ypserv/ypserv/ypserv.acl @@ -35,10 +35,9 @@ allow net mojathome netmask 255.255.255.0 ############################################################################# # At last we have a command that will match any caller: # -# allow all +# allow all # deny all # # reject all connections deny all - diff --git a/usr.sbin/ypserv/ypserv/ypserv.acl.5 b/usr.sbin/ypserv/ypserv/ypserv.acl.5 index 6cca09f8f1f..d418b092e75 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.acl.5 +++ b/usr.sbin/ypserv/ypserv/ypserv.acl.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ypserv.acl.5,v 1.13 2002/02/17 19:38:52 maja Exp $ +.\" $OpenBSD: ypserv.acl.5,v 1.14 2002/07/19 02:38:40 deraadt Exp $ .\" .\" Copyright (c) 1994 Mats O Jansson .\" All rights reserved. @@ -184,4 +184,3 @@ configuration file .Xr ypserv 8 .Sh AUTHORS Mats O Jansson - diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c index e0073649dca..36b0d91765c 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.c +++ b/usr.sbin/ypserv/ypserv/ypserv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv.c,v 1.22 2002/05/26 09:32:44 deraadt Exp $ */ +/* $OpenBSD: ypserv.c,v 1.23 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,37 +32,35 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypserv.c,v 1.22 2002/05/26 09:32:44 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypserv.c,v 1.23 2002/07/19 02:38:40 deraadt Exp $"; #endif #include #include #include -#include /* TIOCNOTTY */ +#include #include #include "yp.h" #include "ypv1.h" #include -#include /* getenv, exit */ -#include /* strcmp */ +#include +#include #include #include #include +#include #include #include -#include /* for pmap_unset */ +#include #include -#ifdef SYSLOG #include -#else -#define LOG_ERR 1 -#define openlog(a, b, c) -#endif #include "acl.h" #include "yplog.h" #include "ypdef.h" #include +void ypdb_init(void); + #ifdef DEBUG #define RPC_SVC_FG #endif @@ -84,8 +82,8 @@ extern int __svc_fdsetsize; extern fd_set *__svc_fdset; extern void svc_getreqset2(fd_set *, int); -static -void _msgout(char* msg) +static void +_msgout(char *msg) { #ifdef RPC_SVC_FG if (_rpcpmstart) @@ -393,16 +391,14 @@ my_svc_run() } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int usage = 0, xflag = 0, allowv1 = 0, ch, sock, proto; struct sockaddr_in saddr; int asize = sizeof (saddr); extern char *optarg; SVCXPRT *transp; - + while ((ch = getopt(argc, argv, "1a:dx")) != -1) switch (ch) { case '1': @@ -421,7 +417,7 @@ main(argc, argv) usage++; break; } - + if (usage) { (void)fprintf(stderr, "usage: %s [-a aclfile] [-d] [-x]\n",progname); exit(1); @@ -486,7 +482,7 @@ main(argc, argv) ypdb_init(); /* init db stuff */ chdir("/"); - + (void)signal(SIGCHLD, sig_child); (void)signal(SIGHUP, sig_hup); pidfile(NULL); diff --git a/usr.sbin/ypserv/ypserv/ypserv_db.c b/usr.sbin/ypserv/ypserv/ypserv_db.c index 2255ae7790d..7d4193341b1 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.16 2001/11/19 09:03:06 deraadt Exp $ */ +/* $OpenBSD: ypserv_db.c,v 1.17 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -34,11 +34,11 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.16 2001/11/19 09:03:06 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.17 2002/07/19 02:38:40 deraadt Exp $"; #endif /* - * major revision/cleanup of Mats' version + * major revision/cleanup of Mats' version * done by Chuck Cranor * Jan 1996. */ @@ -95,7 +95,7 @@ extern int usedns; * ypdb_init: init the queues and lists */ void -ypdb_init() +ypdb_init(void) { LIST_INIT(&doms); @@ -108,13 +108,9 @@ ypdb_init() * ypprivate is FALSE. */ int -yp_private(key, ypprivate) - datum key; - int ypprivate; +yp_private(datum key, int ypprivate) { - int result; - - if (ypprivate) + if (ypprivate) return (FALSE); if (key.dsize == 0 || key.dptr == NULL) @@ -141,7 +137,6 @@ yp_private(key, ypprivate) if (key.dsize == YP_SECURE_LEN && strncmp(key.dptr, YP_SECURE_KEY, YP_SECURE_LEN) == 0) return(TRUE); - return(FALSE); } @@ -150,11 +145,11 @@ yp_private(key, ypprivate) * no more file descripotors free, or we want to close all maps. */ void -ypdb_close_last() +ypdb_close_last(void) { struct opt_map *last = maps.cqh_last; - if (last == (void*)&maps) { + if (last == (void *)&maps) { yplog(" ypdb_close_last: LRU list is empty!"); return; } @@ -176,9 +171,9 @@ ypdb_close_last() * Close all open maps. */ void -ypdb_close_all() +ypdb_close_all(void) { - + #ifdef DEBUG yplog(" ypdb_close_all(): start"); #endif @@ -193,8 +188,7 @@ ypdb_close_all() * Close Database if Open/Close Optimization isn't turned on. */ void -ypdb_close_db(db) - DBM *db; +ypdb_close_db(DBM *db) { #ifdef DEBUG yplog(" ypdb_close_db(0x%x)", db); @@ -208,18 +202,13 @@ ypdb_close_db(db) * ypdb_open_db */ DBM * -ypdb_open_db(domain, map, status, map_info) - domainname domain; - mapname map; - ypstat *status; - struct opt_map **map_info; +ypdb_open_db(domainname domain, mapname map, ypstat *status, + struct opt_map **map_info) { char map_path[MAXPATHLEN]; static char *domain_key = YP_INTERDOMAIN_KEY; static char *secure_key = YP_SECURE_KEY; - struct stat finfo; DBM *db; - int fd; struct opt_domain *d = NULL; struct opt_map *m = NULL; datum k, v; @@ -275,7 +264,7 @@ ypdb_open_db(domain, map, status, map_info) i = 0; while (i == 0) { #endif - snprintf(map_path, sizeof(map_path), "%s/%s/%s", YP_DB_PATH, + snprintf(map_path, sizeof(map_path), "%s/%s/%s", YP_DB_PATH, domain, map); db = ypdb_open(map_path, O_RDONLY, 0444); #ifdef OPTDB @@ -304,12 +293,12 @@ ypdb_open_db(domain, map, status, map_info) return(NULL); } #ifdef DEBUG - yplog(" ypdb_open_db: ypdb_open FAILED: map %s (domain=%s)", + yplog(" ypdb_open_db: ypdb_open FAILED: map %s (domain=%s)", map, domain); #endif return(NULL); } - + /* * note: status now YP_NOMAP */ @@ -371,7 +360,7 @@ ypdb_open_db(domain, map, status, map_info) if (map_info) *map_info = m; #ifdef DEBUG - yplog(" ypdb_open_db: NEW MAP domain=%s, map=%s, hl=%d, s=%d, db=0x%x", + yplog(" ypdb_open_db: NEW MAP domain=%s, map=%s, hl=%d, s=%d, db=0x%x", domain, map, m->host_lookup, m->secure, m->db); #endif return(m->db); @@ -381,23 +370,17 @@ ypdb_open_db(domain, map, status, map_info) * lookup host */ ypstat -lookup_host(nametable, host_lookup, db, keystr, result) - int nametable; - int host_lookup; - DBM *db; - char *keystr; - ypresp_val *result; +lookup_host(int nametable, int host_lookup, DBM *db, char *keystr, + ypresp_val *result) { - struct hostent *host; - struct in_addr *addr_name; - struct in_addr addr_addr; - static char val[BUFSIZ+1]; /* match libc */ - static hostname[MAXHOSTNAMELEN]; - char tmpbuf[MAXHOSTNAMELEN + 20]; - char *v; + struct hostent *host; + struct in_addr *addr_name; + struct in_addr addr_addr; + static char val[BUFSIZ+1]; /* match libc */ + static char hostname[MAXHOSTNAMELEN]; + char tmpbuf[MAXHOSTNAMELEN + 20], *v, *ptr; int l; - char *ptr; - + if (!host_lookup) return(YP_NOKEY); @@ -407,7 +390,7 @@ lookup_host(nametable, host_lookup, db, keystr, result) if (nametable) { host = gethostbyname(keystr); - if (host == NULL || host->h_addrtype != AF_INET) + if (host == NULL || host->h_addrtype != AF_INET) return(YP_NOKEY); addr_name = (struct in_addr *) *host->h_addr_list; v = val; @@ -436,7 +419,7 @@ lookup_host(nametable, host_lookup, db, keystr, result) return(YP_NOKEY); l = 0; - for(; host->h_addr_list[0] != NULL; host->h_addr_list++) + for (; host->h_addr_list[0] != NULL; host->h_addr_list++) if (!bcmp(host->h_addr_list[0], &addr_addr, sizeof(addr_addr))) l++; if (l == 0) { @@ -468,30 +451,26 @@ lookup_host(nametable, host_lookup, db, keystr, result) } ypresp_val -ypdb_get_record(domain, map, key, ypprivate) - domainname domain; - mapname map; - keydat key; - int ypprivate; +ypdb_get_record(domainname domain, mapname map, keydat key, int ypprivate) { static ypresp_val res; static char keystr[YPMAXRECORD+1]; DBM *db; datum k, v; - int host_lookup, hn; + int host_lookup = 0, hn; struct opt_map *map_info = NULL; bzero((char *)&res, sizeof(res)); - + db = ypdb_open_db(domain, map, &res.stat, &map_info); - if (!db || res.stat < 0) + if (!db || res.stat < 0) return(res); if (map_info) host_lookup = map_info->host_lookup; k.dptr = key.keydat_val; k.dsize = key.keydat_len; - + if (yp_private(k, ypprivate)) { res.stat = YP_NOKEY; goto done; @@ -502,7 +481,7 @@ ypdb_get_record(domain, map, key, ypprivate) if (v.dptr == NULL) { res.stat = YP_NOKEY; if ((hn = strcmp(map, YP_HOSTNAME)) != 0 && - strcmp(map, YP_HOSTADDR) != 0) + strcmp(map, YP_HOSTADDR) != 0) goto done; /* note: lookup_host needs null terminated string */ strncpy(keystr, key.keydat_val, key.keydat_len); @@ -517,29 +496,25 @@ ypdb_get_record(domain, map, key, ypprivate) done: ypdb_close_db(db); return(res); - } ypresp_key_val -ypdb_get_first(domain, map, ypprivate) - domainname domain; - mapname map; - int ypprivate; +ypdb_get_first(domainname domain, mapname map, int ypprivate) { static ypresp_key_val res; DBM *db; datum k, v; bzero((char *)&res, sizeof(res)); - + db = ypdb_open_db(domain, map, &res.stat, NULL); if (res.stat >= 0) { k = ypdb_firstkey(db); - + while (yp_private(k, ypprivate)) k = ypdb_nextkey(db); - + if (k.dptr == NULL) { res.stat = YP_NOKEY; } else { @@ -559,11 +534,7 @@ ypdb_get_first(domain, map, ypprivate) } ypresp_key_val -ypdb_get_next(domain, map, key, ypprivate) - domainname domain; - mapname map; - keydat key; - int ypprivate; +ypdb_get_next(domainname domain, mapname map, keydat key, int ypprivate) { static ypresp_key_val res; DBM *db; @@ -571,7 +542,7 @@ ypdb_get_next(domain, map, key, ypprivate) bzero((char *)&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); - + if (res.stat >= 0) { n.dptr = key.keydat_val; n.dsize = key.keydat_len; @@ -611,9 +582,7 @@ ypdb_get_next(domain, map, key, ypprivate) } ypresp_order -ypdb_get_order(domain, map) - domainname domain; - mapname map; +ypdb_get_order(domainname domain, mapname map) { static ypresp_order res; static char *order_key = YP_LAST_KEY; @@ -623,7 +592,7 @@ ypdb_get_order(domain, map) bzero((char *)&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); - + if (res.stat >= 0) { k.dptr = order_key; k.dsize = YP_LAST_LEN; @@ -642,9 +611,7 @@ ypdb_get_order(domain, map) } ypresp_master -ypdb_get_master(domain, map) - domainname domain; - mapname map; +ypdb_get_master(domainname domain, mapname map) { static ypresp_master res; static char *master_key = YP_MASTER_KEY; @@ -654,7 +621,7 @@ ypdb_get_master(domain, map) bzero((char *)&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); - + if (res.stat >= 0) { k.dptr = master_key; k.dsize = YP_MASTER_LEN; @@ -673,33 +640,31 @@ ypdb_get_master(domain, map) } bool_t -ypdb_xdr_get_all(xdrs, req) - XDR *xdrs; - ypreq_nokey *req; +ypdb_xdr_get_all(XDR *xdrs, ypreq_nokey *req) { static ypresp_all resp; DBM *db; datum k, v; bzero((char *)&resp, sizeof(resp)); - + /* * open db, and advance past any private keys we may see */ - db = ypdb_open_db(req->domain, req->map, + db = ypdb_open_db(req->domain, req->map, &resp.ypresp_all_u.val.stat, NULL); - if (!db || resp.ypresp_all_u.val.stat < 0) + if (!db || resp.ypresp_all_u.val.stat < 0) return(FALSE); k = ypdb_firstkey(db); while (yp_private(k, FALSE)) k = ypdb_nextkey(db); - - while(1) { - if (k.dptr == NULL) + + while (1) { + if (k.dptr == NULL) break; v = ypdb_fetch(db, k); - if (v.dptr == NULL) + if (v.dptr == NULL) break; resp.more = TRUE; @@ -708,24 +673,24 @@ ypdb_xdr_get_all(xdrs, req) resp.ypresp_all_u.val.key.keydat_len = k.dsize; resp.ypresp_all_u.val.val.valdat_val = v.dptr; resp.ypresp_all_u.val.val.valdat_len = v.dsize; - + if (!xdr_ypresp_all(xdrs, &resp)) { #ifdef DEBUG yplog(" ypdb_xdr_get_all: xdr_ypresp_all failed"); -#endif +#endif return(FALSE); } - + /* advance past private keys */ k = ypdb_nextkey(db); while (yp_private(k, FALSE)) k = ypdb_nextkey(db); } - + bzero((char *)&resp, sizeof(resp)); resp.ypresp_all_u.val.stat = YP_NOKEY; resp.more = FALSE; - + if (!xdr_ypresp_all(xdrs, &resp)) { #ifdef DEBUG yplog(" ypdb_xdr_get_all: final xdr_ypresp_all failed"); @@ -737,9 +702,7 @@ ypdb_xdr_get_all(xdrs, req) } int -ypdb_secure(domain, map) - domainname domain; - mapname map; +ypdb_secure(domainname domain, mapname map) { static ypresp_val res; DBM *db; @@ -750,7 +713,7 @@ ypdb_secure(domain, map) secure = FALSE; db = ypdb_open_db(domain, map, &res.stat, &map_info); - if (!db || res.stat < 0) + if (!db || res.stat < 0) return(secure); /* ? */ if (map_info) secure = map_info->secure; @@ -758,4 +721,3 @@ ypdb_secure(domain, map) ypdb_close_db(db); return(secure); } - diff --git a/usr.sbin/ypserv/ypserv/ypserv_proc.c b/usr.sbin/ypserv/ypserv/ypserv_proc.c index 56e7a0b7458..efc4d9a7c85 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.17 2001/11/19 09:03:07 deraadt Exp $ */ +/* $OpenBSD: ypserv_proc.c,v 1.18 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.17 2001/11/19 09:03:07 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.18 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -45,6 +45,7 @@ static char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.17 2001/11/19 09:03:07 deraad #include #include #include "ypdb.h" +#include "acl.h" #include #include #include @@ -74,9 +75,7 @@ static char *False = "FALSE"; #define TORF(N) ((N) ? True : False) void * -ypproc_null_2_svc(argp, rqstp) - void *argp; - struct svc_req *rqstp; +ypproc_null_2_svc(void *argp, struct svc_req *rqstp) { static char *result; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -95,9 +94,7 @@ ypproc_null_2_svc(argp, rqstp) } bool_t * -ypproc_domain_2_svc(argp, rqstp) - domainname *argp; - struct svc_req *rqstp; +ypproc_domain_2_svc(domainname *argp, struct svc_req *rqstp) { struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); int ok = acl_check_host(&caller->sin_addr); @@ -124,9 +121,7 @@ bail: } bool_t * -ypproc_domain_nonack_2_svc(argp, rqstp) - domainname *argp; - struct svc_req *rqstp; +ypproc_domain_nonack_2_svc(domainname *argp, struct svc_req *rqstp) { static bool_t result; /* is domain served? */ struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -156,9 +151,7 @@ bail: } ypresp_val * -ypproc_match_2_svc(argp, rqstp) - ypreq_key *argp; - struct svc_req *rqstp; +ypproc_match_2_svc(ypreq_key *argp, struct svc_req *rqstp) { struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); int ok = acl_check_host(&caller->sin_addr); @@ -191,9 +184,7 @@ bail: } ypresp_key_val * -ypproc_first_2_svc(argp, rqstp) - ypreq_nokey *argp; - struct svc_req *rqstp; +ypproc_first_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) { struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); int ok = acl_check_host(&caller->sin_addr); @@ -224,9 +215,7 @@ bail: } ypresp_key_val * -ypproc_next_2_svc(argp, rqstp) - ypreq_key *argp; - struct svc_req *rqstp; +ypproc_next_2_svc(ypreq_key *argp, struct svc_req *rqstp) { static ypresp_key_val res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -259,9 +248,7 @@ bail: } ypresp_xfr * -ypproc_xfr_2_svc(argp, rqstp) - ypreq_xfr *argp; - struct svc_req *rqstp; +ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp) { static ypresp_xfr res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -307,9 +294,7 @@ ypproc_xfr_2_svc(argp, rqstp) } void * -ypproc_clear_2_svc(argp, rqstp) - void *argp; - struct svc_req *rqstp; +ypproc_clear_2_svc(void *argp, struct svc_req *rqstp) { static char *res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -341,9 +326,7 @@ ypproc_clear_2_svc(argp, rqstp) } ypresp_all * -ypproc_all_2_svc(argp, rqstp) - ypreq_nokey *argp; - struct svc_req *rqstp; +ypproc_all_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) { static ypresp_all res; pid_t pid; @@ -385,9 +368,7 @@ bail: } ypresp_master * -ypproc_master_2_svc(argp, rqstp) - ypreq_nokey *argp; - struct svc_req *rqstp; +ypproc_master_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) { static ypresp_master res; static peername nopeer = ""; @@ -434,9 +415,7 @@ bail: ypresp_order * -ypproc_order_2_svc(argp, rqstp) - ypreq_nokey *argp; - struct svc_req *rqstp; +ypproc_order_2_svc(ypreq_nokey *argp, struct svc_req *rqstp) { static ypresp_order res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -471,9 +450,7 @@ bail: ypresp_maplist * -ypproc_maplist_2_svc(argp, rqstp) - domainname *argp; - struct svc_req *rqstp; +ypproc_maplist_2_svc(domainname *argp, struct svc_req *rqstp) { static ypresp_maplist res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -515,7 +492,7 @@ bail: } if (status >= 0) { - for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { + for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { if ((!strcmp(dp->d_name, ".")) || ((!strcmp(dp->d_name, ".."))) || (dp->d_namlen < 4)) @@ -553,9 +530,7 @@ bail: } void * -ypproc_null_1_svc(argp, rqstp) - void *argp; - struct svc_req *rqstp; +ypproc_null_1_svc(void *argp, struct svc_req *rqstp) { static char *result; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -575,9 +550,7 @@ ypproc_null_1_svc(argp, rqstp) } bool_t * -ypproc_domain_1_svc(argp, rqstp) - domainname *argp; - struct svc_req *rqstp; +ypproc_domain_1_svc(domainname *argp, struct svc_req *rqstp) { static bool_t result; /* is domain_served? */ struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -605,9 +578,7 @@ bail: } bool_t * -ypproc_domain_nonack_1_svc(argp, rqstp) - domainname *argp; - struct svc_req *rqstp; +ypproc_domain_nonack_1_svc(domainname *argp, struct svc_req *rqstp) { static bool_t result; /* is domain served? */ struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -640,9 +611,7 @@ bail: } ypresponse * -ypproc_match_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_match_1_svc(yprequest *argp, struct svc_req *rqstp) { static ypresponse res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -693,9 +662,7 @@ bail: } ypresponse * -ypproc_first_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_first_1_svc(yprequest *argp, struct svc_req *rqstp) { static ypresponse res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -743,9 +710,7 @@ bail: } ypresponse * -ypproc_next_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_next_1_svc(yprequest *argp, struct svc_req *rqstp) { static ypresponse res; struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); @@ -796,9 +761,7 @@ bail: } ypresponse * -ypproc_poll_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_poll_1_svc(yprequest *argp, struct svc_req *rqstp) { static ypresponse res; ypresp_order order; @@ -849,9 +812,7 @@ bail: } void * -ypproc_push_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_push_1_svc(yprequest *argp, struct svc_req *rqstp) { struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); int ok = acl_check_host(&caller->sin_addr); @@ -896,9 +857,7 @@ bail: } void * -ypproc_pull_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_pull_1_svc(yprequest *argp, struct svc_req *rqstp) { struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); int ok = acl_check_host(&caller->sin_addr); @@ -943,9 +902,7 @@ bail: } void * -ypproc_get_1_svc(argp, rqstp) - yprequest *argp; - struct svc_req *rqstp; +ypproc_get_1_svc(yprequest *argp, struct svc_req *rqstp) { struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt); int ok = acl_check_host(&caller->sin_addr); diff --git a/usr.sbin/ypserv/ypserv/ypv1.h b/usr.sbin/ypserv/ypserv/ypv1.h index 1f2d08b9883..898e87146f5 100644 --- a/usr.sbin/ypserv/ypserv/ypv1.h +++ b/usr.sbin/ypserv/ypserv/ypv1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ypv1.h,v 1.2 1997/07/25 20:12:31 mickey Exp $ */ +/* $OpenBSD: ypv1.h,v 1.3 2002/07/19 02:38:40 deraadt Exp $ */ /* * Please do not edit this file. @@ -18,13 +18,13 @@ enum ypreqtype { YPREQ_MAP_PARMS = 3 }; typedef enum ypreqtype ypreqtype; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreqtype(XDR *, ypreqtype*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypreqtype(XDR *, ypreqtype *); #elif defined(__STDC__) -extern bool_t xdr_ypreqtype(XDR *, ypreqtype*); -#else /* Old Style C */ +extern bool_t xdr_ypreqtype(XDR *, ypreqtype *); +#else /* Old Style C */ bool_t xdr_ypreqtype(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef struct { ypreqtype yp_reqtype; @@ -34,13 +34,13 @@ typedef struct { struct ypmap_parms yp_req_map_parmstype; }yp_reqbody; } yprequest; -#ifdef __cplusplus -extern "C" bool_t xdr_yprequest(XDR *, yprequest*); +#ifdef __cplusplus +extern "C" bool_t xdr_yprequest(XDR *, yprequest *); #elif defined(__STDC__) -extern bool_t xdr_yprequest(XDR *, yprequest*); -#else /* Old Style C */ +extern bool_t xdr_yprequest(XDR *, yprequest *); +#else /* Old Style C */ bool_t xdr_yprequest(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPMATCH_REQTYPE YPREQ_KEY #define ypmatch_req_domain yp_reqbody.yp_req_keytype.domain @@ -84,13 +84,13 @@ enum ypresptype { YPRESP_MAP_PARMS = 3 }; typedef enum ypresptype ypresptype; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresptype(XDR *, ypresptype*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresptype(XDR *, ypresptype *); #elif defined(__STDC__) -extern bool_t xdr_ypresptype(XDR *, ypresptype*); -#else /* Old Style C */ +extern bool_t xdr_ypresptype(XDR *, ypresptype *); +#else /* Old Style C */ bool_t xdr_ypresptype(); -#endif /* Old Style C */ +#endif /* Old Style C */ typedef struct { ypresptype yp_resptype; @@ -100,13 +100,13 @@ typedef struct { struct ypmap_parms yp_resp_map_parmstype; } yp_respbody; } ypresponse; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresponse(XDR *, ypresponse*); +#ifdef __cplusplus +extern "C" bool_t xdr_ypresponse(XDR *, ypresponse *); #elif defined(__STDC__) -extern bool_t xdr_ypresponse(XDR *, ypresponse*); -#else /* Old Style C */ +extern bool_t xdr_ypresponse(XDR *, ypresponse *); +#else /* Old Style C */ bool_t xdr_ypresponse(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPMATCH_RESPTYPE YPRESP_VAL #define ypmatch_resp_status yp_respbody.yp_resp_valtype.stat @@ -205,7 +205,7 @@ extern void * ypproc_pull_1_svc(yprequest *, struct svc_req *); extern void * ypproc_get_1(yprequest *, CLIENT *); extern void * ypproc_get_1_svc(yprequest *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPOLDPROC_NULL ((u_long)0) extern void * ypproc_null_1(); extern void * ypproc_null_1_svc(); @@ -236,6 +236,6 @@ extern void * ypproc_pull_1_svc(); #define YPOLDPROC_GET ((u_long)9) extern void * ypproc_get_1(); extern void * ypproc_get_1_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ #endif /* !_YPV1_H_RPCGEN */ diff --git a/usr.sbin/ypserv/yptest/yptest.c b/usr.sbin/ypserv/yptest/yptest.c index e2e865cab5f..35708db7e3a 100644 --- a/usr.sbin/ypserv/yptest/yptest.c +++ b/usr.sbin/ypserv/yptest/yptest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yptest.c,v 1.10 2002/02/13 23:10:46 deraadt Exp $ */ +/* $OpenBSD: yptest.c,v 1.11 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: yptest.c,v 1.10 2002/02/13 23:10:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: yptest.c,v 1.11 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -44,12 +44,12 @@ static char rcsid[] = "$OpenBSD: yptest.c,v 1.10 2002/02/13 23:10:46 deraadt Exp #include static int -yptest_foreach(status, key, keylen, val, vallen, data) -int status, keylen, vallen; -char *key, *val, *data; +yptest_foreach(u_long status, char *key, int keylen, char *val, int vallen, + void *data) { if (status == 2) return(0); + /* key avslutas med NUL */ /* val avslutas med NUL */ key[keylen] = '\0'; @@ -59,29 +59,21 @@ char *key, *val, *data; } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { - char *Domain; - char *Map = "passwd.byname"; - char *Key = "root"; - int KeyLen; - char *Value; - char *Key2; - int ValLen; - int Status; - int Order; + char *Domain, *Value, *Key2; + char *Map = "passwd.byname", *Key = "root"; + int ValLen, Status, Order, KeyLen; struct ypall_callback Callback; struct ypmaplist *ypml, *y; Status = yp_get_default_domain(&Domain); -printf("Status %d\n", Status); -printf("dom %s\n", Domain); -printf("dom %d\n", Domain[0]); + printf("Status %d\n", Status); + printf("dom %s\n", Domain); + printf("dom %d\n", Domain[0]); if (Status) printf("yp error: %s\n", yperr_string(Status)); - + printf("Test 1: yp_match\n"); KeyLen = strlen(Key); Status = yp_match(Domain, Map, Key, KeyLen, &Value, &ValLen); @@ -89,7 +81,7 @@ printf("dom %d\n", Domain[0]); printf("yp error: %s\n", yperr_string(Status)); else printf("%*.*s\n", ValLen, ValLen, Value); - + printf("\nTest 2: yp_first\n"); Status = yp_first(Domain, Map, &Key2, &KeyLen, &Value, &ValLen); if (Status) @@ -124,9 +116,9 @@ printf("dom %d\n", Domain[0]); printf("\nTest 6: yp_maplist\n"); ypml = NULL; - switch(yp_maplist(Domain, &ypml)) { + switch (yp_maplist(Domain, &ypml)) { case 0: - for(y = ypml; y; ) { + for (y = ypml; y; ) { ypml = y; printf("%s\n", ypml->map); y = ypml->next; diff --git a/usr.sbin/ypserv/ypxfr/ypxfr.c b/usr.sbin/ypserv/ypxfr/ypxfr.c index d19577c1e7b..e1a978fa5d1 100644 --- a/usr.sbin/ypserv/ypxfr/ypxfr.c +++ b/usr.sbin/ypserv/ypxfr/ypxfr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypxfr.c,v 1.27 2002/03/26 09:35:22 fgsch Exp $ */ +/* $OpenBSD: ypxfr.c,v 1.28 2002/07/19 02:38:40 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson @@ -32,7 +32,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.27 2002/03/26 09:35:22 fgsch Exp $"; +static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.28 2002/07/19 02:38:40 deraadt Exp $"; #endif #include @@ -68,11 +68,10 @@ extern int (*ypresp_allfn)(); extern void *ypresp_data; static int -ypxfr_foreach(status, keystr, keylen, valstr, vallen, data) -int status, keylen, vallen; -char *keystr, *valstr, *data; +ypxfr_foreach(u_long status, char *keystr, int keylen, char *valstr, int vallen, + void *data) { - datum key, val; + datum key, val; if (status == YP_NOMORE) return(0); @@ -87,23 +86,18 @@ char *keystr, *valstr, *data; val.dsize = strlen(valstr); ypdb_store(db, key, val, YPDB_INSERT); - return 0; } int -get_local_ordernum(domain, map, lordernum) -char *domain; -char *map; -u_int32_t *lordernum; +get_local_ordernum(char *domain, char *map, u_int32_t *lordernum) { - char map_path[MAXPATHLEN]; + char map_path[MAXPATHLEN], order[MAX_LAST_LEN+1]; char order_key[] = YP_LAST_KEY; - char order[MAX_LAST_LEN+1]; struct stat finfo; - DBM *db; datum k, v; int status; + DBM *db; /* This routine returns YPPUSH_SUCC or YPPUSH_NODOM */ @@ -115,53 +109,49 @@ u_int32_t *lordernum; fprintf(stderr, "%s: domain %s not found locally\n", __progname, domain); status = YPPUSH_NODOM; + goto bail; } - if (status > 0) { - snprintf(map_path, sizeof map_path, "%s/%s/%s%s", - YP_DB_PATH, domain, map, YPDB_SUFFIX); - if (!(stat(map_path, &finfo) == 0)) - status = YPPUSH_NOMAP; + snprintf(map_path, sizeof map_path, "%s/%s/%s%s", + YP_DB_PATH, domain, map, YPDB_SUFFIX); + if (!(stat(map_path, &finfo) == 0)) { + status = YPPUSH_NOMAP; + goto bail; } - if (status > 0) { - snprintf(map_path, sizeof map_path, "%s/%s/%s", - YP_DB_PATH, domain, map); - db = ypdb_open(map_path, O_RDONLY, 0444); - if (db == NULL) - status = YPPUSH_DBM; + snprintf(map_path, sizeof map_path, "%s/%s/%s", + YP_DB_PATH, domain, map); + db = ypdb_open(map_path, O_RDONLY, 0444); + if (db == NULL) { + status = YPPUSH_DBM; + goto bail; } - if (status > 0) { - k.dptr = (char *)&order_key; - k.dsize = YP_LAST_LEN; + k.dptr = (char *)&order_key; + k.dsize = YP_LAST_LEN; - v = ypdb_fetch(db,k); - ypdb_close(db); + v = ypdb_fetch(db,k); + ypdb_close(db); - if (v.dptr == NULL) { - *lordernum = 0; - } else { - strlcpy(order, v.dptr, sizeof order); - *lordernum = (u_int32_t)atol(order); - } + if (v.dptr == NULL) { + *lordernum = 0; + } else { + strlcpy(order, v.dptr, sizeof order); + *lordernum = (u_int32_t)atol(order); } +bail: if (status == YPPUSH_NOMAP || status == YPPUSH_DBM) { *lordernum = 0; status = YPPUSH_SUCC; } - return(status); + return (status); } int -get_remote_ordernum(client, domain, map, lordernum, rordernum) -CLIENT *client; -char *domain; -char *map; -u_int32_t lordernum; -u_int32_t *rordernum; +get_remote_ordernum(CLIENT *client, char *domain, char *map, + u_int32_t lordernum, u_int32_t *rordernum) { int status; @@ -177,11 +167,8 @@ u_int32_t *rordernum; } int -get_map(client,domain,map,incallback) -CLIENT *client; -char *domain; -char *map; -struct ypall_callback *incallback; +get_map(CLIENT *client, char *domain, char *map, + struct ypall_callback *incallback) { int status; @@ -191,38 +178,28 @@ struct ypall_callback *incallback; } else { status = YPPUSH_YPERR; } - - return(status); + return (status); } DBM * -create_db(domain,map,temp_map) -char *domain; -char *map; -char *temp_map; +create_db(char *domain, char *map, char *temp_map) { return ypdb_open_suf(temp_map, O_RDWR, 0444); } int -install_db(domain,map,temp_map) -char *domain; -char *map; -char *temp_map; +install_db(char *domain, char *map, char *temp_map) { char db_name[MAXPATHLEN]; snprintf(db_name, sizeof db_name, "%s/%s/%s%s", YP_DB_PATH, domain, map, YPDB_SUFFIX); rename(temp_map, db_name); - return YPPUSH_SUCC; } int -add_order(db, ordernum) -DBM *db; -u_int32_t ordernum; +add_order(DBM *db, u_int32_t ordernum) { char datestr[11]; datum key, val; @@ -238,20 +215,15 @@ u_int32_t ordernum; val.dsize = strlen(datestr); status = ypdb_store(db, key, val, YPDB_INSERT); - if (status >= 0) { + if (status >= 0) status = YPPUSH_SUCC; - } else { + else status = YPPUSH_DBM; - } - return(status); + return (status); } int -add_master(client, domain, map, db) -CLIENT *client; -char *domain; -char *map; -DBM *db; +add_master(CLIENT *client, char *domain, char *map, DBM *db) { char keystr[] = YP_MASTER_KEY; char *master; @@ -272,21 +244,16 @@ DBM *db; val.dsize = strlen(master); status = ypdb_store(db, key, val, YPDB_INSERT); - if (status >= 0) { + if (status >= 0) status = YPPUSH_SUCC; - } else { + else status = YPPUSH_DBM; - } } - return status; + return (status); } int -add_interdomain(client, domain, map, db) -CLIENT *client; -char *domain; -char *map; -DBM *db; +add_interdomain(CLIENT *client, char *domain, char *map, DBM *db) { char keystr[] = YP_INTERDOMAIN_KEY; char *value; @@ -307,11 +274,10 @@ DBM *db; if (v.dptr != NULL) { status = ypdb_store(db, k, v, YPDB_INSERT); - if (status >= 0) { + if (status >= 0) status = YPPUSH_SUCC; - } else { + else status = YPPUSH_DBM; - } } } @@ -319,16 +285,10 @@ DBM *db; } int -add_secure(client, domain, map, db) -CLIENT *client; -char *domain; -char *map; -DBM *db; +add_secure(CLIENT *client, char *domain, char *map, DBM *db) { - char keystr[] = YP_SECURE_KEY; - char *value; - int vallen; - int status; + char keystr[] = YP_SECURE_KEY, *value; + int vallen, status; datum k, v; /* Get SECURE */ @@ -357,12 +317,10 @@ DBM *db; } int -send_clear(client) -CLIENT *client; +send_clear(CLIENT *client) { struct timeval tv; - int r; - int status; + int status, r; status = YPPUSH_SUCC; @@ -378,10 +336,7 @@ CLIENT *client; } int -send_reply(client,status,tid) -CLIENT *client; -u_long status; -u_long tid; +send_reply(CLIENT *client, u_long status, u_long tid) { struct timeval tv; struct ypresp_xfr resp; @@ -402,29 +357,17 @@ u_long tid; } int -main (argc,argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { - int usage = 0; - int cflag = 0; - int fflag = 0; - int Cflag = 0; - int ch; - extern char *optarg; - char *domain; - char *host = NULL; - char *srcdomain = NULL; - char *tid = NULL; - char *prog = NULL; - char *ipadd = NULL; - char *port = NULL; - char *map = NULL; + int usage = 0, cflag = 0, fflag = 0, Cflag = 0; + char *domain, *host = NULL, *srcdomain = NULL; + char *tid = NULL, *prog = NULL, *ipadd = NULL; + char *port = NULL, *map = NULL; + int status, xfr_status, ch, srvport; u_int32_t ordernum, new_ordernum; struct ypall_callback callback; CLIENT *client; - int status, xfr_status; - int srvport; + extern char *optarg; status = YPPUSH_SUCC; client = NULL; @@ -507,12 +450,12 @@ char *argv[]; } if (status > 0) { - yplog("Get Master"); + yplog("Get Master"); if (host == NULL) { if (srcdomain == NULL) { status = yp_master(domain, map, &host); - } else { + } else { status = yp_master(srcdomain, map, &host); } if (status == 0) { @@ -525,7 +468,7 @@ char *argv[]; /* XXX this is raceable if portmap has holes! */ if (status > 0) { - yplog("Check for reserved port on host: %s", host); + yplog("Check for reserved port on host: %s", host); srvport = getrpcport(host, YPPROG, YPVERS, IPPROTO_TCP); if (srvport >= IPPORT_RESERVED) @@ -533,7 +476,7 @@ char *argv[]; } if (status > 0) { - yplog("Connect host: %s", host); + yplog("Connect host: %s", host); client = yp_bind_host(host, YPPROG, YPVERS, 0, 1); @@ -560,7 +503,7 @@ char *argv[]; status = YPPUSH_DBM; } - /* Add ORDER */ + /* Add ORDER */ if (status > 0) status = add_order(db, new_ordernum); @@ -568,11 +511,11 @@ char *argv[]; if (status > 0) status = add_master(client, domain, map, db); - /* Add INTERDOMAIN */ + /* Add INTERDOMAIN */ if (status > 0) status = add_interdomain(client, domain, map, db); - /* Add SECURE */ + /* Add SECURE */ if (status > 0) status = add_secure(client, domain, map, db); @@ -614,7 +557,6 @@ char *argv[]; clnt_destroy(client); } - return(0); + return (0); } - diff --git a/usr.sbin/ypserv/ypxfr/ypxfr_1perday.sh b/usr.sbin/ypserv/ypxfr/ypxfr_1perday.sh index 578c268557b..f1fc4ef51bb 100644 --- a/usr.sbin/ypserv/ypxfr/ypxfr_1perday.sh +++ b/usr.sbin/ypserv/ypxfr/ypxfr_1perday.sh @@ -1,11 +1,11 @@ #!/bin/sh -# $OpenBSD: ypxfr_1perday.sh,v 1.1 1997/04/20 10:08:36 maja Exp $ +# $OpenBSD: ypxfr_1perday.sh,v 1.2 2002/07/19 02:38:40 deraadt Exp $ # # ypxfr_1perday.sh - YP maps to be updated daily # /usr/sbin/ypxfr group.byname -/usr/sbin/ypxfr group.bygid +/usr/sbin/ypxfr group.bygid /usr/sbin/ypxfr protocols.byname /usr/sbin/ypxfr protocols.bynumber /usr/sbin/ypxfr networks.byname diff --git a/usr.sbin/ypserv/ypxfr/ypxfr_1perhour.sh b/usr.sbin/ypserv/ypxfr/ypxfr_1perhour.sh index 82f43a22a5e..7a94b7e7e97 100644 --- a/usr.sbin/ypserv/ypxfr/ypxfr_1perhour.sh +++ b/usr.sbin/ypserv/ypxfr/ypxfr_1perhour.sh @@ -1,11 +1,11 @@ #!/bin/sh -# $OpenBSD: ypxfr_1perhour.sh,v 1.1 1997/04/20 10:08:37 maja Exp $ +# $OpenBSD: ypxfr_1perhour.sh,v 1.2 2002/07/19 02:38:40 deraadt Exp $ # # ypxfr_1perhour.sh - YP maps to be updated every hour # /usr/sbin/ypxfr passwd.byname -/usr/sbin/ypxfr passwd.byuid +/usr/sbin/ypxfr passwd.byuid /usr/sbin/ypxfr master.passwd.byname -/usr/sbin/ypxfr master.passwd.byuid +/usr/sbin/ypxfr master.passwd.byuid /usr/sbin/ypxfr netid.byname -- cgit v1.2.3