diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2013-11-28 10:43:38 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2013-11-28 10:43:38 +0000 |
commit | 8d074eb11320c5e14996064a677523c907e1dfd1 (patch) | |
tree | 3922996cc6075d21392836f41785a60dc1aca9ad /usr.sbin | |
parent | 19bc84d79ce7b47d563a97481a0f3b8cc28fea9b (diff) |
unsigned char casts for ctype
ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/enqueue.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/envelope.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/makemap.c | 12 | ||||
-rw-r--r-- | usr.sbin/smtpd/mda.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/mta_session.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/table_ldap.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/table_sqlite.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/table_static.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/to.c | 14 | ||||
-rw-r--r-- | usr.sbin/smtpd/util.c | 20 |
11 files changed, 50 insertions, 46 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index cfbc4da1436..6c137253ab1 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.71 2013/11/26 15:52:16 henning Exp $ */ +/* $OpenBSD: enqueue.c,v 1.72 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2005 Henning Brauer <henning@bulabula.org> @@ -147,7 +147,7 @@ qp_encoded_write(FILE *fp, char *buf, size_t len) else fprintf(fp, "%c", *buf & 0xff); } - else if (! isprint(*buf) && *buf != '\n') + else if (! isprint((unsigned char)*buf) && *buf != '\n') fprintf(fp, "=%2X", *buf & 0xff); else fprintf(fp, "%c", *buf); @@ -467,7 +467,7 @@ build_from(char *fake_from, struct passwd *pw) pw->pw_name, len - apos - 1, p + 1) == -1) err(1, NULL); - msg.fromname[apos] = toupper(msg.fromname[apos]); + msg.fromname[apos] = toupper((unsigned char)msg.fromname[apos]); } else { if (asprintf(&msg.fromname, "%.*s", len, pw->pw_gecos) == -1) diff --git a/usr.sbin/smtpd/envelope.c b/usr.sbin/smtpd/envelope.c index 9f8489f22ea..f0ce14e3035 100644 --- a/usr.sbin/smtpd/envelope.c +++ b/usr.sbin/smtpd/envelope.c @@ -1,4 +1,4 @@ -/* $OpenBSD: envelope.c,v 1.23 2013/11/18 11:47:16 eric Exp $ */ +/* $OpenBSD: envelope.c,v 1.24 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -86,13 +86,13 @@ envelope_buffer_to_dict(struct dict *d, const char *ibuf, size_t buflen) buflen -= (nextline - buf); field = buf; - while (*buf && (isalnum(*buf) || *buf == '-')) + while (*buf && (isalnum((unsigned char)*buf) || *buf == '-')) buf++; if (! *buf) goto err; /* skip whitespaces before separator */ - while (*buf && isspace(*buf)) + while (*buf && isspace((unsigned char)*buf)) *buf++ = 0; /* we *want* ':' */ @@ -101,7 +101,7 @@ envelope_buffer_to_dict(struct dict *d, const char *ibuf, size_t buflen) *buf++ = 0; /* skip whitespaces after separator */ - while (*buf && isspace(*buf)) + while (*buf && isspace((unsigned char)*buf)) *buf++ = 0; dict_set(d, field, buf); buf = nextline; diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index 74d58897427..ccfbbb20a2c 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.46 2013/10/29 10:50:55 eric Exp $ */ +/* $OpenBSD: makemap.c,v 1.47 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -283,7 +283,7 @@ parse_mapentry(char *line, size_t len, size_t lineno) char *valp; keyp = line; - while (isspace((int)*keyp)) + while (isspace((unsigned char)*keyp)) keyp++; if (*keyp == '\0' || *keyp == '#') return 1; @@ -292,7 +292,7 @@ parse_mapentry(char *line, size_t len, size_t lineno) strsep(&valp, " \t:"); if (valp == NULL || valp == keyp) goto bad; - while (*valp == ':' || isspace((int)*valp)) + while (*valp == ':' || isspace((unsigned char)*valp)) valp++; if (*valp == '\0' || *valp == '#') goto bad; @@ -340,7 +340,7 @@ parse_setentry(char *line, size_t len, size_t lineno) char *keyp; keyp = line; - while (isspace((int)*keyp)) + while (isspace((unsigned char)*keyp)) keyp++; if (*keyp == '\0' || *keyp == '#') return 1; @@ -391,14 +391,14 @@ make_aliases(DBT *val, char *text) while ((subrcpt = strsep(&text, ",")) != NULL) { /* subrcpt: strip initial whitespace. */ - while (isspace((int)*subrcpt)) + while (isspace((unsigned char)*subrcpt)) ++subrcpt; if (*subrcpt == '\0') goto error; /* subrcpt: strip trailing whitespace. */ endp = subrcpt + strlen(subrcpt) - 1; - while (subrcpt < endp && isspace((int)*endp)) + while (subrcpt < endp && isspace((unsigned char)*endp)) *endp-- = '\0'; if (! text_to_expandnode(&xn, subrcpt)) diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index cdd4692e3c7..652f7597faa 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.98 2013/11/20 09:22:42 eric Exp $ */ +/* $OpenBSD: mda.c,v 1.99 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -599,7 +599,7 @@ mda_check_loop(FILE *fp, struct mda_envelope *e) buf = lbuf; } - if (strchr(buf, ':') == NULL && !isspace((int)*buf)) + if (strchr(buf, ':') == NULL && !isspace((unsigned char)*buf)) break; if (strncasecmp("Delivered-To: ", buf, 14) == 0) { diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 8dc1f795ce4..d1c569c5ddb 100644 --- a/usr.sbin/smtpd/mta_session.c +++ b/usr.sbin/smtpd/mta_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta_session.c,v 1.47 2013/11/18 12:24:26 eric Exp $ */ +/* $OpenBSD: mta_session.c,v 1.48 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -1484,7 +1484,7 @@ mta_check_loop(FILE *fp) buf = lbuf; } - if (strchr(buf, ':') == NULL && !isspace((int)*buf)) + if (strchr(buf, ':') == NULL && !isspace((unsigned char)*buf)) break; if (strncasecmp("Received: ", buf, 10) == 0) { diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 08df9e41e1a..04b021c7369 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.189 2013/11/18 12:24:26 eric Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.190 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -959,7 +959,7 @@ smtp_command(struct smtp_session *s, char *line) if (args) { *args++ = '\0'; - while (isspace((int)*args)) + while (isspace((unsigned char)*args)) args++; } diff --git a/usr.sbin/smtpd/table_ldap.c b/usr.sbin/smtpd/table_ldap.c index 5d2c77ffe58..8a3b9ef6f56 100644 --- a/usr.sbin/smtpd/table_ldap.c +++ b/usr.sbin/smtpd/table_ldap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_ldap.c,v 1.6 2013/07/22 13:14:49 eric Exp $ */ +/* $OpenBSD: table_ldap.c,v 1.7 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -310,7 +310,7 @@ ldap_config(void) } key = buf; - while (isspace((int)*key)) + while (isspace((unsigned char)*key)) ++key; if (*key == '\0' || *key == '#') continue; @@ -318,8 +318,8 @@ ldap_config(void) strsep(&value, " \t:"); if (value) { while (*value) { - if (!isspace(*value) && - !(*value == ':' && isspace(*(value + 1)))) + if (!isspace((unsigned char)*value) && + !(*value == ':' && isspace((unsigned char)*(value + 1)))) break; ++value; } diff --git a/usr.sbin/smtpd/table_sqlite.c b/usr.sbin/smtpd/table_sqlite.c index 847c409c2ad..00d2c03a6da 100644 --- a/usr.sbin/smtpd/table_sqlite.c +++ b/usr.sbin/smtpd/table_sqlite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_sqlite.c,v 1.9 2013/11/18 11:47:16 eric Exp $ */ +/* $OpenBSD: table_sqlite.c,v 1.10 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -207,7 +207,7 @@ table_sqlite_update(void) } key = buf; - while (isspace((int)*key)) + while (isspace((unsigned char)*key)) ++key; if (*key == '\0' || *key == '#') continue; @@ -215,8 +215,8 @@ table_sqlite_update(void) strsep(&value, " \t:"); if (value) { while (*value) { - if (!isspace(*value) && - !(*value == ':' && isspace(*(value + 1)))) + if (!isspace((unsigned char)*value) && + !(*value == ':' && isspace((unsigned char)*(value + 1)))) break; ++value; } diff --git a/usr.sbin/smtpd/table_static.c b/usr.sbin/smtpd/table_static.c index 74328fcce8c..a8d8411712c 100644 --- a/usr.sbin/smtpd/table_static.c +++ b/usr.sbin/smtpd/table_static.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_static.c,v 1.7 2013/11/18 11:47:16 eric Exp $ */ +/* $OpenBSD: table_static.c,v 1.8 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot <eric@openbsd.org> @@ -103,7 +103,7 @@ table_static_parse(struct table *t, const char *config, enum table_type type) } keyp = buf; - while (isspace((int)*keyp)) + while (isspace((unsigned char)*keyp)) ++keyp; if (*keyp == '\0' || *keyp == '#') continue; @@ -111,8 +111,8 @@ table_static_parse(struct table *t, const char *config, enum table_type type) strsep(&valp, " \t:"); if (valp) { while (*valp) { - if (!isspace(*valp) && - !(*valp == ':' && isspace(*(valp + 1)))) + if (!isspace((unsigned char)*valp) && + !(*valp == ':' && isspace((unsigned char)*(valp + 1)))) break; ++valp; } diff --git a/usr.sbin/smtpd/to.c b/usr.sbin/smtpd/to.c index b9da9be0274..d4a5809e19c 100644 --- a/usr.sbin/smtpd/to.c +++ b/usr.sbin/smtpd/to.c @@ -1,4 +1,4 @@ -/* $OpenBSD: to.c,v 1.12 2013/11/06 10:01:29 eric Exp $ */ +/* $OpenBSD: to.c,v 1.13 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net> @@ -744,7 +744,7 @@ alias_is_username(struct expandnode *alias, const char *line, size_t len) return 0; while (*line) { - if (!isalnum((int)*line) && + if (!isalnum((unsigned char)*line) && *line != '_' && *line != '.' && *line != '-') return 0; ++line; @@ -780,7 +780,7 @@ alias_is_address(struct expandnode *alias, const char *line, size_t len) while (*line) { char allowedset[] = "!#$%*/?|^{}`~&'+-=_."; - if (!isalnum((int)*line) && + if (!isalnum((unsigned char)*line) && strchr(allowedset, *line) == NULL) return 0; ++line; @@ -788,7 +788,7 @@ alias_is_address(struct expandnode *alias, const char *line, size_t len) while (*domain) { char allowedset[] = "-."; - if (!isalnum((int)*domain) && + if (!isalnum((unsigned char)*domain) && strchr(allowedset, *domain) == NULL) return 0; ++domain; @@ -856,9 +856,11 @@ alias_is_error(struct expandnode *alias, const char *line, size_t len) return 0; /* [45][0-9]{2} [a-zA-Z0-9].* */ - if (alias->u.buffer[3] != ' ' || !isalnum(alias->u.buffer[4]) || + if (alias->u.buffer[3] != ' ' || + !isalnum((unsigned char)alias->u.buffer[4]) || (alias->u.buffer[0] != '4' && alias->u.buffer[0] != '5') || - !isdigit(alias->u.buffer[1]) || !isdigit(alias->u.buffer[2])) + !isdigit((unsigned char)alias->u.buffer[1]) || + !isdigit((unsigned char)alias->u.buffer[2])) return 0; alias->type = EXPAND_ERROR; diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 3476ce93b19..34fa5ba002a 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.102 2013/11/19 10:22:42 eric Exp $ */ +/* $OpenBSD: util.c,v 1.103 2013/11/28 10:43:37 eric Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -424,12 +424,14 @@ hostname_match(const char *hostname, const char *pattern) while (*pattern == '*') pattern++; while (*hostname != '\0' && - tolower((int)*hostname) != tolower((int)*pattern)) + tolower((unsigned char)*hostname) != + tolower((unsigned char)*pattern)) hostname++; continue; } - if (tolower((int)*pattern) != tolower((int)*hostname)) + if (tolower((unsigned char)*pattern) != + tolower((unsigned char)*hostname)) return 0; pattern++; hostname++; @@ -445,7 +447,7 @@ valid_localpart(const char *s) * RFC 5322 defines theses characters as valid: !#$%&'*+-/=?^_`{|}~ * some of them are potentially dangerous, and not so used after all. */ -#define IS_ATEXT(c) (isalnum((int)(c)) || strchr("*!%+-/=_", (c))) +#define IS_ATEXT(c) (isalnum((unsigned char)(c)) || strchr("*!%+-/=_", (c))) nextatom: if (! IS_ATEXT(*s) || *s == '\0') return 0; @@ -495,12 +497,12 @@ valid_domainpart(const char *s) } nextsub: - if (!isalnum((int)*s)) + if (!isalnum((unsigned char)*s)) return 0; while (*(++s) != '\0') { if (*s == '.') break; - if (isalnum((int)*s) || *s == '-') + if (isalnum((unsigned char)*s) || *s == '-') continue; return 0; } @@ -604,7 +606,7 @@ lowercase(char *buf, const char *s, size_t len) return 0; while (*buf != '\0') { - *buf = tolower((int)*buf); + *buf = tolower((unsigned char)*buf); buf++; } @@ -621,7 +623,7 @@ uppercase(char *buf, const char *s, size_t len) return 0; while (*buf != '\0') { - *buf = toupper((int)*buf); + *buf = toupper((unsigned char)*buf); buf++; } @@ -737,7 +739,7 @@ parse_smtp_response(char *line, size_t len, char **msg, int *cont) /* validate reply message */ for (i = 0; i < len; i++) - if (!isprint(line[i])) + if (!isprint((unsigned char)line[i])) return "non-printable character in reply"; return NULL; |