summaryrefslogtreecommitdiffstats
path: root/lib/libskey
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2002-06-22 02:13:08 +0000
committerderaadt <deraadt@openbsd.org>2002-06-22 02:13:08 +0000
commit2cab24aa6be95edf147d8769d70362d1c9a9eea7 (patch)
treed8f945d61528b0590bc60854948278af068dba28 /lib/libskey
parentcorrect comment (diff)
downloadwireguard-openbsd-2cab24aa6be95edf147d8769d70362d1c9a9eea7.tar.xz
wireguard-openbsd-2cab24aa6be95edf147d8769d70362d1c9a9eea7.zip
use strtok_r() instead of strtok(); millert ok
Diffstat (limited to 'lib/libskey')
-rw-r--r--lib/libskey/put.c5
-rw-r--r--lib/libskey/skeylogin.c26
2 files changed, 16 insertions, 15 deletions
diff --git a/lib/libskey/put.c b/lib/libskey/put.c
index 9b95a6be39c..0876138ad1b 100644
--- a/lib/libskey/put.c
+++ b/lib/libskey/put.c
@@ -8,7 +8,7 @@
*
* Dictionary lookup and extraction.
*
- * $OpenBSD: put.c,v 1.11 2002/02/16 21:27:27 millert Exp $
+ * $OpenBSD: put.c,v 1.12 2002/06/22 02:13:10 deraadt Exp $
*/
#include <stdio.h>
@@ -373,6 +373,7 @@ etob(out, e)
int i, p, v, l, low, high;
char b[SKEY_BINKEY_SIZE+1];
char input[36];
+ char *last;
if (e == NULL)
return(-1);
@@ -382,7 +383,7 @@ etob(out, e)
(void)memset(b, 0, sizeof(b));
(void)memset(out, 0, SKEY_BINKEY_SIZE);
for (i = 0, p = 0; i < 6; i++, p += 11) {
- if ((word = strtok(i == 0 ? input : NULL, " ")) == NULL)
+ if ((word = strtok_r(i == 0 ? input : NULL, " ", &last)) == NULL)
return(-1);
l = strlen(word);
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c
index c967b661241..b8533ca4fd6 100644
--- a/lib/libskey/skeylogin.c
+++ b/lib/libskey/skeylogin.c
@@ -10,7 +10,7 @@
*
* S/Key verification check, lookups, and authentication.
*
- * $OpenBSD: skeylogin.c,v 1.45 2002/05/24 21:32:56 deraadt Exp $
+ * $OpenBSD: skeylogin.c,v 1.46 2002/06/22 02:13:10 deraadt Exp $
*/
#include <sys/param.h>
@@ -89,7 +89,7 @@ skeylookup(mp, name)
{
struct stat statbuf;
size_t nread;
- char *cp, filename[PATH_MAX];
+ char *cp, filename[PATH_MAX], *last;
FILE *keyfile;
int fd;
@@ -141,19 +141,19 @@ skeylookup(mp, name)
goto bad_keyfile;
mp->buf[nread - 1] = '\0';
- if ((mp->logname = strtok(mp->buf, " \t\n\r")) == NULL ||
+ if ((mp->logname = strtok_r(mp->buf, " \t\n\r", &last)) == NULL ||
strcmp(mp->logname, name) != 0)
goto bad_keyfile;
- if ((cp = strtok(NULL, " \t\n\r")) == NULL)
+ if ((cp = strtok_r(NULL, " \t\n\r", &last)) == NULL)
goto bad_keyfile;
if (skey_set_algorithm(cp) == NULL)
goto bad_keyfile;
- if ((cp = strtok(NULL, " \t\n\r")) == NULL)
+ if ((cp = strtok_r(NULL, " \t\n\r", &last)) == NULL)
goto bad_keyfile;
mp->n = atoi(cp); /* XXX - use strtol() */
- if ((mp->seed = strtok(NULL, " \t\n\r")) == NULL)
+ if ((mp->seed = strtok_r(NULL, " \t\n\r", &last)) == NULL)
goto bad_keyfile;
- if ((mp->val = strtok(NULL, " \t\n\r")) == NULL)
+ if ((mp->val = strtok_r(NULL, " \t\n\r", &last)) == NULL)
goto bad_keyfile;
(void)fseek(keyfile, 0L, SEEK_SET);
@@ -232,7 +232,7 @@ skeyverify(mp, response)
char fkey[SKEY_BINKEY_SIZE];
char filekey[SKEY_BINKEY_SIZE];
size_t nread;
- char *cp;
+ char *cp, *last;
if (response == NULL)
goto verify_failure;
@@ -262,15 +262,15 @@ skeyverify(mp, response)
if ((nread = fread(mp->buf, 1, sizeof(mp->buf), mp->keyfile)) == 0 ||
!isspace(mp->buf[nread - 1]))
goto verify_failure;
- if ((mp->logname = strtok(mp->buf, " \t\r\n")) == NULL)
+ if ((mp->logname = strtok_r(mp->buf, " \t\r\n", &last)) == NULL)
goto verify_failure;
- if ((cp = strtok(NULL, " \t\r\n")) == NULL)
+ if ((cp = strtok_r(NULL, " \t\r\n", &last)) == NULL)
goto verify_failure;
- if ((cp = strtok(NULL, " \t\r\n")) == NULL)
+ if ((cp = strtok_r(NULL, " \t\r\n", &last)) == NULL)
goto verify_failure;
- if ((mp->seed = strtok(NULL, " \t\r\n")) == NULL)
+ if ((mp->seed = strtok_r(NULL, " \t\r\n", &last)) == NULL)
goto verify_failure;
- if ((mp->val = strtok(NULL, " \t\r\n")) == NULL)
+ if ((mp->val = strtok_r(NULL, " \t\r\n", &last)) == NULL)
goto verify_failure;
/* Convert file value to hex and compare. */