diff options
author | markm <markm@FreeBSD.org> | 2002-03-21 22:50:02 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2002-03-21 22:50:02 +0000 |
commit | da481742fe10db46be0a0f92255f012bcfa3a0a9 (patch) | |
tree | 5c9f598749274986230a9eaa1de3c9dd00eb09b3 /contrib/opie/libopie/writerec.c | |
parent | 3b73ce2319e249cf2795cf4b0d0c624134f01e77 (diff) | |
parent | 4cdfa7814cda254acabe1040a2b2d0c4f5bc4295 (diff) | |
download | FreeBSD-src-da481742fe10db46be0a0f92255f012bcfa3a0a9.zip FreeBSD-src-da481742fe10db46be0a0f92255f012bcfa3a0a9.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r92906,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/opie/libopie/writerec.c')
-rw-r--r-- | contrib/opie/libopie/writerec.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/contrib/opie/libopie/writerec.c b/contrib/opie/libopie/writerec.c index 0843423..5ba53fe 100644 --- a/contrib/opie/libopie/writerec.c +++ b/contrib/opie/libopie/writerec.c @@ -1,13 +1,15 @@ /* writerec.c: The __opiewriterec() library function. %%% copyright-cmetz-96 -This software is Copyright 1996-1998 by Craig Metz, All Rights Reserved. -The Inner Net License Version 2 applies to this software. +This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved. +The Inner Net License Version 3 applies to this software. You should have received a copy of the license with this software. If you didn't get a copy, you may request one from <license@inner.net>. History: + Modified by cmetz for OPIE 2.4. Check that seed and sequence number are + valid. Modified by cmetz for OPIE 2.31. Removed active attack protection support. Fixed passwd bug. Created by cmetz for OPIE 2.3 from passwd.c. @@ -30,6 +32,7 @@ you didn't get a copy, you may request one from <license@inner.net>. #if HAVE_STDLIB_H #include <stdlib.h> #endif /* HAVE_STDLIB_H */ +#include <ctype.h> #include "opie.h" char *__opienone = "****************"; @@ -40,6 +43,7 @@ int __opiewriterec FUNCTION((opie), struct opie *opie) time_t now; FILE *f, *f2 = NULL; int i = 0; + char *c; time(&now); if (strftime(buf2, sizeof(buf2), " %b %d,%Y %T", localtime(&now)) < 1) @@ -51,7 +55,14 @@ int __opiewriterec FUNCTION((opie), struct opie *opie) opie->opie_flags = opie2.opie_flags; opie->opie_recstart = opie2.opie_recstart; } - + + for (c = opie->opie_seed; *c; c++) + if (!isalnum(*c)) + return -1; + + if ((opie->opie_n < 0) || (opie->opie_n > 9999)) + return -1; + switch(i) { case 0: if (!(f = __opieopen(KEY_FILE, 1, 0644))) |