diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-08-08 00:02:23 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-08-08 00:02:23 +0000 |
commit | c5e18c2f33641d513a85b62af9eb11c00cac8c9c (patch) | |
tree | 529768b401fcc9fe909124f1a4190e12fe87e925 | |
parent | 22b9719d0a6091d299d5b64ba0f389a3a52b181b (diff) |
import some changes from portable smtpd to reduce the delta between both.
this commit contains mostly missing casts and cosmethic changes, do not
expect to build this anywhere but on OpenBSD, it does not contain any of
the portable glue.
-rw-r--r-- | usr.sbin/smtpd/aliases.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/dns.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/forward.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/makemap.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/parser.h | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/runner.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 8 | ||||
-rw-r--r-- | usr.sbin/smtpd/store.c | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/util.c | 14 |
10 files changed, 32 insertions, 32 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 8208af69d40..3427ce4bb2e 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.18 2009/05/13 21:20:55 jacekm Exp $ */ +/* $OpenBSD: aliases.c,v 1.19 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -362,7 +362,7 @@ alias_is_username(struct alias *alias, char *line, size_t len) return 0; while (*line) { - if (!isalnum(*line) && + if (!isalnum((int)*line) && *line != '_' && *line != '.' && *line != '-') return 0; ++line; @@ -395,7 +395,7 @@ alias_is_address(struct alias *alias, char *line, size_t len) while (*line) { char allowedset[] = "!#$%*/?|^{}`~&'+-=_."; - if (!isalnum(*line) && + if (!isalnum((int)*line) && strchr(allowedset, *line) == NULL) return 0; ++line; @@ -403,7 +403,7 @@ alias_is_address(struct alias *alias, char *line, size_t len) while (*domain) { char allowedset[] = "-."; - if (!isalnum(*domain) && + if (!isalnum((int)*domain) && strchr(allowedset, *domain) == NULL) return 0; ++domain; diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index 3f59e9f395e..1d85ba5225b 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.14 2009/06/06 04:14:21 pyr Exp $ */ +/* $OpenBSD: dns.c,v 1.15 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -355,7 +355,7 @@ int get_mxlist(char *host, char *self, struct dns **res) { struct mx tab[MAX_MX_COUNT]; - char buf[PACKETSZ], *p, *endp; + unsigned char buf[PACKETSZ], *p, *endp; int ntab, i, ret, type, n, maxprio, cname_ok = 3; int qdcount, ancount; diff --git a/usr.sbin/smtpd/forward.c b/usr.sbin/smtpd/forward.c index fb5decbdd45..7c020ec1828 100644 --- a/usr.sbin/smtpd/forward.c +++ b/usr.sbin/smtpd/forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: forward.c,v 1.13 2009/03/03 23:23:52 gilles Exp $ */ +/* $OpenBSD: forward.c,v 1.14 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -70,7 +70,7 @@ forwards_get(int fd, struct aliaseslist *aliases) cp = buf; do { /* skip whitespace */ - while (isspace(*cp)) + while (isspace((int)*cp)) cp++; /* parse line */ diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index b3e24c5c23e..543f7fafa95 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.61 2009/08/07 20:21:48 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.62 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -1160,7 +1160,7 @@ lka_encode_credentials(char *dst, size_t size, char *user) if ((buflen = asprintf(&buf, "%c%s%c%s", '\0', user, '\0', pass)) == -1) fatal(NULL); - if (__b64_ntop(buf, buflen, dst, size) == -1) { + if (__b64_ntop((unsigned char *)buf, buflen, dst, size) == -1) { free(buf); return 0; } diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index 81bd15943ad..bb940aff167 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.19 2009/07/28 20:51:50 gilles Exp $ */ +/* $OpenBSD: makemap.c,v 1.20 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -225,7 +225,7 @@ parse_entry(char *line, size_t len, size_t lineno) char *valp; keyp = line; - while (isspace(*keyp)) + while (isspace((int)*keyp)) keyp++; if (*keyp == '\0' || *keyp == '#') return 1; @@ -294,14 +294,14 @@ make_aliases(DBT *val, char *text) while ((subrcpt = strsep(&text, ",")) != NULL) { /* subrcpt: strip initial whitespace. */ - while (isspace(*subrcpt)) + while (isspace((int)*subrcpt)) ++subrcpt; if (*subrcpt == '\0') goto error; /* subrcpt: strip trailing whitespace. */ endp = subrcpt + strlen(subrcpt) - 1; - while (subrcpt < endp && isspace(*endp)) + while (subrcpt < endp && isspace((int)*endp)) *endp-- = '\0'; if (! alias_parse(&a, subrcpt)) diff --git a/usr.sbin/smtpd/parser.h b/usr.sbin/smtpd/parser.h index bdee8ddfbbe..e4d9d458d9d 100644 --- a/usr.sbin/smtpd/parser.h +++ b/usr.sbin/smtpd/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.7 2009/02/24 12:07:47 gilles Exp $ */ +/* $OpenBSD: parser.h,v 1.8 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -40,5 +40,5 @@ struct parse_result { }; struct parse_result *parse(int, char *[]); -const struct token *match_token(const char *, const struct token []); -void show_valid_args(const struct token []); +const struct token *match_token(const char *, const struct token *); +void show_valid_args(const struct token *); diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c index 449c8de0f40..7b19b254d4d 100644 --- a/usr.sbin/smtpd/runner.c +++ b/usr.sbin/smtpd/runner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runner.c,v 1.59 2009/08/06 16:46:57 gilles Exp $ */ +/* $OpenBSD: runner.c,v 1.60 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -1090,7 +1090,7 @@ runner_check_loop(struct message *messagep) buf = lbuf; } - if (strchr(buf, ':') == NULL && !isspace(*buf)) + if (strchr(buf, ':') == NULL && !isspace((int)*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 96a1222e0c0..0fb067e7e39 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.112 2009/08/07 21:59:01 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.113 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -194,7 +194,7 @@ session_rfc4954_auth_plain(struct session *s, char *arg) case S_AUTH_INIT: /* String is not NUL terminated, leave room. */ - if ((len = __b64_pton(arg, buf, sizeof(buf) - 1)) == -1) + if ((len = __b64_pton(arg, (unsigned char *)buf, sizeof(buf) - 1)) == -1) goto abort; /* buf is a byte string, NUL terminate. */ buf[len] = '\0'; @@ -247,7 +247,7 @@ session_rfc4954_auth_login(struct session *s, char *arg) case S_AUTH_USERNAME: bzero(a->user, sizeof(a->user)); - if (__b64_pton(arg, a->user, sizeof(a->user) - 1) == -1) + if (__b64_pton(arg, (unsigned char *)a->user, sizeof(a->user) - 1) == -1) goto abort; s->s_state = S_AUTH_PASSWORD; @@ -256,7 +256,7 @@ session_rfc4954_auth_login(struct session *s, char *arg) case S_AUTH_PASSWORD: bzero(a->pass, sizeof(a->pass)); - if (__b64_pton(arg, a->pass, sizeof(a->pass) - 1) == -1) + if (__b64_pton(arg, (unsigned char *)a->pass, sizeof(a->pass) - 1) == -1) goto abort; s->s_state = S_AUTH_FINALIZE; diff --git a/usr.sbin/smtpd/store.c b/usr.sbin/smtpd/store.c index 6f256833f91..3c9f32ec531 100644 --- a/usr.sbin/smtpd/store.c +++ b/usr.sbin/smtpd/store.c @@ -1,4 +1,4 @@ -/* $OpenBSD: store.c,v 1.24 2009/08/06 16:29:35 gilles Exp $ */ +/* $OpenBSD: store.c,v 1.25 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -66,7 +66,7 @@ file_copy(FILE *dest, FILE *src, struct path *path, enum action_type type, int s * add the Delivered-To header to help loop detection. */ if (!session && path != NULL && inheaders && - strchr(buf, ':') == NULL && !isspace(*buf)) { + strchr(buf, ':') == NULL && !isspace((int)*buf)) { if (fprintf(dest, "Delivered-To: %s@%s\n", path->user, path->domain) == -1) return 0; diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 066febf9b75..8abaffa61df 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.23 2009/08/06 14:12:48 gilles Exp $ */ +/* $OpenBSD: util.c,v 1.24 2009/08/08 00:02:22 gilles Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -86,12 +86,12 @@ hostname_match(char *hostname, char *pattern) while (*pattern == '*') pattern++; while (*hostname != '\0' && - tolower(*hostname) != tolower(*pattern)) + tolower((int)*hostname) != tolower((int)*pattern)) hostname++; continue; } - if (tolower(*pattern) != tolower(*hostname)) + if (tolower((int)*pattern) != tolower((int)*hostname)) return 0; pattern++; hostname++; @@ -137,7 +137,7 @@ recipient_to_path(struct path *path, char *recipient) int valid_localpart(char *s) { -#define IS_ATEXT(c) (isalnum(c) || strchr("!#$%&'*+-/=?^_`{|}~", (c))) +#define IS_ATEXT(c) (isalnum((int)(c)) || strchr("!#$%&'*+-/=?^_`{|}~", (c))) nextatom: if (! IS_ATEXT(*s) || *s == '\0') return 0; @@ -159,12 +159,12 @@ int valid_domainpart(char *s) { nextsub: - if (!isalnum(*s)) + if (!isalnum((int)*s)) return 0; while (*(++s) != '\0') { if (*s == '.') break; - if (isalnum(*s) || *s == '-') + if (isalnum((int)*s) || *s == '-') continue; return 0; } @@ -363,7 +363,7 @@ lowercase(char *buf, char *s, size_t len) fatalx("lowercase: truncation"); while (*buf != '\0') { - *buf = tolower(*buf); + *buf = tolower((int)*buf); buf++; } } |