summaryrefslogtreecommitdiff
path: root/usr.bin/skeyinit
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-11-28 18:24:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-11-28 18:24:56 +0000
commit9ded258538048c1f43dc85086860c61c35922e09 (patch)
tree32ddd5f4ef7b436807cb3baba9a4ac548a387c08 /usr.bin/skeyinit
parent5f9bbfc4c0ee0acd7c9daade1225c685ee6b5bdb (diff)
unsigned char for ctype
ok krw okan
Diffstat (limited to 'usr.bin/skeyinit')
-rw-r--r--usr.bin/skeyinit/skeyinit.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/usr.bin/skeyinit/skeyinit.c b/usr.bin/skeyinit/skeyinit.c
index d35c8b3197a..af5a91db982 100644
--- a/usr.bin/skeyinit/skeyinit.c
+++ b/usr.bin/skeyinit/skeyinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: skeyinit.c,v 1.51 2005/07/06 22:15:11 jmc Exp $ */
+/* $OpenBSD: skeyinit.c,v 1.52 2013/11/28 18:24:55 deraadt Exp $ */
/* OpenBSD S/Key (skeyinit.c)
*
@@ -64,11 +64,11 @@ main(int argc, char **argv)
if (gethostname(hostname, sizeof(hostname)) < 0)
err(1, "gethostname");
for (i = 0, p = seed; hostname[i] && i < SKEY_NAMELEN; i++) {
- if (isalpha(hostname[i])) {
- if (isupper(hostname[i]))
- hostname[i] = tolower(hostname[i]);
+ if (isalpha((unsigned char)hostname[i])) {
+ if (isupper((unsigned char)hostname[i]))
+ hostname[i] = tolower((unsigned char)hostname[i]);
*p++ = hostname[i];
- } else if (isdigit(hostname[i]))
+ } else if (isdigit((unsigned char)hostname[i]))
*p++ = hostname[i];
}
noise = arc4random();
@@ -241,10 +241,10 @@ main(int argc, char **argv)
*/
l = strlen(skey.seed);
for (p = skey.seed; *p; p++) {
- if (isalpha(*p)) {
- if (isupper(*p))
- *p = tolower(*p);
- } else if (!isdigit(*p)) {
+ if (isalpha((unsigned char)*p)) {
+ if (isupper((unsigned char)*p))
+ *p = tolower((unsigned char)*p);
+ } else if (!isdigit((unsigned char)*p)) {
memmove(p, p + 1, l - (p - skey.seed));
l--;
}
@@ -253,12 +253,14 @@ main(int argc, char **argv)
/* If the seed ends in 0-8 just add one. */
if (l > 0) {
lastc = skey.seed[l - 1];
- if (isdigit(lastc) && lastc != '9') {
+ if (isdigit((unsigned char)lastc) &&
+ lastc != '9') {
(void)strlcpy(seed, skey.seed,
sizeof seed);
seed[l - 1] = lastc + 1;
}
- if (isdigit(lastc) && lastc == '9' && l < 16) {
+ if (isdigit((unsigned char)lastc) &&
+ lastc == '9' && l < 16) {
(void)strlcpy(seed, skey.seed,
sizeof seed);
seed[l - 1] = '0';
@@ -356,14 +358,14 @@ secure_mode(int *count, char *key, char *seed, size_t seedlen,
continue;
}
for (p = newseed; *p; p++) {
- if (isspace(*p)) {
+ if (isspace((unsigned char)*p)) {
(void)fputs("ERROR: Seed must not contain "
"any spaces\n", stderr);
break;
- } else if (isalpha(*p)) {
- if (isupper(*p))
- *p = tolower(*p);
- } else if (!isdigit(*p)) {
+ } else if (isalpha((unsigned char)*p)) {
+ if (isupper((unsigned char)*p))
+ *p = tolower((unsigned char)*p);
+ } else if (!isdigit((unsigned char)*p)) {
(void)fputs("ERROR: Seed must be purely "
"alphanumeric\n", stderr);
break;
@@ -511,7 +513,7 @@ convert_db(void)
continue;
if ((cp = strtok(NULL, " \t")) == NULL)
continue;
- if (isalpha(*cp)) {
+ if (isalpha((unsigned char)*cp)) {
hashtype = cp;
if ((cp = strtok(NULL, " \t")) == NULL)
continue;