From 55ac0c2da31b9859148ea282c2c6dc8992348ef8 Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 26 Jul 1998 21:58:46 +0000 Subject: [PATCH] const poisoning. --- include/util.h | 4 ++-- lib/libskey/put.c | 9 +++++---- lib/libskey/skey.h | 28 ++++++++++++++-------------- lib/libskey/skeylogin.c | 18 ++++++++---------- lib/libskey/skeysubr.c | 16 +++++++++------- lib/libutil/ttyaction.c | 8 ++++---- usr.bin/lock/lock.c | 10 +++++----- usr.bin/login/login.c | 13 +++++++------ usr.bin/mail/aux.c | 6 +++--- usr.bin/mail/extern.h | 10 +++++----- usr.bin/mail/getname.c | 6 +++--- usr.bin/mail/temp.c | 6 +++--- usr.bin/mail/v7.local.c | 8 ++++---- 13 files changed, 72 insertions(+), 70 deletions(-) diff --git a/include/util.h b/include/util.h index e0333c1614d9..103f80e01f7b 100644 --- a/include/util.h +++ b/include/util.h @@ -1,4 +1,4 @@ -/* $NetBSD: util.h,v 1.11 1998/06/08 03:05:14 lukem Exp $ */ +/* $NetBSD: util.h,v 1.12 1998/07/26 22:01:48 mycroft Exp $ */ /*- * Copyright (c) 1995 @@ -77,7 +77,7 @@ int opendisk __P((const char *, int, char *, size_t, int)); int pidlock __P((const char *, int, pid_t *, const char *)); int ttylock __P((const char *, int, pid_t *)); int ttyunlock __P((const char *)); -int ttyaction __P((char *tty, char *act, char *user)); +int ttyaction __P((const char *, const char *, const char *)); struct iovec; char *ttymsg __P((struct iovec *, int, const char *, int)); __END_DECLS diff --git a/lib/libskey/put.c b/lib/libskey/put.c index e7c61fd7abea..f5b5c8d6a686 100644 --- a/lib/libskey/put.c +++ b/lib/libskey/put.c @@ -1,4 +1,4 @@ -/* $NetBSD: put.c,v 1.5 1998/02/03 19:12:47 perry Exp $ */ +/* $NetBSD: put.c,v 1.6 1998/07/26 21:58:46 mycroft Exp $ */ /* S/KEY v1.1b (put.c) * @@ -2079,7 +2079,8 @@ char Wp[2048][4] = { */ char * btoe (engout, c) - char *c, *engout; + char *engout; + const char *c; { char cp[9]; /* add in room for the parity 2 bits */ int p, i; @@ -2119,7 +2120,7 @@ char * int etob (out, e) char *out; - char *e; + const char *e; { char *word; int i, p, v, l, low, high; @@ -2174,7 +2175,7 @@ int char * put8 (out, s) char *out; - char *s; + const char *s; { sprintf (out, "%02X%02X %02X%02X %02X%02X %02X%02X", /* XXX: sprintf (put8()) appears to be unused */ s[0] & 0xff, s[1] & 0xff, s[2] & 0xff, diff --git a/lib/libskey/skey.h b/lib/libskey/skey.h index 26071ac2b478..f69c30cb3f75 100644 --- a/lib/libskey/skey.h +++ b/lib/libskey/skey.h @@ -1,4 +1,4 @@ -/* $NetBSD: skey.h,v 1.4 1997/01/23 14:03:08 mrg Exp $ */ +/* $NetBSD: skey.h,v 1.5 1998/07/26 21:58:46 mycroft Exp $ */ /* * S/KEY v1.1b (skey.h) @@ -53,25 +53,25 @@ struct mc }; void f __ARGS ((char *x)); -int keycrunch __ARGS ((char *result, char *seed, char *passwd)); -char *btoe __ARGS ((char *engout, char *c)); -char *put8 __ARGS ((char *out, char *s)); -int etob __ARGS ((char *out, char *e)); +int keycrunch __ARGS ((char *result, const char *seed, const char *passwd)); +char *btoe __ARGS ((char *engout, const char *c)); +char *put8 __ARGS ((char *out, const char *s)); +int etob __ARGS ((char *out, const char *e)); void rip __ARGS ((char *buf)); -int skeychallenge __ARGS ((struct skey * mp, char *name, char *ss, int sslen)); -int skeylookup __ARGS ((struct skey * mp, char *name)); +int skeychallenge __ARGS ((struct skey * mp, const char *name, char *ss, int sslen)); +int skeylookup __ARGS ((struct skey * mp, const char *name)); int skeyverify __ARGS ((struct skey * mp, char *response)); void sevenbit __ARGS ((char *s)); void backspace __ARGS ((char *s)); -char *skipspace __ARGS ((char *s)); +const char *skipspace __ARGS ((const char *s)); char *readpass __ARGS ((char *buf, int n)); char *readskey __ARGS ((char *buf, int n)); -int skey_authenticate __ARGS ((char *)); -int skey_passcheck __ARGS ((char *, char *)); -char *skey_keyinfo __ARGS ((char *)); -int skey_haskey __ARGS ((char *)); +int skey_authenticate __ARGS ((const char *)); +int skey_passcheck __ARGS ((const char *, char *)); +char *skey_keyinfo __ARGS ((const char *)); +int skey_haskey __ARGS ((const char *)); int getskeyprompt __ARGS ((struct skey *, char *, char *)); -int atob8 __ARGS((char *, char *)); -int btoa8 __ARGS((char *, char *)); +int atob8 __ARGS((char *, const char *)); +int btoa8 __ARGS((char *, const char *)); int htoi __ARGS((char)); diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 1e3ef6989dc7..0d83974a3bcb 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -1,4 +1,4 @@ -/* $NetBSD: skeylogin.c,v 1.8 1997/06/18 19:18:30 christos Exp $ */ +/* $NetBSD: skeylogin.c,v 1.9 1998/07/26 21:58:46 mycroft Exp $ */ /* S/KEY v1.1b (skeylogin.c) * @@ -33,9 +33,6 @@ #define _PATH_KEYFILE "/etc/skeykeys" -char *skipspace __ARGS((char *)); -int skeylookup __ARGS((struct skey *, char *)); - /* Issue a skey challenge for user 'name'. If successful, * fill in the caller's skey structure and return 0. If unsuccessful * (e.g., if name is unknown) return -1. @@ -79,7 +76,7 @@ getskeyprompt(mp,name,prompt) int skeychallenge(mp,name, ss, sslen) struct skey *mp; - char *name; + const char *name; char *ss; int sslen; { @@ -108,7 +105,7 @@ skeychallenge(mp,name, ss, sslen) int skeylookup(mp,name) struct skey *mp; - char *name; + const char *name; { int found; int len; @@ -269,7 +266,7 @@ skeyverify(mp,response) int skey_haskey (username) - char *username; + const char *username; { struct skey skey; @@ -285,7 +282,7 @@ skey_haskey (username) */ char * skey_keyinfo (username) - char *username; + const char *username; { int i; static char str [50]; @@ -310,7 +307,8 @@ skey_keyinfo (username) int skey_passcheck (username, passwd) - char *username, *passwd; + const char *username; + char *passwd; { int i; struct skey skey; @@ -337,7 +335,7 @@ skey_passcheck (username, passwd) int skey_authenticate (username) - char *username; + const char *username; { int i; char pbuf[256], skeyprompt[50]; diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c index f5170e3df602..1930ea808436 100644 --- a/lib/libskey/skeysubr.c +++ b/lib/libskey/skeysubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: skeysubr.c,v 1.12 1998/03/18 19:22:12 christos Exp $ */ +/* $NetBSD: skeysubr.c,v 1.13 1998/07/26 21:58:46 mycroft Exp $ */ /* S/KEY v1.1b (skeysubr.c) * @@ -36,8 +36,8 @@ static void echo_off __ARGS((void)); int keycrunch(result,seed,passwd) char *result; /* 8-byte result */ -char *seed; /* Seed, any length */ -char *passwd; /* Password, any length */ +const char *seed; /* Seed, any length */ +const char *passwd; /* Password, any length */ { char *buf; MD4_CTX md; @@ -176,7 +176,8 @@ trapped(sig) */ int atob8(out, in) - char *out, *in; + char *out; + const char *in; { int i; int val; @@ -203,7 +204,8 @@ atob8(out, in) /* Convert 8-byte binary array to hex-ascii string */ int btoa8(out, in) - char *out, *in; + char *out; + const char *in; { int i; @@ -232,9 +234,9 @@ htoi(c) return -1; } -char * +const char * skipspace(cp) - char *cp; + const char *cp; { while (*cp == ' ' || *cp == '\t') cp++; diff --git a/lib/libutil/ttyaction.c b/lib/libutil/ttyaction.c index d69ae5da14fb..8a10dfaa3dcf 100644 --- a/lib/libutil/ttyaction.c +++ b/lib/libutil/ttyaction.c @@ -1,4 +1,4 @@ -/* $NetBSD: ttyaction.c,v 1.8 1997/07/31 00:02:52 jtc Exp $ */ +/* $NetBSD: ttyaction.c,v 1.9 1998/07/26 22:02:38 mycroft Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -65,9 +65,9 @@ static char *pathenv = __CONCAT("PATH=",_PATH_STDPATH); int ttyaction(tty, act, user) - char *tty; - char *act; - char *user; + const char *tty; + const char *act; + const char *user; { FILE *fp; char *p1, *p2; diff --git a/usr.bin/lock/lock.c b/usr.bin/lock/lock.c index 5b476daeba96..b24adf521d8e 100644 --- a/usr.bin/lock/lock.c +++ b/usr.bin/lock/lock.c @@ -1,4 +1,4 @@ -/* $NetBSD: lock.c,v 1.14 1998/07/26 15:23:39 mycroft Exp $ */ +/* $NetBSD: lock.c,v 1.15 1998/07/26 22:00:24 mycroft Exp $ */ /* * Copyright (c) 1980, 1987, 1993 @@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1987, 1993\n\ #if 0 static char sccsid[] = "@(#)lock.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: lock.c,v 1.14 1998/07/26 15:23:39 mycroft Exp $"); +__RCSID("$NetBSD: lock.c,v 1.15 1998/07/26 22:00:24 mycroft Exp $"); #endif /* not lint */ /* @@ -82,7 +82,7 @@ void hi __P((int)); int main __P((int, char **)); void quit __P((int)); #ifdef SKEY -int skey_auth __P((char *)); +int skey_auth __P((const char *)); #endif struct timeval timeout; @@ -224,9 +224,9 @@ main(argc, argv) */ int skey_auth(user) - char *user; + const char *user; { - char s[128], *ask, *skey_keyinfo __P((char *name)); + char s[128], *ask; int ret = 0; if (!skey_haskey(user) && (ask = skey_keyinfo(user))) { diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 8a67495fbbd7..609b4e8c21c7 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -1,4 +1,4 @@ -/* $NetBSD: login.c,v 1.38 1998/07/11 08:12:51 mrg Exp $ */ +/* $NetBSD: login.c,v 1.39 1998/07/26 22:04:37 mycroft Exp $ */ /*- * Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994 @@ -44,7 +44,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif -__RCSID("$NetBSD: login.c,v 1.38 1998/07/11 08:12:51 mrg Exp $"); +__RCSID("$NetBSD: login.c,v 1.39 1998/07/26 22:04:37 mycroft Exp $"); #endif /* not lint */ /* @@ -94,7 +94,7 @@ void motd __P((void)); int rootterm __P((char *)); void sigint __P((int)); void sleepexit __P((int)); -char *stypeof __P((char *)); +const char *stypeof __P((const char *)); void timedout __P((int)); #if defined(KERBEROS) || defined(KERBEROS5) int klogin __P((struct passwd *, char *, char *, char *)); @@ -145,7 +145,8 @@ main(argc, argv) uid_t uid, saved_uid; gid_t saved_gid, saved_gids[NGROUPS_MAX]; int nsaved_gids; - char *domain, *p, *salt, *ttyn, *pwprompt; + char *domain, *p, *ttyn, *pwprompt; + const char *salt; char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10]; char localhost[MAXHOSTNAMELEN + 1]; int need_chpass, require_chpass; @@ -754,9 +755,9 @@ badlogin(name) #undef UNKNOWN #define UNKNOWN "su" -char * +const char * stypeof(ttyid) - char *ttyid; + const char *ttyid; { struct ttyent *t; diff --git a/usr.bin/mail/aux.c b/usr.bin/mail/aux.c index 9d807961af48..780571e92163 100644 --- a/usr.bin/mail/aux.c +++ b/usr.bin/mail/aux.c @@ -1,4 +1,4 @@ -/* $NetBSD: aux.c,v 1.8 1997/10/19 19:27:40 mycroft Exp $ */ +/* $NetBSD: aux.c,v 1.9 1998/07/26 22:07:26 mycroft Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)aux.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: aux.c,v 1.8 1997/10/19 19:27:40 mycroft Exp $"); +__RCSID("$NetBSD: aux.c,v 1.9 1998/07/26 22:07:26 mycroft Exp $"); #endif #endif /* not lint */ @@ -57,7 +57,7 @@ static char *save2str __P((char *, char *)); */ char * savestr(str) - char *str; + const char *str; { char *new; int size = strlen(str) + 1; diff --git a/usr.bin/mail/extern.h b/usr.bin/mail/extern.h index dac59f76e920..6e6875057650 100644 --- a/usr.bin/mail/extern.h +++ b/usr.bin/mail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.8 1997/10/19 05:03:20 lukem Exp $ */ +/* $NetBSD: extern.h,v 1.9 1998/07/26 22:07:27 mycroft Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.2 (Berkeley) 4/20/95 - * $NetBSD: extern.h,v 1.8 1997/10/19 05:03:20 lukem Exp $ + * $NetBSD: extern.h,v 1.9 1998/07/26 22:07:27 mycroft Exp $ */ struct name; @@ -58,7 +58,7 @@ char *copyin __P((char *, char **)); char *detract __P((struct name *, int)); char *expand __P((char *)); char *getdeadletter __P((void)); -char *getname __P((int)); +const char *getname __P((int)); struct message; char *hfield __P((char [], struct message *)); FILE *infix __P((struct header *, FILE *)); @@ -70,12 +70,12 @@ char *readtty __P((char [], char [])); char *reedit __P((char *)); FILE *run_editor __P((FILE *, off_t, int, int)); char *salloc __P((int)); -char *savestr __P((char *)); +char *savestr __P((const char *)); FILE *setinput __P((struct message *)); char *skin __P((char *)); char *skip_comment __P((char *)); char *snarf __P((char [], int *)); -char *username __P((void)); +const char *username __P((void)); char *value __P((char [])); char *vcopy __P((char [])); char *yankword __P((char *, char [])); diff --git a/usr.bin/mail/getname.c b/usr.bin/mail/getname.c index db2e65b8e6db..79dcd7e7ff4a 100644 --- a/usr.bin/mail/getname.c +++ b/usr.bin/mail/getname.c @@ -1,4 +1,4 @@ -/* $NetBSD: getname.c,v 1.5 1997/10/19 05:03:24 lukem Exp $ */ +/* $NetBSD: getname.c,v 1.6 1998/07/26 22:07:27 mycroft Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)getname.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: getname.c,v 1.5 1997/10/19 05:03:24 lukem Exp $"); +__RCSID("$NetBSD: getname.c,v 1.6 1998/07/26 22:07:27 mycroft Exp $"); #endif #endif /* not lint */ @@ -50,7 +50,7 @@ __RCSID("$NetBSD: getname.c,v 1.5 1997/10/19 05:03:24 lukem Exp $"); /* * Search the passwd file for a uid. Return name on success, NOSTR on failure */ -char * +const char * getname(uid) int uid; { diff --git a/usr.bin/mail/temp.c b/usr.bin/mail/temp.c index 359ad03d374d..452bb39a8f7a 100644 --- a/usr.bin/mail/temp.c +++ b/usr.bin/mail/temp.c @@ -1,4 +1,4 @@ -/* $NetBSD: temp.c,v 1.6 1997/10/19 05:03:57 lukem Exp $ */ +/* $NetBSD: temp.c,v 1.7 1998/07/26 22:07:27 mycroft Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)temp.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: temp.c,v 1.6 1997/10/19 05:03:57 lukem Exp $"); +__RCSID("$NetBSD: temp.c,v 1.7 1998/07/26 22:07:27 mycroft Exp $"); #endif #endif /* not lint */ @@ -61,7 +61,7 @@ char *tmpdir; void tinit() { - char *cp; + const char *cp; if ((tmpdir = getenv("TMPDIR")) == NULL) { tmpdir = _PATH_TMP; diff --git a/usr.bin/mail/v7.local.c b/usr.bin/mail/v7.local.c index 7afb41a934f4..e2591c543bb2 100644 --- a/usr.bin/mail/v7.local.c +++ b/usr.bin/mail/v7.local.c @@ -1,4 +1,4 @@ -/* $NetBSD: v7.local.c,v 1.9 1997/10/19 05:04:02 lukem Exp $ */ +/* $NetBSD: v7.local.c,v 1.10 1998/07/26 22:07:27 mycroft Exp $ */ /* * Copyright (c) 1980, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)v7.local.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: v7.local.c,v 1.9 1997/10/19 05:04:02 lukem Exp $"); +__RCSID("$NetBSD: v7.local.c,v 1.10 1998/07/26 22:07:27 mycroft Exp $"); #endif #endif /* not lint */ @@ -85,10 +85,10 @@ demail() /* * Discover user login name. */ -char * +const char * username() { - char *np; + const char *np; uid_t uid; if ((np = getenv("USER")) != NOSTR)