summaryrefslogtreecommitdiffstats
path: root/contrib/opie/libopie/writerec.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/opie/libopie/writerec.c')
-rw-r--r--contrib/opie/libopie/writerec.c17
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)))
OpenPOWER on IntegriCloud