diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ypserv/common/yplib_host.c | 24 | ||||
-rw-r--r-- | usr.sbin/ypserv/makedbm/db.c | 6 | ||||
-rw-r--r-- | usr.sbin/ypserv/makedbm/makedbm.c | 19 | ||||
-rw-r--r-- | usr.sbin/ypserv/mkalias/mkalias.c | 8 | ||||
-rw-r--r-- | usr.sbin/ypserv/mknetid/mknetid.c | 19 | ||||
-rw-r--r-- | usr.sbin/ypserv/revnetgroup/hash.c | 14 | ||||
-rw-r--r-- | usr.sbin/ypserv/revnetgroup/parse_netgroup.c | 53 | ||||
-rw-r--r-- | usr.sbin/ypserv/revnetgroup/revnetgroup.c | 6 | ||||
-rw-r--r-- | usr.sbin/ypserv/stdethers/stdethers.c | 6 | ||||
-rw-r--r-- | usr.sbin/ypserv/stdhosts/stdhosts.c | 8 | ||||
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush.c | 8 | ||||
-rw-r--r-- | usr.sbin/ypserv/yppush/yppush_svc.c | 10 | ||||
-rw-r--r-- | usr.sbin/ypserv/ypserv/acl.c | 25 | ||||
-rw-r--r-- | usr.sbin/ypserv/ypserv/ypserv.c | 32 | ||||
-rw-r--r-- | usr.sbin/ypserv/ypserv/ypserv_db.c | 30 | ||||
-rw-r--r-- | usr.sbin/ypserv/ypserv/ypserv_proc.c | 27 | ||||
-rw-r--r-- | usr.sbin/ypserv/yptest/yptest.c | 6 | ||||
-rw-r--r-- | usr.sbin/ypserv/ypxfr/ypxfr.c | 6 |
18 files changed, 151 insertions, 156 deletions
diff --git a/usr.sbin/ypserv/common/yplib_host.c b/usr.sbin/ypserv/common/yplib_host.c index 601132b7479..d984265de1a 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.14 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: yplib_host.c,v 1.15 2006/04/03 05:01:20 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: yplib_host.c,v 1.14 2003/07/15 06:10:46 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: yplib_host.c,v 1.15 2006/04/03 05:01:20 deraadt Exp $"; #endif #include <sys/param.h> @@ -157,9 +157,9 @@ yp_match_host(CLIENT *client, char *indomain, char *inmap, const char *inkey, xdr_ypreq_key, &yprk, xdr_ypresp_val, &yprv, tv); if (r != RPC_SUCCESS) clnt_perror(client, "yp_match_host: clnt_call"); - if ( !(r=ypprot_err(yprv.stat)) ) { + if ( !(r = ypprot_err(yprv.stat)) ) { *outvallen = yprv.val.valdat_len; - *outval = (char *)malloc(*outvallen+1); + *outval = malloc(*outvallen+1); memcpy(*outval, yprv.val.valdat_val, *outvallen); (*outval)[*outvallen] = '\0'; } @@ -190,13 +190,13 @@ yp_first_host(CLIENT *client, char *indomain, char *inmap, char **outkey, xdr_ypreq_nokey, &yprnk, xdr_ypresp_key_val, &yprkv, tv); if (r != RPC_SUCCESS) clnt_perror(client, "yp_first_host: clnt_call"); - if ( !(r=ypprot_err(yprkv.stat)) ) { + if ( !(r = ypprot_err(yprkv.stat)) ) { *outkeylen = yprkv.key.keydat_len; - *outkey = (char *)malloc(*outkeylen+1); + *outkey = malloc(*outkeylen+1); memcpy(*outkey, yprkv.key.keydat_val, *outkeylen); (*outkey)[*outkeylen] = '\0'; *outvallen = yprkv.val.valdat_len; - *outval = (char *)malloc(*outvallen+1); + *outval = malloc(*outvallen+1); memcpy(*outval, yprkv.val.valdat_val, *outvallen); (*outval)[*outvallen] = '\0'; } @@ -229,13 +229,13 @@ yp_next_host(CLIENT *client, char *indomain, char *inmap, char *inkey, xdr_ypreq_key, &yprk, xdr_ypresp_key_val, &yprkv, tv); if (r != RPC_SUCCESS) clnt_perror(client, "yp_next_host: clnt_call"); - if ( !(r=ypprot_err(yprkv.stat)) ) { + if ( !(r = ypprot_err(yprkv.stat)) ) { *outkeylen = yprkv.key.keydat_len; - *outkey = (char *)malloc(*outkeylen+1); + *outkey = malloc(*outkeylen+1); memcpy(*outkey, yprkv.key.keydat_val, *outkeylen); (*outkey)[*outkeylen] = '\0'; *outvallen = yprkv.val.valdat_len; - *outval = (char *)malloc(*outvallen+1); + *outval = malloc(*outvallen+1); memcpy(*outval, yprkv.val.valdat_val, *outvallen); (*outval)[*outvallen] = '\0'; } @@ -311,7 +311,7 @@ yp_master_host(CLIENT *client, char *indomain, char *inmap, char **outname) if (r != RPC_SUCCESS) clnt_perror(client, "yp_master: clnt_call"); if (!(r = ypprot_err(yprm.stat))) - *outname = (char *)strdup(yprm.peer); + *outname = strdup(yprm.peer); xdr_free(xdr_ypresp_master, (char *)&yprm); return r; } diff --git a/usr.sbin/ypserv/makedbm/db.c b/usr.sbin/ypserv/makedbm/db.c index 04aac653b67..a9f08d48c81 100644 --- a/usr.sbin/ypserv/makedbm/db.c +++ b/usr.sbin/ypserv/makedbm/db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db.c,v 1.6 2003/06/02 21:58:26 maja Exp $ */ +/* $OpenBSD: db.c,v 1.7 2006/04/03 05:01:22 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: db.c,v 1.6 2003/06/02 21:58:26 maja Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: db.c,v 1.7 2006/04/03 05:01:22 deraadt Exp $"; #endif #include <sys/types.h> diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c index 9273cd24e9d..2a80f283d46 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.c +++ b/usr.sbin/ypserv/makedbm/makedbm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makedbm.c,v 1.25 2005/12/21 01:40:24 millert Exp $ */ +/* $OpenBSD: makedbm.c,v 1.26 2006/04/03 05:01:22 deraadt Exp $ */ /* * Copyright (c) 1994-97 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: makedbm.c,v 1.25 2005/12/21 01:40:24 millert Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: makedbm.c,v 1.26 2006/04/03 05:01:22 deraadt Exp $"; #endif #include <stdio.h> @@ -90,7 +90,7 @@ add_record(DBM *db, char *str1, char *str2, int check) key.dsize = strlen(str1); if (check) { - val = ypdb_fetch(db,key); + val = ypdb_fetch(db, key); if (val.dptr != NULL) return; /* already there */ @@ -101,7 +101,8 @@ add_record(DBM *db, char *str1, char *str2, int check) status = ypdb_store(db, key, val, YPDB_INSERT); if (status != 0) { - printf("%s: problem storing %s %s\n",__progname,str1,str2); + printf("%s: problem storing %s %s\n", + __progname, str1, str2); exit(1); } } @@ -147,7 +148,7 @@ list_database(char *database, int Uflag) key = ypdb_firstkey(db); while (key.dptr != NULL) { - val = ypdb_fetch(db,key); + val = ypdb_fetch(db, key); printf("%*.*s %*.*s\n", key.dsize, key.dsize, key.dptr, val.dsize, val.dsize, val.dptr); @@ -176,7 +177,7 @@ create_database(char *infile, char *database, char *yp_input_file, } else { data_file = fopen(infile, "r"); if (errno != 0) { - (void)fprintf(stderr,"%s: ",__progname); + (void)fprintf(stderr,"%s: ", __progname); perror(infile); exit(1); } @@ -217,7 +218,7 @@ create_database(char *infile, char *database, char *yp_input_file, exit(1); } - while (read_line(data_file,data_line,sizeof(data_line))) { + while (read_line(data_file, data_line, sizeof(data_line))) { line_no++; len = strlen(data_line); @@ -235,7 +236,7 @@ create_database(char *infile, char *database, char *yp_input_file, k = p; /* save start of key */ while (!isspace(*p)) { /* find first "space" */ if (lflag && isupper(*p)) /* if force lower case */ - *p = tolower(*p); /* fix it */ + *p = (char)tolower(*p); /* fix it */ p++; } while (isspace(*p)) { /* replace space with <NUL> */ diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c index e2058c82ceb..93bc4882f6b 100644 --- a/usr.sbin/ypserv/mkalias/mkalias.c +++ b/usr.sbin/ypserv/mkalias/mkalias.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkalias.c,v 1.16 2003/07/18 22:58:56 david Exp $ */ +/* $OpenBSD: mkalias.c,v 1.17 2006/04/03 05:01:22 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: mkalias.c,v 1.16 2003/07/18 22:58:56 david Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: mkalias.c,v 1.17 2006/04/03 05:01:22 deraadt Exp $"; #endif #include <ctype.h> @@ -121,7 +121,7 @@ capitalize(char *name, int len) if (last == '.') { for (c = name; i < len; i++) { if (last == '.') - *c = toupper(*c); + *c = (char)toupper(*c); last = *c++; } } diff --git a/usr.sbin/ypserv/mknetid/mknetid.c b/usr.sbin/ypserv/mknetid/mknetid.c index b2d1e7e13be..f05c1df1913 100644 --- a/usr.sbin/ypserv/mknetid/mknetid.c +++ b/usr.sbin/ypserv/mknetid/mknetid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mknetid.c,v 1.13 2005/05/14 02:32:32 deraadt Exp $ */ +/* $OpenBSD: mknetid.c,v 1.14 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: mknetid.c,v 1.13 2005/05/14 02:32:32 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: mknetid.c,v 1.14 2006/04/03 05:01:23 deraadt Exp $"; #endif #include <sys/param.h> @@ -136,7 +136,7 @@ add_user(char *username, char *uid, char *gid) struct user *u; int idx; - u = (struct user *) malloc(sizeof(struct user)); + u = malloc(sizeof(struct user)); if (u == NULL) err(1, "malloc"); bzero(u, sizeof(struct user)); @@ -211,7 +211,7 @@ read_passwd(FILE *pfile, char *fname) line[len-1] = '\0'; } - p = (char *) &line; + p = (char *)&line; k = p; colon = 0; while (*k != '\0') { @@ -298,7 +298,7 @@ read_group(FILE *gfile, char *fname) line[len-1] = '\0'; } - p = (char *) &line; + p = (char *)&line; k = p; colon = 0; while (*k != '\0') { @@ -392,7 +392,7 @@ print_passwd_group(int qflag, char *domain) static void print_hosts(FILE *pfile, char *fname, char *domain) { - char line[1024], *p, *k, *u; + char line[1024], *p, *u; int line_no = 0, len; while (read_line(pfile, line, sizeof(line))) { @@ -414,9 +414,8 @@ print_hosts(FILE *pfile, char *fname, char *domain) line[len-1] = '\0'; } - p = (char *) &line; + p = (char *)&line; - k = p; /* save start of key */ while (!isspace(*p)) p++; /* find first "space" */ while (isspace(*p)) @@ -465,7 +464,7 @@ print_netid(FILE *mfile, char *fname) line[len-1] = '\0'; } - p = (char *) &line; + p = (char *)&line; k = p; /* save start of key */ while (!isspace(*p)) diff --git a/usr.sbin/ypserv/revnetgroup/hash.c b/usr.sbin/ypserv/revnetgroup/hash.c index d5c45b8d862..40582a2ba65 100644 --- a/usr.sbin/ypserv/revnetgroup/hash.c +++ b/usr.sbin/ypserv/revnetgroup/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.5 2006/03/18 23:17:36 deraadt Exp $ */ +/* $OpenBSD: hash.c,v 1.6 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -40,7 +40,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: hash.c,v 1.5 2006/03/18 23:17:36 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: hash.c,v 1.6 2006/04/03 05:01:23 deraadt Exp $"; #endif /* @@ -108,7 +108,7 @@ hashkey(char *key) if (key == NULL) return (-1); - return(hash((void *)key, strlen(key)) & HASH_MASK); + return(hash(key, strlen(key)) & HASH_MASK); } /* Find an entry in the hash table (may be hanging off a linked list). */ @@ -146,14 +146,14 @@ lookup(struct group_entry *table[], char *key) * That's a lot of comment for such a small piece of code, isn't it. */ void -store(struct group_entry *table[], char *key, char *data) +ngstore(struct group_entry *table[], char *key, char *data) { struct group_entry *new; u_int32_t i; i = hashkey(key); - new = (struct group_entry *)malloc(sizeof(struct group_entry)); + new = malloc(sizeof(struct group_entry)); new->key = strdup(key); new->data = strdup(data); new->next = table[i]; @@ -182,7 +182,7 @@ mstore(struct member_entry *table[], char *key, char *data, char *domain) i = hashkey(key); cur = table[i]; - tmp = (struct grouplist *)malloc(sizeof(struct grouplist)); + tmp = malloc(sizeof(struct grouplist)); tmp->groupname = strdup(data); tmp->next = NULL; @@ -206,7 +206,7 @@ mstore(struct member_entry *table[], char *key, char *data, char *domain) } /* Didn't find a match -- add the whole mess to the table. */ - new = (struct member_entry *)malloc(sizeof(struct member_entry)); + new = malloc(sizeof(struct member_entry)); new->key = strdup(key); new->domain = strdup(domain); new->groups = tmp; diff --git a/usr.sbin/ypserv/revnetgroup/parse_netgroup.c b/usr.sbin/ypserv/revnetgroup/parse_netgroup.c index 35676433abc..1e2d935c18c 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.9 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: parse_netgroup.c,v 1.10 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -47,7 +47,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: parse_netgroup.c,v 1.9 2003/07/15 06:10:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: parse_netgroup.c,v 1.10 2006/04/03 05:01:23 deraadt Exp $"; #endif /* @@ -73,14 +73,14 @@ struct netgrp { #define NG_USER 1 /* User name */ #define NG_DOM 2 /* and Domain name */ -static struct linelist *linehead = (struct linelist *)0; -static struct netgrp *nextgrp = (struct netgrp *)0; +static struct linelist *linehead = NULL; +static struct netgrp *nextgrp = NULL; static struct { struct netgrp *gr; char *grname; } grouphead = { - (struct netgrp *)0, - (char *)0, + NULL, + NULL, }; static int parse_netgrp(char *); @@ -103,17 +103,12 @@ __setnetgrent(char *group) if (group == NULL || !strlen(group)) return; - if (grouphead.gr == (struct netgrp *)0 || - strcmp(group, grouphead.grname)) { + if (grouphead.gr == NULL || strcmp(group, grouphead.grname)) { __endnetgrent(); if (parse_netgrp(group)) __endnetgrent(); - else { - int len = strlen(group) + 1; - - grouphead.grname = malloc(len); - strlcpy(grouphead.grname, group, len); - } + else + grouphead.grname = strdup(group); } nextgrp = grouphead.gr; } @@ -149,12 +144,12 @@ __endnetgrent(void) lp = lp->l_next; free(olp->l_groupname); free(olp->l_line); - free((char *)olp); + free(olp); } - linehead = (struct linelist *)0; + linehead = NULL; if (grouphead.grname) { free(grouphead.grname); - grouphead.grname = (char *)0; + grouphead.grname = NULL; } gp = grouphead.gr; while (gp) { @@ -166,9 +161,9 @@ __endnetgrent(void) free(ogp->ng_str[NG_USER]); if (ogp->ng_str[NG_DOM]) free(ogp->ng_str[NG_DOM]); - free((char *)ogp); + free(ogp); } - grouphead.gr = (struct netgrp *)0; + grouphead.gr = NULL; } /* @@ -194,8 +189,7 @@ parse_netgrp(char *group) break; lp = lp->l_next; } - if (lp == (struct linelist *)0 && - (lp = read_for_group(group)) == (struct linelist *)0) + if (lp == NULL && (lp = read_for_group(group)) == NULL) return (1); if (lp->l_parsed) { #ifdef DEBUG @@ -214,8 +208,8 @@ parse_netgrp(char *group) /* Watch for null pointer dereferences, dammit! */ while (pos != NULL && *pos != '\0') { if (*pos == '(') { - grp = (struct netgrp *)malloc(sizeof (struct netgrp)); - bzero((char *)grp, sizeof (struct netgrp)); + grp = malloc(sizeof(struct netgrp)); + bzero(grp, sizeof(struct netgrp)); grp->ng_next = grouphead.gr; grouphead.gr = grp; pos++; @@ -236,10 +230,9 @@ parse_netgrp(char *group) } else len = strlen(spos); if (len > 0) { - grp->ng_str[strpos] = (char *) - malloc(len + 1); + grp->ng_str[strpos] = malloc(len + 1); bcopy(spos, grp->ng_str[strpos], - len + 1); + len + 1); } } else { /* @@ -311,9 +304,9 @@ read_for_group(char *group) while (*pos == ' ' || *pos == '\t') pos++; if (*pos != '\n' && *pos != '\0') { - lp = (struct linelist *)malloc(sizeof (*lp)); + lp = malloc(sizeof(*lp)); lp->l_parsed = 0; - lp->l_groupname = (char *)malloc(len + 1); + lp->l_groupname = malloc(len + 1); bcopy(spos, lp->l_groupname, len); *(lp->l_groupname + len) = '\0'; len = strlen(pos); @@ -330,7 +323,7 @@ read_for_group(char *group) } else cont = 0; if (len > 0) { - linep = (char *)malloc(olen + len + 1); + linep = malloc(olen + len + 1); if (olen > 0) { bcopy(olinep, linep, olen); free(olinep); @@ -361,5 +354,5 @@ read_for_group(char *group) #endif return (lp); } - return ((struct linelist *)0); + return (NULL); } diff --git a/usr.sbin/ypserv/revnetgroup/revnetgroup.c b/usr.sbin/ypserv/revnetgroup/revnetgroup.c index 15ad5fab7ed..212d873a731 100644 --- a/usr.sbin/ypserv/revnetgroup/revnetgroup.c +++ b/usr.sbin/ypserv/revnetgroup/revnetgroup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: revnetgroup.c,v 1.5 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: revnetgroup.c,v 1.6 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1995 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -47,7 +47,7 @@ #include "hash.h" #ifndef lint -static const char rcsid[] = "$OpenBSD: revnetgroup.c,v 1.5 2003/07/15 06:10:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: revnetgroup.c,v 1.6 2006/04/03 05:01:23 deraadt Exp $"; #endif /* Default location of netgroup file. */ @@ -135,7 +135,7 @@ main(int argc, char *argv[]) continue; key = (char *)&readbuf; *(data - 1) = '\0'; - store(gtable, key, data); + ngstore(gtable, key, data); } fclose(fp); diff --git a/usr.sbin/ypserv/stdethers/stdethers.c b/usr.sbin/ypserv/stdethers/stdethers.c index 70b5fbe7a01..da1b754ef90 100644 --- a/usr.sbin/ypserv/stdethers/stdethers.c +++ b/usr.sbin/ypserv/stdethers/stdethers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdethers.c,v 1.13 2005/05/14 02:32:33 deraadt Exp $ */ +/* $OpenBSD: stdethers.c,v 1.14 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: stdethers.c,v 1.13 2005/05/14 02:32:33 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: stdethers.c,v 1.14 2006/04/03 05:01:23 deraadt Exp $"; #endif #include <sys/types.h> diff --git a/usr.sbin/ypserv/stdhosts/stdhosts.c b/usr.sbin/ypserv/stdhosts/stdhosts.c index 90003af500f..292ccb41e47 100644 --- a/usr.sbin/ypserv/stdhosts/stdhosts.c +++ b/usr.sbin/ypserv/stdhosts/stdhosts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdhosts.c,v 1.14 2005/05/14 02:32:33 deraadt Exp $ */ +/* $OpenBSD: stdhosts.c,v 1.15 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: stdhosts.c,v 1.14 2005/05/14 02:32:33 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: stdhosts.c,v 1.15 2006/04/03 05:01:23 deraadt Exp $"; #endif #include <sys/types.h> @@ -126,7 +126,7 @@ main(int argc, char *argv[]) p++; if (inet_aton(k, &host_addr)) - printf("%s %s\n", inet_ntoa(host_addr),v); + printf("%s %s\n", inet_ntoa(host_addr), v); } return(0); } diff --git a/usr.sbin/ypserv/yppush/yppush.c b/usr.sbin/ypserv/yppush/yppush.c index b0195f9dba9..05bf1ba26c5 100644 --- a/usr.sbin/ypserv/yppush/yppush.c +++ b/usr.sbin/ypserv/yppush/yppush.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppush.c,v 1.23 2005/09/16 23:53:08 deraadt Exp $ */ +/* $OpenBSD: yppush.c,v 1.24 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: yppush.c,v 1.23 2005/09/16 23:53:08 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: yppush.c,v 1.24 2006/04/03 05:01:23 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -154,12 +154,12 @@ push(int inlen, char *indata) pid_t pid; struct rusage res; - snprintf(host, sizeof host, "%*.*s" ,inlen ,inlen, indata); + snprintf(host, sizeof host, "%*.*s", inlen, inlen, indata); client = clnt_create(host, YPPROG, YPVERS, "tcp"); if (client == NULL) { if (Verbose) - fprintf(stderr, "Target Host: %s\n",host); + fprintf(stderr, "Target Host: %s\n", host); clnt_pcreateerror("yppush: Cannot create client"); return; } diff --git a/usr.sbin/ypserv/yppush/yppush_svc.c b/usr.sbin/ypserv/yppush/yppush_svc.c index d42dc65941a..60bcc903a9d 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.11 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: yppush_svc.c,v 1.12 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se> @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: yppush_svc.c,v 1.12 2006/04/03 05:01:23 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -97,8 +97,8 @@ yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp) exit(1); return; } - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { + (void) memset(&argument, 0, sizeof(argument)); + if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) { svcerr_decode(transp); _rpcsvcdirty = 0; exit(1); @@ -108,7 +108,7 @@ yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp) if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); } - if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { + if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) { _msgout("unable to free arguments"); exit(1); } diff --git a/usr.sbin/ypserv/ypserv/acl.c b/usr.sbin/ypserv/ypserv/acl.c index 173c8928359..82f220b12be 100644 --- a/usr.sbin/ypserv/ypserv/acl.c +++ b/usr.sbin/ypserv/ypserv/acl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acl.c,v 1.12 2003/11/08 19:17:30 jmc Exp $ */ +/* $OpenBSD: acl.c,v 1.13 2006/04/03 05:01:23 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: acl.c,v 1.12 2003/11/08 19:17:30 jmc Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: acl.c,v 1.13 2006/04/03 05:01:23 deraadt Exp $"; #endif #include <sys/types.h> @@ -108,7 +108,7 @@ 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 = malloc(sizeof(struct aclent)); acl->next = NULL; acl->allow = allow; acl->s_addr = addr->s_addr; @@ -163,7 +163,7 @@ acl_init(char *file) k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } @@ -191,7 +191,7 @@ acl_init(char *file) (state == ACLS_ALLOW || state == ACLS_DENY)) { k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } @@ -231,7 +231,7 @@ acl_init(char *file) k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } @@ -301,7 +301,7 @@ acl_init(char *file) k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } @@ -323,7 +323,7 @@ acl_init(char *file) k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } @@ -396,7 +396,8 @@ acl_init(char *file) break; default: error_cnt++; - fprintf(stderr, "acl: unexpected state %d %s\n",state,k); + fprintf(stderr, "acl: unexpected state %d %s\n", + state, k); } } @@ -447,7 +448,7 @@ acl_securenet(char *file) k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } @@ -476,7 +477,7 @@ acl_securenet(char *file) k = p; /* save start of verb */ i = 0; - while (*p != '\0' && !isspace(*p = tolower(*p))) { + while (*p != '\0' && !isspace(*p = (char)tolower(*p))) { p++; i++; } diff --git a/usr.sbin/ypserv/ypserv/ypserv.c b/usr.sbin/ypserv/ypserv/ypserv.c index 5bb0193d9ba..f54e525c326 100644 --- a/usr.sbin/ypserv/ypserv/ypserv.c +++ b/usr.sbin/ypserv/ypserv/ypserv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv.c,v 1.33 2005/09/16 23:55:04 deraadt Exp $ */ +/* $OpenBSD: ypserv.c,v 1.34 2006/04/03 05:01:24 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv.c,v 1.33 2005/09/16 23:55:04 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: ypserv.c,v 1.34 2006/04/03 05:01:24 deraadt Exp $"; #endif #include <sys/types.h> @@ -191,8 +191,8 @@ ypprog_1(struct svc_req *rqstp, SVCXPRT *transp) _rpcsvcdirty = 0; return; } - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { + (void) memset(&argument, 0, sizeof(argument)); + if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) { svcerr_decode(transp); _rpcsvcdirty = 0; return; @@ -201,7 +201,7 @@ ypprog_1(struct svc_req *rqstp, SVCXPRT *transp) if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); } - if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { + if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) { _msgout("unable to free arguments"); exit(1); } @@ -306,8 +306,8 @@ ypprog_2(struct svc_req *rqstp, SVCXPRT *transp) _rpcsvcdirty = 0; return; } - (void) memset((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) { + (void) memset(&argument, 0, sizeof(argument)); + if (!svc_getargs(transp, xdr_argument, (caddr_t)&argument)) { svcerr_decode(transp); _rpcsvcdirty = 0; return; @@ -316,7 +316,7 @@ ypprog_2(struct svc_req *rqstp, SVCXPRT *transp) if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); } - if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) { + if (!svc_freeargs(transp, xdr_argument, (caddr_t)&argument)) { _msgout("unable to free arguments"); exit(1); } @@ -391,7 +391,7 @@ main(int argc, char *argv[]) { int xflag = 0, allowv1 = 0, ch, sock, proto; struct sockaddr_in saddr; - socklen_t asize = sizeof (saddr); + socklen_t asize = sizeof(saddr); extern char *optarg; SVCXPRT *transp; @@ -428,12 +428,12 @@ main(int argc, char *argv[]) exit(1); if (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) { - socklen_t ssize = sizeof (int); + socklen_t ssize = sizeof(int); if (saddr.sin_family != AF_INET) exit(1); if (getsockopt(0, SOL_SOCKET, SO_TYPE, - (char *)&_rpcfdtype, &ssize) == -1) + &_rpcfdtype, &ssize) == -1) exit(1); sock = 0; _rpcpmstart = 1; @@ -441,7 +441,7 @@ main(int argc, char *argv[]) openlog("ypserv", LOG_PID, LOG_DAEMON); } else { #ifndef RPC_SVC_FG - int size, i; + int i; pid_t pid; pid = fork(); @@ -457,7 +457,7 @@ main(int argc, char *argv[]) (void) dup2(i, 2); i = open("/dev/tty", 2); if (i >= 0) { - (void) ioctl(i, TIOCNOTTY, (char *)NULL); + (void) ioctl(i, TIOCNOTTY, NULL); (void) close(i); } openlog("ypserv", LOG_PID, LOG_DAEMON); @@ -527,7 +527,7 @@ main(int argc, char *argv[]) } } - if (transp == (SVCXPRT *)NULL) { + if (transp == NULL) { _msgout("could not create a handle"); exit(1); } @@ -547,7 +547,7 @@ sig_child(int signo) { int save_errno = errno; - while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0) + while (wait3(NULL, WNOHANG, NULL) > 0) ; errno = save_errno; } diff --git a/usr.sbin/ypserv/ypserv/ypserv_db.c b/usr.sbin/ypserv/ypserv/ypserv_db.c index 45728ccab9d..345730dc0d4 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.22 2005/12/21 01:40:25 millert Exp $ */ +/* $OpenBSD: ypserv_db.c,v 1.23 2006/04/03 05:01:24 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -33,8 +33,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.22 2005/12/21 01:40:25 millert Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.23 2006/04/03 05:01:24 deraadt Exp $"; #endif /* @@ -73,7 +73,7 @@ CIRCLEQ_HEAD(mapq, opt_map); /* CIRCLEQ of maps (LRU) */ struct opt_map { mapname map; /* map name (malloc'd) */ - DBM *db; /* database */ + DBM *db; /* database */ struct opt_domain *dom; /* back ptr to our domain */ int host_lookup; /* host lookup */ int secure; /* secure map? */ @@ -304,7 +304,7 @@ ypdb_open_db(domainname domain, mapname map, ypstat *status, */ if (d == NULL) { /* allocate new domain? */ - d = (struct opt_domain *) malloc(sizeof(*d)); + d = malloc(sizeof(*d)); if (d) d->domain = strdup(domain); if (d == NULL || d->domain == NULL) { @@ -325,7 +325,7 @@ ypdb_open_db(domainname domain, mapname map, ypstat *status, * m must be NULL since we couldn't find a map. allocate new one */ - m = (struct opt_map *) malloc(sizeof(*m)); + m = malloc(sizeof(*m)); if (m) m->map = strdup(map); if (m == NULL || m->map == NULL) { @@ -409,7 +409,7 @@ lookup_host(int nametable, int host_lookup, DBM *db, char *keystr, } inet_aton(keystr, &addr_addr); - host = gethostbyaddr((char *) &addr_addr, sizeof(addr_addr), AF_INET); + host = gethostbyaddr((char *)&addr_addr, sizeof(addr_addr), AF_INET); if (host == NULL) return(YP_NOKEY); strncpy((char *)hostname, host->h_name, sizeof(hostname) - 1); @@ -454,7 +454,7 @@ ypdb_get_record(domainname domain, mapname map, keydat key, int ypprivate) int host_lookup = 0, hn; struct opt_map *map_info = NULL; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, &map_info); if (!db || res.stat < 0) @@ -499,7 +499,7 @@ ypdb_get_first(domainname domain, mapname map, int ypprivate) DBM *db; datum k, v; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); @@ -534,7 +534,7 @@ ypdb_get_next(domainname domain, mapname map, keydat key, int ypprivate) DBM *db; datum k, v, n; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); if (res.stat >= 0) { @@ -584,7 +584,7 @@ ypdb_get_order(domainname domain, mapname map) DBM *db; datum k, v; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); if (res.stat >= 0) { @@ -613,7 +613,7 @@ ypdb_get_master(domainname domain, mapname map) DBM *db; datum k, v; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); db = ypdb_open_db(domain, map, &res.stat, NULL); if (res.stat >= 0) { @@ -640,7 +640,7 @@ ypdb_xdr_get_all(XDR *xdrs, ypreq_nokey *req) DBM *db; datum k, v; - bzero((char *)&resp, sizeof(resp)); + bzero(&resp, sizeof(resp)); /* * open db, and advance past any private keys we may see @@ -681,7 +681,7 @@ ypdb_xdr_get_all(XDR *xdrs, ypreq_nokey *req) k = ypdb_nextkey(db); } - bzero((char *)&resp, sizeof(resp)); + bzero(&resp, sizeof(resp)); resp.ypresp_all_u.val.stat = YP_NOKEY; resp.more = FALSE; @@ -703,7 +703,7 @@ ypdb_secure(domainname domain, mapname map) int secure; struct opt_map *map_info = NULL; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); secure = FALSE; db = ypdb_open_db(domain, map, &res.stat, &map_info); diff --git a/usr.sbin/ypserv/ypserv/ypserv_proc.c b/usr.sbin/ypserv/ypserv/ypserv_proc.c index 1d588a73dab..823a970b411 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.24 2005/05/14 02:32:33 deraadt Exp $ */ +/* $OpenBSD: ypserv_proc.c,v 1.25 2006/04/03 05:01:24 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.24 2005/05/14 02:32:33 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: ypserv_proc.c,v 1.25 2006/04/03 05:01:24 deraadt Exp $"; #endif #include <rpc/rpc.h> @@ -61,6 +61,7 @@ static char *True = "true"; static char *False = "FALSE"; #define TORF(N) ((N) ? True : False) +/*ARGSUSED*/ void * ypproc_null_2_svc(void *argp, struct svc_req *rqstp) { @@ -244,7 +245,7 @@ ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp) char tid[11], prog[11], port[11]; char ypxfr_proc[] = YPXFR_PROC, *ipadd; - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); YPLOG("xfr_2: caller=[%s].%d, auth_ok=%s, domain=%s, tid=%d, prog=%d", inet_ntoa(caller->sin_addr), ntohs(caller->sin_port), TORF(ok), @@ -271,7 +272,7 @@ ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp) } if (pid == 0) { execl(ypxfr_proc, "ypxfr", "-d", argp->map_parms.domain, - "-C",tid, prog, ipadd, port, argp->map_parms.map, (char *)NULL); + "-C", tid, prog, ipadd, port, argp->map_parms.map, (char *)NULL); _exit(1); } /* @@ -280,6 +281,7 @@ ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp) return (&res); } +/*ARGSUSED*/ void * ypproc_clear_2_svc(void *argp, struct svc_req *rqstp) { @@ -332,7 +334,7 @@ bail: svcerr_auth(rqstp->rq_xprt, AUTH_FAILED); return(NULL); } - bzero((char *)&res, sizeof(res)); + bzero(&res, sizeof(res)); if (secure && (ntohs(caller->sin_port) >= IPPORT_RESERVED)) { res.ypresp_all_u.val.stat = YP_YPERR; @@ -348,7 +350,7 @@ bail: } /* CHILD: send result, then exit */ - if (!svc_sendreply(rqstp->rq_xprt, ypdb_xdr_get_all, (char *) argp)) { + if (!svc_sendreply(rqstp->rq_xprt, ypdb_xdr_get_all, (char *)argp)) { svcerr_systemerr(rqstp->rq_xprt); } exit(0); @@ -463,8 +465,8 @@ bail: return(NULL); } - bzero((char *)&res, sizeof(res)); - snprintf(domain_path,MAXPATHLEN, "%s/%s",YP_DB_PATH,*argp); + bzero(&res, sizeof(res)); + snprintf(domain_path, sizeof domain_path, "%s/%s", YP_DB_PATH, *argp); status = YP_TRUE; res.maps = NULL; @@ -486,14 +488,12 @@ bail: continue; suffix = (char *) &dp->d_name[dp->d_namlen-3]; if (strcmp(suffix, ".db") == 0) { - if ((m = (struct ypmaplist *)malloc((unsigned) - sizeof(struct ypmaplist))) == NULL) { + if ((m = malloc(sizeof(struct ypmaplist))) == NULL) { status = YP_YPERR; break; } - if ((map_name = (char *)malloc((unsigned) - dp->d_namlen - 2)) == NULL) { + if ((map_name = malloc(dp->d_namlen - 2)) == NULL) { status = YP_YPERR; break; } @@ -516,6 +516,7 @@ bail: return (&res); } +/*ARGSUSED*/ void * ypoldproc_null_1_svc(void *argp, struct svc_req *rqstp) { diff --git a/usr.sbin/ypserv/yptest/yptest.c b/usr.sbin/ypserv/yptest/yptest.c index 854e08cedd1..a6d64976c4a 100644 --- a/usr.sbin/ypserv/yptest/yptest.c +++ b/usr.sbin/ypserv/yptest/yptest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yptest.c,v 1.15 2003/06/02 21:58:27 maja Exp $ */ +/* $OpenBSD: yptest.c,v 1.16 2006/04/03 05:01:24 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: yptest.c,v 1.15 2003/06/02 21:58:27 maja Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: yptest.c,v 1.16 2006/04/03 05:01:24 deraadt Exp $"; #endif #include <stdio.h> diff --git a/usr.sbin/ypserv/ypxfr/ypxfr.c b/usr.sbin/ypserv/ypxfr/ypxfr.c index aed13268cd6..800211cbb70 100644 --- a/usr.sbin/ypserv/ypxfr/ypxfr.c +++ b/usr.sbin/ypserv/ypxfr/ypxfr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypxfr.c,v 1.33 2005/05/14 02:32:33 deraadt Exp $ */ +/* $OpenBSD: ypxfr.c,v 1.34 2006/04/03 05:01:24 deraadt Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -26,8 +26,8 @@ * SUCH DAMAGE. */ -#ifndef LINT -static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.33 2005/05/14 02:32:33 deraadt Exp $"; +#ifndef lint +static const char rcsid[] = "$OpenBSD: ypxfr.c,v 1.34 2006/04/03 05:01:24 deraadt Exp $"; #endif #include <sys/types.h> |