diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-20 09:48:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-20 09:48:25 +0000 |
commit | 00c1ae9c3963b23f1fe010fee051ffb1be1eb7ae (patch) | |
tree | 41165bc8303e615f82a515d8c272dfebc9f97595 /lib/libskey | |
parent | c482518380683ee38d14024c1e362a0d681cf967 (diff) |
add ability to zero out entry; from millert@cs.colorado.edu; netbsd pr#1851
also add a prototype for skeyzero()
Diffstat (limited to 'lib/libskey')
-rw-r--r-- | lib/libskey/skey.h | 3 | ||||
-rw-r--r-- | lib/libskey/skeylogin.c | 30 |
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/libskey/skey.h b/lib/libskey/skey.h index 1cc7c4a4b1c..1d7f596a9ea 100644 --- a/lib/libskey/skey.h +++ b/lib/libskey/skey.h @@ -11,7 +11,7 @@ * * Main client header * - * $Id: skey.h,v 1.1 1995/10/18 08:43:11 deraadt Exp $ + * $Id: skey.h,v 1.2 1995/12/20 09:48:23 deraadt Exp $ */ #if defined(__TURBOC__) || defined(__STDC__) || defined(LATTICE) @@ -61,6 +61,7 @@ void rip __ARGS ((char *buf)); int skeychallenge __ARGS ((struct skey * mp, char *name, char *ss)); int skeylookup __ARGS ((struct skey * mp, char *name)); int skeyverify __ARGS ((struct skey * mp, char *response)); +int skeyzero __ARGS ((struct skey * mp, char *response)); void sevenbit __ARGS ((char *s)); void backspace __ARGS ((char *s)); char *skipspace __ARGS ((char *s)); diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 0c7a7feaa6a..000a61b6200 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -8,7 +8,7 @@ * * S/KEY verification check, lookups, and authentication. * - * $Id: skeylogin.c,v 1.1 1995/10/18 08:43:11 deraadt Exp $ + * $Id: skeylogin.c,v 1.2 1995/12/20 09:48:24 deraadt Exp $ */ #include <sys/param.h> @@ -364,3 +364,31 @@ skey_authenticate (username) } return -1; } + +/* Comment out user's entry in the s/key database + * + * Return codes: + * -1: Write error; database unchanged + * 0: Database updated + * + * The database file is always closed by this call. + */ +int +skeyzero(mp, response) + struct skey *mp; + char *response; +{ + /* + * Seek to the right place and write comment character + * which effectively zero's out the entry. + */ + fseek(mp->keyfile, mp->recstart, 0); + if (fputc('#', mp->keyfile) == EOF) { + fclose(mp->keyfile); + return -1; + } + + fclose(mp->keyfile); + + return 0; +} |