openbsd-ports/security/stel/patches/patch-stel_makeio_c

81 lines
2.0 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-stel_makeio_c,v 1.1 2001/09/29 21:27:50 naddy Exp $
--- stel/makeio.c.orig Fri Apr 26 18:29:27 1996
+++ stel/makeio.c Sat Sep 29 22:55:22 2001
@@ -21,7 +21,8 @@ static char *rcsid = "@(#) $Id: makeio.c
1998-11-18 22:22:35 -05:00
#include <sys/time.h>
#include <netinet/in.h>
#include <pwd.h>
-#include "regex.h"
+#include <time.h>
+#include <regex.h>
#ifdef HAS_SYS_PARAM_H
#include <sys/param.h>
@@ -33,7 +34,7 @@ static char *rcsid = "@(#) $Id: makeio.c
1998-11-18 22:22:35 -05:00
#endif
#endif
-#include "skey.h"
+#include <skey.h>
#include "defs.h"
#define ESCAPE_CMD "escape"
@@ -74,7 +75,7 @@ long crc32val;
1998-11-18 22:22:35 -05:00
#define CONTROL(x) ((x) & 0x1f) /* CTRL(x) is not portable */
static int escape = CONTROL(']');
static long oldmask;
-static long start;
+static time_t start;
static char skeybuf[SKEYBUFSIZE];
static unsigned long userstrokes, traffic, xfertraffic;
@@ -364,7 +365,15 @@ int *len;
1998-11-18 22:22:35 -05:00
p = (char *)strtok(line +
strlen(LOG_CMD), " \t");
- strcpy(logfilename, p ? p : tmpnam(NULL));
+ if (p) {
+ strcpy(logfilename, p);
+ } else {
+ strncpy(logfilename,"/tmp/stel.XXXXXXXXXX",256);
+ if (mkstemp(logfilename) == -1) {
+ perror(logfilename);
+ break;
+ }
+ }
if ((logfh = open(logfilename,
O_WRONLY | O_CREAT, 0600)) == -1) {
perror(logfilename);
@@ -650,6 +659,9 @@ int automjr;
1998-11-29 04:50:32 -05:00
printf("\n");
if ((char *)getenv("SKEYPADFILE") != NULL) {
+/*
+ * We are not using mjr's des mode. Don't bother asking.
+ *
if (automjr) {
cprintf("(using mjr DES padding mode)\n");
cprintf("using skeypadfile %s\n",
@@ -666,17 +678,18 @@ int automjr;
1998-11-29 04:50:32 -05:00
if (buf[0] == 'y')
desmode = 1;
}
+*/
1998-11-18 22:22:35 -05:00
}
/* Crunch seed and password into starting key */
- if(desmode ? deskeycrunch(key, seed, passwd) :
- keycrunch(key,seed,passwd) != 0) {
+ /* OpenBSD does not have deskeycrunch */
+ if(keycrunch(key,seed,passwd) != 0) {
cprintf("key crunch failed\n");
return(NULL);
}
while(n-- != 0)
- fff(key);
+ f(key);
btoe(buf, key);
return(buf);
}