From 953aae25ff871c01f84712ab2678509b9f716091 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 20 Jan 2015 17:37:54 +0000 Subject: [PATCH] use comprehensively. For now try to push <> includes to each .c file, and out of the .h files. To avoid overinclude. ok gilles, in principle. If this has been done right, -portable should become easier to maintain. --- usr.sbin/smtpd/aldap.h | 3 +- usr.sbin/smtpd/aliases.c | 7 +-- usr.sbin/smtpd/bounce.c | 9 ++-- usr.sbin/smtpd/ca.c | 4 +- usr.sbin/smtpd/compress_backend.c | 3 +- usr.sbin/smtpd/compress_gzip.c | 3 +- usr.sbin/smtpd/control.c | 5 +- usr.sbin/smtpd/delivery.c | 3 +- usr.sbin/smtpd/delivery_filename.c | 3 +- usr.sbin/smtpd/delivery_lmtp.c | 6 ++- usr.sbin/smtpd/delivery_maildir.c | 5 +- usr.sbin/smtpd/delivery_mbox.c | 3 +- usr.sbin/smtpd/delivery_mda.c | 3 +- usr.sbin/smtpd/dict.c | 4 +- usr.sbin/smtpd/dns.c | 5 +- usr.sbin/smtpd/enqueue.c | 9 ++-- usr.sbin/smtpd/esc.c | 9 +++- usr.sbin/smtpd/expand.c | 7 +-- usr.sbin/smtpd/filter_api.c | 8 +-- usr.sbin/smtpd/forward.c | 3 +- usr.sbin/smtpd/iobuf.h | 6 +-- usr.sbin/smtpd/limit.c | 3 +- usr.sbin/smtpd/lka.c | 4 +- usr.sbin/smtpd/lka_session.c | 3 +- usr.sbin/smtpd/makemap.c | 4 +- usr.sbin/smtpd/mda.c | 15 +++--- usr.sbin/smtpd/mta.c | 16 +++--- usr.sbin/smtpd/mta_session.c | 12 ++--- usr.sbin/smtpd/parse.y | 6 +-- usr.sbin/smtpd/pony.c | 3 +- usr.sbin/smtpd/queue.c | 5 +- usr.sbin/smtpd/queue_api.c | 8 ++- usr.sbin/smtpd/queue_backend.c | 4 +- usr.sbin/smtpd/queue_fs.c | 32 ++++++------ usr.sbin/smtpd/queue_null.c | 3 +- usr.sbin/smtpd/queue_proc.c | 3 +- usr.sbin/smtpd/queue_ram.c | 3 +- usr.sbin/smtpd/ruleset.c | 3 +- usr.sbin/smtpd/runq.c | 4 +- usr.sbin/smtpd/scheduler.c | 3 +- usr.sbin/smtpd/scheduler_api.c | 8 ++- usr.sbin/smtpd/scheduler_backend.c | 3 +- usr.sbin/smtpd/scheduler_null.c | 3 +- usr.sbin/smtpd/scheduler_proc.c | 3 +- usr.sbin/smtpd/scheduler_ramqueue.c | 3 +- usr.sbin/smtpd/smtp.c | 4 +- usr.sbin/smtpd/smtp_session.c | 28 +++++------ usr.sbin/smtpd/smtpctl.c | 9 ++-- usr.sbin/smtpd/smtpd-api.h | 11 +---- usr.sbin/smtpd/smtpd-defines.h | 7 +-- usr.sbin/smtpd/smtpd.c | 20 ++++---- usr.sbin/smtpd/smtpd.h | 76 ++++++++++++++--------------- usr.sbin/smtpd/stat_backend.c | 3 +- usr.sbin/smtpd/stat_ramstat.c | 3 +- usr.sbin/smtpd/table.c | 16 +++--- usr.sbin/smtpd/table_api.c | 9 +++- usr.sbin/smtpd/table_db.c | 6 +-- usr.sbin/smtpd/table_getpwnam.c | 3 +- usr.sbin/smtpd/table_ldap.c | 10 +++- usr.sbin/smtpd/table_passwd.c | 8 ++- usr.sbin/smtpd/table_proc.c | 3 +- usr.sbin/smtpd/table_sqlite.c | 9 +++- usr.sbin/smtpd/table_static.c | 3 +- usr.sbin/smtpd/to.c | 10 ++-- usr.sbin/smtpd/tree.c | 3 +- usr.sbin/smtpd/util.c | 10 ++-- usr.sbin/smtpd/waitq.c | 4 +- 67 files changed, 293 insertions(+), 224 deletions(-) diff --git a/usr.sbin/smtpd/aldap.h b/usr.sbin/smtpd/aldap.h index aee46d24796..ae716bcede1 100644 --- a/usr.sbin/smtpd/aldap.h +++ b/usr.sbin/smtpd/aldap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aldap.h,v 1.4 2013/06/03 15:53:48 eric Exp $ */ +/* $OpenBSD: aldap.h,v 1.5 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Alexander Schrijver @@ -17,7 +17,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include "ber.h" #define LDAP_URL "ldap://" diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 8070ae84581..0b260f58cf6 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.65 2014/07/08 13:49:09 eric Exp $ */ +/* $OpenBSD: aliases.c,v 1.66 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "smtpd.h" @@ -77,7 +78,7 @@ aliases_get(struct expand *expand, const char *username) int aliases_virtual_check(struct table *table, const struct mailaddr *maddr) { - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; char *pbuf; int ret; @@ -123,7 +124,7 @@ aliases_virtual_get(struct expand *expand, const struct mailaddr *maddr) { struct expandnode *xn; union lookup lk; - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; char *pbuf; int nbaliases; int ret; diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c index 10cf5e678f8..ac6f84fef20 100644 --- a/usr.sbin/smtpd/bounce.c +++ b/usr.sbin/smtpd/bounce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bounce.c,v 1.65 2014/05/28 10:34:16 daniel Exp $ */ +/* $OpenBSD: bounce.c,v 1.66 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2009 Gilles Chehade @@ -35,6 +35,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" @@ -122,7 +123,7 @@ bounce_init(void) void bounce_add(uint64_t evpid) { - char buf[SMTPD_MAXLINESIZE], *line; + char buf[LINE_MAX], *line; struct envelope evp; struct bounce_message key, *msg; struct bounce_envelope *be; @@ -340,7 +341,7 @@ static int bounce_next_message(struct bounce_session *s) { struct bounce_message *msg; - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; int fd; time_t now; @@ -647,7 +648,7 @@ bounce_io(struct io *io, int evt) case IO_DATAIN: nextline: line = iobuf_getline(&s->iobuf, &len); - if (line == NULL && iobuf_len(&s->iobuf) >= SMTPD_MAXLINESIZE) { + if (line == NULL && iobuf_len(&s->iobuf) >= LINE_MAX) { bounce_status(s, "Input too long"); bounce_free(s); return; diff --git a/usr.sbin/smtpd/ca.c b/usr.sbin/smtpd/ca.c index 932cf8afee4..ccfae188398 100644 --- a/usr.sbin/smtpd/ca.c +++ b/usr.sbin/smtpd/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.13 2015/01/16 06:40:20 deraadt Exp $ */ +/* $OpenBSD: ca.c,v 1.14 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2014 Reyk Floeter @@ -20,12 +20,14 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include diff --git a/usr.sbin/smtpd/compress_backend.c b/usr.sbin/smtpd/compress_backend.c index 08ac9665a32..516dd1ee6dc 100644 --- a/usr.sbin/smtpd/compress_backend.c +++ b/usr.sbin/smtpd/compress_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compress_backend.c,v 1.8 2013/05/24 17:03:14 eric Exp $ */ +/* $OpenBSD: compress_backend.c,v 1.9 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Charles Longeau @@ -28,6 +28,7 @@ #include #include #include +#include #include "smtpd.h" diff --git a/usr.sbin/smtpd/compress_gzip.c b/usr.sbin/smtpd/compress_gzip.c index e601137f1f2..c0a85d03d74 100644 --- a/usr.sbin/smtpd/compress_gzip.c +++ b/usr.sbin/smtpd/compress_gzip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compress_gzip.c,v 1.7 2013/05/24 17:03:14 eric Exp $ */ +/* $OpenBSD: compress_gzip.c,v 1.8 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -32,6 +32,7 @@ #include #include #include +#include #include diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c index d13501b6b50..3e203fce219 100644 --- a/usr.sbin/smtpd/control.c +++ b/usr.sbin/smtpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.101 2014/07/10 15:54:55 eric Exp $ */ +/* $OpenBSD: control.c,v 1.102 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -37,6 +37,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" @@ -748,7 +749,7 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg) /* table name too long */ len = strlen(imsg->data); - if (len >= SMTPD_MAXLINESIZE) + if (len >= LINE_MAX) goto invalid; m_forward(p_lka, imsg); diff --git a/usr.sbin/smtpd/delivery.c b/usr.sbin/smtpd/delivery.c index bc693e86035..f2537cd44fc 100644 --- a/usr.sbin/smtpd/delivery.c +++ b/usr.sbin/smtpd/delivery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery.c,v 1.5 2014/04/01 09:00:46 gilles Exp $ */ +/* $OpenBSD: delivery.c,v 1.6 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -29,6 +29,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/delivery_filename.c b/usr.sbin/smtpd/delivery_filename.c index e5fb145b8fa..41d879869df 100644 --- a/usr.sbin/smtpd/delivery_filename.c +++ b/usr.sbin/smtpd/delivery_filename.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_filename.c,v 1.11 2015/01/11 11:49:36 gilles Exp $ */ +/* $OpenBSD: delivery_filename.c,v 1.12 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -34,6 +34,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/delivery_lmtp.c b/usr.sbin/smtpd/delivery_lmtp.c index 381d7328026..162ff6018c3 100644 --- a/usr.sbin/smtpd/delivery_lmtp.c +++ b/usr.sbin/smtpd/delivery_lmtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_lmtp.c,v 1.6 2014/04/19 17:24:59 gilles Exp $ */ +/* $OpenBSD: delivery_lmtp.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Ashish SHUKLA @@ -17,9 +17,9 @@ */ #include +#include #include #include -#include #include #include @@ -28,10 +28,12 @@ #include #include #include +#include #include #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/delivery_maildir.c b/usr.sbin/smtpd/delivery_maildir.c index 86704bbea47..bb03c003135 100644 --- a/usr.sbin/smtpd/delivery_maildir.c +++ b/usr.sbin/smtpd/delivery_maildir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_maildir.c,v 1.15 2014/05/10 21:50:40 chl Exp $ */ +/* $OpenBSD: delivery_maildir.c,v 1.16 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -34,6 +34,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" @@ -73,7 +74,7 @@ mailaddr_tag(const struct mailaddr *maddr, char *dest, size_t len) static void delivery_maildir_open(struct deliver *deliver) { - char tmp[SMTPD_MAXPATHLEN], new[SMTPD_MAXPATHLEN], tag[SMTPD_MAXPATHLEN]; + char tmp[PATH_MAX], new[PATH_MAX], tag[PATH_MAX]; int ch, fd; FILE *fp; char *msg; diff --git a/usr.sbin/smtpd/delivery_mbox.c b/usr.sbin/smtpd/delivery_mbox.c index 19cc61e77c4..8fd883cd17e 100644 --- a/usr.sbin/smtpd/delivery_mbox.c +++ b/usr.sbin/smtpd/delivery_mbox.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_mbox.c,v 1.10 2014/04/19 11:31:06 gilles Exp $ */ +/* $OpenBSD: delivery_mbox.c,v 1.11 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -31,6 +31,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/delivery_mda.c b/usr.sbin/smtpd/delivery_mda.c index f374e702a88..d37aac5325c 100644 --- a/usr.sbin/smtpd/delivery_mda.c +++ b/usr.sbin/smtpd/delivery_mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: delivery_mda.c,v 1.8 2013/05/24 17:03:14 eric Exp $ */ +/* $OpenBSD: delivery_mda.c,v 1.9 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -31,6 +31,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/dict.c b/usr.sbin/smtpd/dict.c index 65666d73e84..2d65812a1ed 100644 --- a/usr.sbin/smtpd/dict.c +++ b/usr.sbin/smtpd/dict.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dict.c,v 1.4 2013/11/18 11:47:16 eric Exp $ */ +/* $OpenBSD: dict.c,v 1.5 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -26,9 +26,9 @@ #include /* for smtpd.h */ #include -//#include #include #include +#include #include "smtpd.h" diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index 6f832473980..ded22995dbd 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.80 2015/01/06 09:32:13 gilles Exp $ */ +/* $OpenBSD: dns.c,v 1.81 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -35,6 +35,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" @@ -48,7 +49,7 @@ struct dns_session { struct mproc *p; uint64_t reqid; int type; - char name[SMTPD_MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; size_t mxfound; int error; int refcount; diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index b828b9bb44c..0b50104179c 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.89 2015/01/15 09:05:37 gilles Exp $ */ +/* $OpenBSD: enqueue.c,v 1.90 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2005 Henning Brauer @@ -38,6 +38,7 @@ #include #include #include +#include #include "smtpd.h" @@ -99,7 +100,7 @@ struct { #define WSP(c) (c == ' ' || c == '\t') int verbose = 0; -char host[SMTPD_MAXHOSTNAMELEN]; +char host[HOST_NAME_MAX+1]; char *user = NULL; time_t timestamp; @@ -798,7 +799,7 @@ open_connection(void) static int enqueue_offline(int argc, char *argv[], FILE *ifile) { - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; FILE *fp; int i, fd, ch; mode_t omode; @@ -856,7 +857,7 @@ enqueue_offline(int argc, char *argv[], FILE *ifile) static int savedeadletter(struct passwd *pw, FILE *in) { - char buffer[SMTPD_MAXPATHLEN]; + char buffer[PATH_MAX]; FILE *fp; char *buf, *lbuf; size_t len; diff --git a/usr.sbin/smtpd/esc.c b/usr.sbin/smtpd/esc.c index 32bcbfd5788..d3517eb59cb 100644 --- a/usr.sbin/smtpd/esc.c +++ b/usr.sbin/smtpd/esc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esc.c,v 1.2 2014/04/19 17:32:58 gilles Exp $ */ +/* $OpenBSD: esc.c,v 1.3 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2014 Gilles Chehade @@ -16,7 +16,14 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include +#include +#include + +#include +#include #include +#include #include "smtpd-defines.h" #include "smtpd-api.h" diff --git a/usr.sbin/smtpd/expand.c b/usr.sbin/smtpd/expand.c index ca8f4e2f7a4..2b0b1b79d11 100644 --- a/usr.sbin/smtpd/expand.c +++ b/usr.sbin/smtpd/expand.c @@ -1,4 +1,4 @@ -/* $OpenBSD: expand.c,v 1.27 2014/05/09 21:30:11 tedu Exp $ */ +/* $OpenBSD: expand.c,v 1.28 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2009 Gilles Chehade @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -192,7 +193,7 @@ expand_cmp(struct expandnode *e1, struct expandnode *e2) static int expand_line_split(char **line, char **ret) { - static char buffer[SMTPD_MAXLINESIZE]; + static char buffer[LINE_MAX]; int esc, dq, sq; size_t i; char *s; @@ -237,7 +238,7 @@ int expand_line(struct expand *expand, const char *s, int do_includes) { struct expandnode xn; - char buffer[SMTPD_MAXLINESIZE]; + char buffer[LINE_MAX]; char *p, *subrcpt; int ret; diff --git a/usr.sbin/smtpd/filter_api.c b/usr.sbin/smtpd/filter_api.c index ab3f39f3b24..e4df937aa85 100644 --- a/usr.sbin/smtpd/filter_api.c +++ b/usr.sbin/smtpd/filter_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter_api.c,v 1.15 2014/07/08 14:24:16 eric Exp $ */ +/* $OpenBSD: filter_api.c,v 1.16 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -507,8 +507,8 @@ filter_io_in(struct io *io, int evt) case IO_DATAIN: nextline: line = iobuf_getline(&s->pipe.ibuf, &len); - if ((line == NULL && iobuf_len(&s->pipe.ibuf) >= SMTPD_MAXLINESIZE) || - (line && len >= SMTPD_MAXLINESIZE)) { + if ((line == NULL && iobuf_len(&s->pipe.ibuf) >= LINE_MAX) || + (line && len >= LINE_MAX)) { s->pipe.error = 1; break; } @@ -987,7 +987,7 @@ filter_api_sockaddr_to_text(const struct sockaddr *sa) const char * filter_api_mailaddr_to_text(const struct mailaddr *maddr) { - static char buffer[SMTPD_MAXLINESIZE]; + static char buffer[LINE_MAX]; strlcpy(buffer, maddr->user, sizeof buffer); strlcat(buffer, "@", sizeof buffer); diff --git a/usr.sbin/smtpd/forward.c b/usr.sbin/smtpd/forward.c index 151e8a3d977..bbda8e4dd40 100644 --- a/usr.sbin/smtpd/forward.c +++ b/usr.sbin/smtpd/forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: forward.c,v 1.35 2013/05/24 17:03:14 eric Exp $ */ +/* $OpenBSD: forward.c,v 1.36 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -30,6 +30,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/iobuf.h b/usr.sbin/smtpd/iobuf.h index eeef11141bd..e1f2745427a 100644 --- a/usr.sbin/smtpd/iobuf.h +++ b/usr.sbin/smtpd/iobuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iobuf.h,v 1.3 2013/01/26 09:37:23 gilles Exp $ */ +/* $OpenBSD: iobuf.h,v 1.4 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -15,10 +15,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include - -#include - struct ioqbuf { struct ioqbuf *next; char *buf; diff --git a/usr.sbin/smtpd/limit.c b/usr.sbin/smtpd/limit.c index 29465b0f92b..c499292b20b 100644 --- a/usr.sbin/smtpd/limit.c +++ b/usr.sbin/smtpd/limit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: limit.c,v 1.3 2014/02/04 14:56:03 eric Exp $ */ +/* $OpenBSD: limit.c,v 1.4 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 82627c22778..ba20336a8eb 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.174 2015/01/16 06:40:20 deraadt Exp $ */ +/* $OpenBSD: lka.c,v 1.175 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -76,7 +76,7 @@ lka_imsg(struct mproc *p, struct imsg *imsg) struct envelope evp; struct msg m; union lookup lk; - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; const char *tablename, *username, *password, *label; uint64_t reqid; size_t i; diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c index 5f5380d3752..8a78703cbc8 100644 --- a/usr.sbin/smtpd/lka_session.c +++ b/usr.sbin/smtpd/lka_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_session.c,v 1.68 2014/07/08 13:49:09 eric Exp $ */ +/* $OpenBSD: lka_session.c,v 1.69 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -36,6 +36,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index f46260569da..de743cb4f6d 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.51 2015/01/16 06:40:20 deraadt Exp $ */ +/* $OpenBSD: makemap.c,v 1.52 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) { struct stat sb; - char dbname[SMTPD_MAXPATHLEN]; + char dbname[PATH_MAX]; char *opts; char *conf; int ch; diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index 8dfd196d776..91d6968ab67 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.108 2015/01/05 21:00:36 gilles Exp $ */ +/* $OpenBSD: mda.c,v 1.109 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "smtpd.h" @@ -65,8 +66,8 @@ struct mda_user { uint64_t id; TAILQ_ENTRY(mda_user) entry; TAILQ_ENTRY(mda_user) entry_runnable; - char name[SMTPD_MAXLOGNAME]; - char usertable[SMTPD_MAXPATHLEN]; + char name[LOGIN_NAME_MAX]; + char usertable[PATH_MAX]; size_t evpcount; TAILQ_HEAD(, mda_envelope) envelopes; int flags; @@ -121,7 +122,7 @@ mda_imsg(struct mproc *p, struct imsg *imsg) uint64_t reqid; time_t now; size_t sz; - char out[256], buf[SMTPD_MAXLINESIZE]; + char out[256], buf[LINE_MAX]; int n; enum lka_resp_status status; @@ -599,7 +600,7 @@ static int mda_getlastline(int fd, char *dst, size_t dstsz) { FILE *fp; - char *ln, buf[SMTPD_MAXLINESIZE]; + char *ln, buf[LINE_MAX]; size_t len; memset(buf, 0, sizeof buf); @@ -747,7 +748,7 @@ mda_done(struct mda_session *s) static void mda_log(const struct mda_envelope *evp, const char *prefix, const char *status) { - char rcpt[SMTPD_MAXLINESIZE]; + char rcpt[LINE_MAX]; const char *method; rcpt[0] = '\0'; @@ -882,7 +883,7 @@ static struct mda_envelope * mda_envelope(const struct envelope *evp) { struct mda_envelope *e; - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; e = xcalloc(1, sizeof *e, "mda_envelope"); e->id = evp->id; diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index fd7e789222f..abffbb305ee 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.190 2015/01/16 06:40:20 deraadt Exp $ */ +/* $OpenBSD: mta.c,v 1.191 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -159,9 +159,9 @@ static time_t max_seen_discdelay_route; #define HOSTSTAT_EXPIRE_DELAY (4 * 3600) struct hoststat { - char name[SMTPD_MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; time_t tm; - char error[SMTPD_MAXLINESIZE]; + char error[LINE_MAX]; struct tree deferred; }; static struct dict hoststat; @@ -194,7 +194,7 @@ mta_imsg(struct mproc *p, struct imsg *imsg) const char *dom; uint64_t reqid; time_t t; - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; int dnserror, preference, v, status; void *iter; uint64_t u64; @@ -2418,7 +2418,7 @@ void mta_hoststat_update(const char *host, const char *error) { struct hoststat *hs = NULL; - char buf[SMTPD_MAXHOSTNAMELEN]; + char buf[HOST_NAME_MAX+1]; time_t tm; if (! lowercase(buf, host, sizeof buf)) @@ -2445,7 +2445,7 @@ void mta_hoststat_cache(const char *host, uint64_t evpid) { struct hoststat *hs = NULL; - char buf[SMTPD_MAXHOSTNAMELEN]; + char buf[HOST_NAME_MAX+1]; if (! lowercase(buf, host, sizeof buf)) return; @@ -2464,7 +2464,7 @@ void mta_hoststat_uncache(const char *host, uint64_t evpid) { struct hoststat *hs = NULL; - char buf[SMTPD_MAXHOSTNAMELEN]; + char buf[HOST_NAME_MAX+1]; if (! lowercase(buf, host, sizeof buf)) return; @@ -2480,7 +2480,7 @@ void mta_hoststat_reschedule(const char *host) { struct hoststat *hs = NULL; - char buf[SMTPD_MAXHOSTNAMELEN]; + char buf[HOST_NAME_MAX+1]; uint64_t evpid; if (! lowercase(buf, host, sizeof buf)) diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 507aab18003..f45a141e972 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.70 2015/01/16 06:40:20 deraadt Exp $ */ +/* $OpenBSD: mta_session.c,v 1.71 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -584,8 +584,8 @@ mta_enter_state(struct mta_session *s, int newstate) size_t envid_sz; int oldstate; ssize_t q; - char ibuf[SMTPD_MAXLINESIZE]; - char obuf[SMTPD_MAXLINESIZE]; + char ibuf[LINE_MAX]; + char obuf[LINE_MAX]; int offset; again: @@ -875,7 +875,7 @@ mta_response(struct mta_session *s, char *line) struct sockaddr *sa; const char *domain; socklen_t sa_len; - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; int delivery; switch (s->state) { @@ -1193,7 +1193,7 @@ mta_io(struct io *io, int evt) nextline: line = iobuf_getline(&s->iobuf, &len); if (line == NULL) { - if (iobuf_len(&s->iobuf) >= SMTPD_MAXLINESIZE) { + if (iobuf_len(&s->iobuf) >= LINE_MAX) { mta_error(s, "Input too long"); mta_free(s); return; @@ -1397,7 +1397,7 @@ mta_flush_task(struct mta_session *s, int delivery, const char *error, size_t co int cache) { struct mta_envelope *e; - char relay[SMTPD_MAXLINESIZE]; + char relay[LINE_MAX]; size_t n; struct sockaddr_storage ss; struct sockaddr *sa; diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y index 5619d022fee..4135e018911 100644 --- a/usr.sbin/smtpd/parse.y +++ b/usr.sbin/smtpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.150 2015/01/16 06:40:20 deraadt Exp $ */ +/* $OpenBSD: parse.y,v 1.151 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -1656,8 +1656,8 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts) { struct sym *sym, *next; struct table *t; - char hostname[SMTPD_MAXHOSTNAMELEN]; - char hostname_copy[SMTPD_MAXHOSTNAMELEN]; + char hostname[HOST_NAME_MAX+1]; + char hostname_copy[HOST_NAME_MAX+1]; if (! getmailname(hostname, sizeof hostname)) return (-1); diff --git a/usr.sbin/smtpd/pony.c b/usr.sbin/smtpd/pony.c index 8da3f6bfd2a..0b049867ccb 100644 --- a/usr.sbin/smtpd/pony.c +++ b/usr.sbin/smtpd/pony.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pony.c,v 1.6 2014/07/08 20:14:46 eric Exp $ */ +/* $OpenBSD: pony.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2014 Gilles Chehade @@ -34,6 +34,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index 45be2a5a5d0..b264347fdce 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.165 2014/07/10 15:54:55 eric Exp $ */ +/* $OpenBSD: queue.c,v 1.166 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -36,6 +36,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" @@ -691,7 +692,7 @@ queue_timeout(int fd, short event, void *p) static void queue_log(const struct envelope *e, const char *prefix, const char *status) { - char rcpt[SMTPD_MAXLINESIZE]; + char rcpt[LINE_MAX]; (void)strlcpy(rcpt, "-", sizeof rcpt); if (strcmp(e->rcpt.user, e->dest.user) || diff --git a/usr.sbin/smtpd/queue_api.c b/usr.sbin/smtpd/queue_api.c index 7eaae74c7ed..14d87f7bc9b 100644 --- a/usr.sbin/smtpd/queue_api.c +++ b/usr.sbin/smtpd/queue_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_api.c,v 1.6 2014/09/01 20:58:42 doug Exp $ */ +/* $OpenBSD: queue_api.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -18,7 +18,11 @@ #include #include -#include +#include +#include + +#include +#include #include #include diff --git a/usr.sbin/smtpd/queue_backend.c b/usr.sbin/smtpd/queue_backend.c index 245e0d9fc03..1acb938184b 100644 --- a/usr.sbin/smtpd/queue_backend.c +++ b/usr.sbin/smtpd/queue_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_backend.c,v 1.54 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: queue_backend.c,v 1.55 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -369,7 +369,7 @@ err: int queue_message_fd_rw(uint32_t msgid) { - char buf[SMTPD_MAXPATHLEN]; + char buf[PATH_MAX]; queue_message_path(msgid, buf, sizeof(buf)); diff --git a/usr.sbin/smtpd/queue_fs.c b/usr.sbin/smtpd/queue_fs.c index 25a7f17b404..38d027cdcf2 100644 --- a/usr.sbin/smtpd/queue_fs.c +++ b/usr.sbin/smtpd/queue_fs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_fs.c,v 1.7 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: queue_fs.c,v 1.8 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -76,7 +76,7 @@ static struct timespec startup; static int queue_fs_message_create(uint32_t *msgid) { - char rootdir[SMTPD_MAXPATHLEN]; + char rootdir[PATH_MAX]; struct stat sb; if (! fsqueue_check_space()) @@ -117,10 +117,10 @@ again: static int queue_fs_message_commit(uint32_t msgid, const char *path) { - char incomingdir[SMTPD_MAXPATHLEN]; - char queuedir[SMTPD_MAXPATHLEN]; - char msgdir[SMTPD_MAXPATHLEN]; - char msgpath[SMTPD_MAXPATHLEN]; + char incomingdir[PATH_MAX]; + char queuedir[PATH_MAX]; + char msgdir[PATH_MAX]; + char msgpath[PATH_MAX]; /* before-first, move the message content in the incoming directory */ fsqueue_message_incoming_path(msgid, msgpath, sizeof(msgpath)); @@ -175,7 +175,7 @@ static int queue_fs_message_fd_r(uint32_t msgid) { int fd; - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; fsqueue_message_path(msgid, path, sizeof(path)); if (strlcat(path, PATH_MESSAGE, sizeof(path)) @@ -193,7 +193,7 @@ queue_fs_message_fd_r(uint32_t msgid) static int queue_fs_message_delete(uint32_t msgid) { - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; struct stat sb; fsqueue_message_incoming_path(msgid, path, sizeof(path)); @@ -212,8 +212,8 @@ static int queue_fs_message_corrupt(uint32_t msgid) { struct stat sb; - char rootdir[SMTPD_MAXPATHLEN]; - char corruptdir[SMTPD_MAXPATHLEN]; + char rootdir[PATH_MAX]; + char corruptdir[PATH_MAX]; char buf[64]; int retry = 0; @@ -244,7 +244,7 @@ static int queue_fs_envelope_create(uint32_t msgid, const char *buf, size_t len, uint64_t *evpid) { - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; int queued = 0, i, r = 0, *n; struct stat sb; @@ -286,7 +286,7 @@ done: static int queue_fs_envelope_load(uint64_t evpid, char *buf, size_t len) { - char pathname[SMTPD_MAXPATHLEN]; + char pathname[PATH_MAX]; FILE *fp; size_t r; @@ -316,7 +316,7 @@ queue_fs_envelope_load(uint64_t evpid, char *buf, size_t len) static int queue_fs_envelope_update(uint64_t evpid, const char *buf, size_t len) { - char dest[SMTPD_MAXPATHLEN]; + char dest[PATH_MAX]; fsqueue_envelope_path(evpid, dest, sizeof(dest)); @@ -326,7 +326,7 @@ queue_fs_envelope_update(uint64_t evpid, const char *buf, size_t len) static int queue_fs_envelope_delete(uint64_t evpid) { - char pathname[SMTPD_MAXPATHLEN]; + char pathname[PATH_MAX]; uint32_t msgid; int *n; @@ -538,7 +538,7 @@ fsqueue_message_incoming_path(uint32_t msgid, char *buf, size_t len) static void * fsqueue_qwalk_new(void) { - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; char * const path_argv[] = { path, NULL }; struct qwalk *q; @@ -621,7 +621,7 @@ queue_fs_init(struct passwd *pw, int server, const char *conf) { unsigned int n; char *paths[] = { PATH_QUEUE, PATH_CORRUPT, PATH_INCOMING }; - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; int ret; struct timeval tv; diff --git a/usr.sbin/smtpd/queue_null.c b/usr.sbin/smtpd/queue_null.c index fcc52b845bb..46a85ab0384 100644 --- a/usr.sbin/smtpd/queue_null.c +++ b/usr.sbin/smtpd/queue_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_null.c,v 1.5 2014/07/08 15:45:32 eric Exp $ */ +/* $OpenBSD: queue_null.c,v 1.6 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -36,6 +36,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/queue_proc.c b/usr.sbin/smtpd/queue_proc.c index 87de867831b..4091bbc5f86 100644 --- a/usr.sbin/smtpd/queue_proc.c +++ b/usr.sbin/smtpd/queue_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_proc.c,v 1.4 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: queue_proc.c,v 1.5 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -34,6 +34,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/queue_ram.c b/usr.sbin/smtpd/queue_ram.c index 24f2f5cf381..196cf5fe83c 100644 --- a/usr.sbin/smtpd/queue_ram.c +++ b/usr.sbin/smtpd/queue_ram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_ram.c,v 1.6 2014/07/08 15:45:32 eric Exp $ */ +/* $OpenBSD: queue_ram.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -36,6 +36,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index 902f3c9da16..120b20505fd 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.30 2014/07/08 13:49:09 eric Exp $ */ +/* $OpenBSD: ruleset.c,v 1.31 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2009 Gilles Chehade @@ -28,6 +28,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/runq.c b/usr.sbin/smtpd/runq.c index 30fd9e17f67..ce8c67ef2a7 100644 --- a/usr.sbin/smtpd/runq.c +++ b/usr.sbin/smtpd/runq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runq.c,v 1.1 2013/07/19 21:14:52 eric Exp $ */ +/* $OpenBSD: runq.c,v 1.2 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/scheduler.c b/usr.sbin/smtpd/scheduler.c index 874ffc2aff7..539de4b83b3 100644 --- a/usr.sbin/smtpd/scheduler.c +++ b/usr.sbin/smtpd/scheduler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler.c,v 1.47 2014/07/10 14:45:02 eric Exp $ */ +/* $OpenBSD: scheduler.c,v 1.48 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -40,6 +40,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/scheduler_api.c b/usr.sbin/smtpd/scheduler_api.c index e692d78b634..ab23d29eb93 100644 --- a/usr.sbin/smtpd/scheduler_api.c +++ b/usr.sbin/smtpd/scheduler_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_api.c,v 1.6 2014/07/10 14:45:02 eric Exp $ */ +/* $OpenBSD: scheduler_api.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -18,7 +18,11 @@ #include #include -#include +#include +#include + +#include +#include #include #include diff --git a/usr.sbin/smtpd/scheduler_backend.c b/usr.sbin/smtpd/scheduler_backend.c index 1f3c9e26c11..97b15f25006 100644 --- a/usr.sbin/smtpd/scheduler_backend.c +++ b/usr.sbin/smtpd/scheduler_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_backend.c,v 1.14 2014/07/10 14:45:02 eric Exp $ */ +/* $OpenBSD: scheduler_backend.c,v 1.15 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -29,6 +29,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/scheduler_null.c b/usr.sbin/smtpd/scheduler_null.c index e1abe954fd2..a8c43331eb4 100644 --- a/usr.sbin/smtpd/scheduler_null.c +++ b/usr.sbin/smtpd/scheduler_null.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_null.c,v 1.8 2014/07/10 14:45:02 eric Exp $ */ +/* $OpenBSD: scheduler_null.c,v 1.9 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -27,6 +27,7 @@ #include #include #include +#include #include "smtpd.h" diff --git a/usr.sbin/smtpd/scheduler_proc.c b/usr.sbin/smtpd/scheduler_proc.c index 4db950f2273..4efa9e34a80 100644 --- a/usr.sbin/smtpd/scheduler_proc.c +++ b/usr.sbin/smtpd/scheduler_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_proc.c,v 1.6 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: scheduler_proc.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -29,6 +29,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/scheduler_ramqueue.c b/usr.sbin/smtpd/scheduler_ramqueue.c index 229e74c80d1..9ff16f16afd 100644 --- a/usr.sbin/smtpd/scheduler_ramqueue.c +++ b/usr.sbin/smtpd/scheduler_ramqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scheduler_ramqueue.c,v 1.40 2014/07/10 14:45:02 eric Exp $ */ +/* $OpenBSD: scheduler_ramqueue.c,v 1.41 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index 9f120eed517..93659ac1ea2 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp.c,v 1.142 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: smtp.c,v 1.143 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -215,7 +215,7 @@ static int smtp_enqueue(uid_t *euid) { static struct listener local, *listener = NULL; - char buf[SMTPD_MAXHOSTNAMELEN], *hostname; + char buf[HOST_NAME_MAX+1], *hostname; int fd[2]; if (listener == NULL) { diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 078a4d331e3..04a6eb6f939 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.226 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.227 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -122,17 +122,17 @@ struct smtp_session { struct listener *listener; void *ssl_ctx; struct sockaddr_storage ss; - char hostname[SMTPD_MAXHOSTNAMELEN]; - char smtpname[SMTPD_MAXHOSTNAMELEN]; - char sni[SMTPD_MAXHOSTNAMELEN]; + char hostname[HOST_NAME_MAX+1]; + char smtpname[HOST_NAME_MAX+1]; + char sni[HOST_NAME_MAX+1]; int flags; int phase; enum smtp_state state; - char helo[SMTPD_MAXLINESIZE]; - char cmd[SMTPD_MAXLINESIZE]; - char username[SMTPD_MAXLOGNAME]; + char helo[LINE_MAX]; + char cmd[LINE_MAX]; + char username[LOGIN_NAME_MAX]; struct envelope evp; @@ -493,7 +493,7 @@ smtp_session(struct listener *listener, int sock, if ((s = calloc(1, sizeof(*s))) == NULL) return (-1); - if (iobuf_init(&s->iobuf, SMTPD_MAXLINESIZE, SMTPD_MAXLINESIZE) == -1) { + if (iobuf_init(&s->iobuf, LINE_MAX, LINE_MAX) == -1) { free(s); return (-1); } @@ -557,7 +557,7 @@ smtp_session_imsg(struct mproc *p, struct imsg *imsg) struct smtp_rcpt *rcpt; void *ssl; char *pkiname; - char user[SMTPD_MAXLOGNAME]; + char user[LOGIN_NAME_MAX]; struct msg m; const char *line, *helo; uint64_t reqid, evpid; @@ -1086,8 +1086,8 @@ smtp_io(struct io *io, int evt) case IO_DATAIN: nextline: line = iobuf_getline(&s->iobuf, &len); - if ((line == NULL && iobuf_len(&s->iobuf) >= SMTPD_MAXLINESIZE) || - (line && len >= SMTPD_MAXLINESIZE)) { + if ((line == NULL && iobuf_len(&s->iobuf) >= LINE_MAX) || + (line && len >= LINE_MAX)) { s->flags |= SF_BADINPUT; smtp_reply(s, "500 %s: Line too long", esc_code(ESC_STATUS_PERMFAIL, ESC_OTHER_STATUS)); @@ -1586,7 +1586,7 @@ abort: static void smtp_rfc4954_auth_login(struct smtp_session *s, char *arg) { - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; switch (s->state) { case STATE_HELO: @@ -1916,12 +1916,12 @@ smtp_reply(struct smtp_session *s, char *fmt, ...) { va_list ap; int n; - char buf[SMTPD_MAXLINESIZE], tmp[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX], tmp[LINE_MAX]; va_start(ap, fmt); n = vsnprintf(buf, sizeof buf, fmt, ap); va_end(ap); - if (n == -1 || n >= SMTPD_MAXLINESIZE) + if (n == -1 || n >= LINE_MAX) fatalx("smtp_reply: line too long"); if (n < 4) fatalx("smtp_reply: response too short"); diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 74a81b824d9..c2b4ff0a0c1 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.124 2014/07/20 01:38:40 guenther Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.125 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -40,6 +40,7 @@ #include #include #include +#include #include "smtpd.h" #include "parser.h" @@ -575,7 +576,7 @@ do_schedule(int argc, struct parameter *argv) static int do_show_envelope(int argc, struct parameter *argv) { - char buf[SMTPD_MAXPATHLEN]; + char buf[PATH_MAX]; if (! bsnprintf(buf, sizeof(buf), "%s%s/%02x/%08x/%016" PRIx64, PATH_SPOOL, @@ -601,7 +602,7 @@ do_show_hoststats(int argc, struct parameter *argv) static int do_show_message(int argc, struct parameter *argv) { - char buf[SMTPD_MAXPATHLEN]; + char buf[PATH_MAX]; uint32_t msgid; if (argv[0].type == P_EVPID) @@ -1028,7 +1029,7 @@ static void show_offline_envelope(uint64_t evpid) { FILE *fp = NULL; - char pathname[SMTPD_MAXPATHLEN]; + char pathname[PATH_MAX]; size_t plen; char *p; size_t buflen; diff --git a/usr.sbin/smtpd/smtpd-api.h b/usr.sbin/smtpd/smtpd-api.h index 05309658d18..f1aa06d1b8b 100644 --- a/usr.sbin/smtpd/smtpd-api.h +++ b/usr.sbin/smtpd/smtpd-api.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd-api.h,v 1.20 2014/07/10 14:45:02 eric Exp $ */ +/* $OpenBSD: smtpd-api.h,v 1.21 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -20,13 +20,6 @@ #ifndef _SMTPD_API_H_ #define _SMTPD_API_H_ -#include -#include -#include - -#include -#include - #define FILTER_API_VERSION 50 struct mailaddr { @@ -193,7 +186,7 @@ struct scheduler_info { struct table_open_params { uint32_t version; - char name[SMTPD_MAXLINESIZE]; + char name[LINE_MAX]; }; enum table_service { diff --git a/usr.sbin/smtpd/smtpd-defines.h b/usr.sbin/smtpd/smtpd-defines.h index 9838f91a9b1..870405624a9 100644 --- a/usr.sbin/smtpd/smtpd-defines.h +++ b/usr.sbin/smtpd/smtpd-defines.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd-defines.h,v 1.3 2014/04/30 09:17:29 gilles Exp $ */ +/* $OpenBSD: smtpd-defines.h,v 1.4 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Gilles Chehade @@ -23,11 +23,6 @@ #define SMTPD_MAXLOCALPARTSIZE (255 + 1) #define SMTPD_MAXDOMAINPARTSIZE (255 + 1) -#define SMTPD_MAXLOGNAME 32 -#define SMTPD_MAXPATHLEN 1024 -#define SMTPD_MAXHOSTNAMELEN 256 -#define SMTPD_MAXLINESIZE 2048 - #define SMTPD_USER "_smtpd" #define PATH_CHROOT "/var/empty" #define SMTPD_QUEUE_USER "_smtpq" diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index 36b2c6bb300..efb3a48b631 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.237 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: smtpd.c,v 1.238 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -554,9 +554,9 @@ main(int argc, char *argv[]) if (parse_config(&smtpd, conffile, opts)) exit(1); - if (strlcpy(env->sc_conffile, conffile, SMTPD_MAXPATHLEN) - >= SMTPD_MAXPATHLEN) - errx(1, "config file exceeds SMTPD_MAXPATHLEN"); + if (strlcpy(env->sc_conffile, conffile, PATH_MAX) + >= PATH_MAX) + errx(1, "config file exceeds PATH_MAX"); if (env->sc_opts & SMTPD_OPT_NOACTION) { load_pki_tree(); @@ -776,8 +776,8 @@ fork_proc_backend(const char *key, const char *conf, const char *procname) { pid_t pid; int sp[2]; - char path[SMTPD_MAXPATHLEN]; - char name[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; + char name[PATH_MAX]; char *arg; if (strlcpy(name, conf, sizeof(name)) >= sizeof(name)) { @@ -1037,7 +1037,7 @@ offline_scan(int fd, short ev, void *arg) static int offline_enqueue(char *name) { - char t[SMTPD_MAXPATHLEN], *path; + char t[PATH_MAX], *path; struct stat sb; pid_t pid; struct child *child; @@ -1178,7 +1178,7 @@ offline_done(void) static int parent_forward_open(char *username, char *directory, uid_t uid, gid_t gid) { - char pathname[SMTPD_MAXPATHLEN]; + char pathname[PATH_MAX]; int fd; struct stat sb; @@ -1492,8 +1492,8 @@ imsg_to_str(int type) int parent_auth_user(const char *username, const char *password) { - char user[SMTPD_MAXLOGNAME]; - char pass[SMTPD_MAXLINESIZE]; + char user[LOGIN_NAME_MAX]; + char pass[LINE_MAX]; int ret; (void)strlcpy(user, username, sizeof(user)); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index f33e483c531..12b0f199097 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.472 2014/12/24 13:53:39 eric Exp $ */ +/* $OpenBSD: smtpd.h,v 1.473 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -96,8 +96,8 @@ #define MTA_EXT_DSN 0x400 struct userinfo { - char username[SMTPD_MAXLOGNAME]; - char directory[SMTPD_MAXPATHLEN]; + char username[LOGIN_NAME_MAX]; + char directory[PATH_MAX]; uid_t uid; gid_t gid; }; @@ -109,23 +109,23 @@ struct netaddr { struct relayhost { uint16_t flags; - char hostname[SMTPD_MAXHOSTNAMELEN]; + char hostname[HOST_NAME_MAX+1]; uint16_t port; - char pki_name[SMTPD_MAXPATHLEN]; - char authtable[SMTPD_MAXPATHLEN]; - char authlabel[SMTPD_MAXPATHLEN]; - char sourcetable[SMTPD_MAXPATHLEN]; - char heloname[SMTPD_MAXHOSTNAMELEN]; - char helotable[SMTPD_MAXPATHLEN]; + char pki_name[PATH_MAX]; + char authtable[PATH_MAX]; + char authlabel[PATH_MAX]; + char sourcetable[PATH_MAX]; + char heloname[HOST_NAME_MAX+1]; + char helotable[PATH_MAX]; }; struct credentials { - char username[SMTPD_MAXLINESIZE]; - char password[SMTPD_MAXLINESIZE]; + char username[LINE_MAX]; + char password[LINE_MAX]; }; struct destination { - char name[SMTPD_MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; }; struct source { @@ -134,7 +134,7 @@ struct source { struct addrname { struct sockaddr_storage addr; - char name[SMTPD_MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; }; union lookup { @@ -319,9 +319,9 @@ enum table_type { }; struct table { - char t_name[SMTPD_MAXLINESIZE]; + char t_name[LINE_MAX]; enum table_type t_type; - char t_config[SMTPD_MAXPATHLEN]; + char t_config[PATH_MAX]; struct dict t_dict; @@ -396,8 +396,8 @@ struct rule { struct delivery_mda { enum action_type method; - char usertable[SMTPD_MAXPATHLEN]; - char username[SMTPD_MAXLOGNAME]; + char usertable[PATH_MAX]; + char username[LOGIN_NAME_MAX]; char buffer[EXPAND_BUFFER]; }; @@ -482,10 +482,10 @@ struct envelope { uint64_t id; enum envelope_flags flags; - char smtpname[SMTPD_MAXHOSTNAMELEN]; - char helo[SMTPD_MAXHOSTNAMELEN]; - char hostname[SMTPD_MAXHOSTNAMELEN]; - char errorline[SMTPD_MAXLINESIZE]; + char smtpname[HOST_NAME_MAX+1]; + char helo[HOST_NAME_MAX+1]; + char hostname[HOST_NAME_MAX+1]; + char errorline[LINE_MAX]; struct sockaddr_storage ss; struct mailaddr sender; @@ -522,17 +522,17 @@ struct listener { in_port_t port; struct timeval timeout; struct event ev; - char pki_name[SMTPD_MAXPATHLEN]; + char pki_name[PATH_MAX]; char tag[MAX_TAG_SIZE]; - char filter[SMTPD_MAXPATHLEN]; - char authtable[SMTPD_MAXLINESIZE]; - char hostname[SMTPD_MAXHOSTNAMELEN]; - char hostnametable[SMTPD_MAXPATHLEN]; + char filter[PATH_MAX]; + char authtable[LINE_MAX]; + char hostname[HOST_NAME_MAX+1]; + char hostnametable[PATH_MAX]; TAILQ_ENTRY(listener) entry; }; struct smtpd { - char sc_conffile[SMTPD_MAXPATHLEN]; + char sc_conffile[PATH_MAX]; size_t sc_maxsize; #define SMTPD_OPT_VERBOSE 0x00000001 @@ -572,7 +572,7 @@ struct smtpd { int sc_qexpire; #define MAX_BOUNCE_WARN 4 time_t sc_bounce_warn[MAX_BOUNCE_WARN]; - char sc_hostname[SMTPD_MAXHOSTNAMELEN]; + char sc_hostname[HOST_NAME_MAX+1]; struct stat_backend *sc_stat; struct compress_backend *sc_comp; @@ -618,17 +618,17 @@ struct forward_req { uint64_t id; uint8_t status; - char user[SMTPD_MAXLOGNAME]; + char user[LOGIN_NAME_MAX]; uid_t uid; gid_t gid; - char directory[SMTPD_MAXPATHLEN]; + char directory[PATH_MAX]; }; struct deliver { - char to[SMTPD_MAXPATHLEN]; - char from[SMTPD_MAXPATHLEN]; - char dest[SMTPD_MAXLINESIZE]; - char user[SMTPD_MAXLOGNAME]; + char to[PATH_MAX]; + char from[PATH_MAX]; + char dest[LINE_MAX]; + char user[LOGIN_NAME_MAX]; short mode; struct userinfo userinfo; @@ -825,7 +825,7 @@ struct mta_envelope { uint8_t dsn_notify; enum dsn_ret dsn_ret; - char status[SMTPD_MAXLINESIZE]; + char status[LINE_MAX]; }; struct mta_task { @@ -1030,7 +1030,7 @@ enum ca_resp_status { struct ca_cert_req_msg { uint64_t reqid; - char name[SMTPD_MAXHOSTNAMELEN]; + char name[HOST_NAME_MAX+1]; }; struct ca_cert_resp_msg { @@ -1042,7 +1042,7 @@ struct ca_cert_resp_msg { struct ca_vrfy_req_msg { uint64_t reqid; - char pkiname[SMTPD_MAXHOSTNAMELEN]; + char pkiname[HOST_NAME_MAX+1]; unsigned char *cert; off_t cert_len; size_t n_chain; diff --git a/usr.sbin/smtpd/stat_backend.c b/usr.sbin/smtpd/stat_backend.c index 33d1fa573ae..28e0ea2454b 100644 --- a/usr.sbin/smtpd/stat_backend.c +++ b/usr.sbin/smtpd/stat_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stat_backend.c,v 1.9 2014/07/08 10:22:15 eric Exp $ */ +/* $OpenBSD: stat_backend.c,v 1.10 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -25,6 +25,7 @@ #include #include #include +#include #include "log.h" #include "smtpd.h" diff --git a/usr.sbin/smtpd/stat_ramstat.c b/usr.sbin/smtpd/stat_ramstat.c index 681b58e8f6b..6cefaa9ac5d 100644 --- a/usr.sbin/smtpd/stat_ramstat.c +++ b/usr.sbin/smtpd/stat_ramstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stat_ramstat.c,v 1.9 2014/04/19 14:11:55 gilles Exp $ */ +/* $OpenBSD: stat_ramstat.c,v 1.10 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -26,6 +26,7 @@ #include #include #include +#include #include "smtpd.h" #include "log.h" diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c index 52d09de88fa..6e8753f60ad 100644 --- a/usr.sbin/smtpd/table.c +++ b/usr.sbin/smtpd/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.18 2015/01/14 09:07:51 gilles Exp $ */ +/* $OpenBSD: table.c,v 1.19 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include @@ -102,7 +104,7 @@ table_service_name(enum table_service s) struct table * table_find(const char *name, const char *tag) { - char buf[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; if (tag == NULL) return dict_get(env->sc_tables_dict, name); @@ -188,8 +190,8 @@ table_create(const char *backend, const char *name, const char *tag, { struct table *t; struct table_backend *tb; - char buf[SMTPD_MAXLINESIZE]; - char path[SMTPD_MAXLINESIZE]; + char buf[LINE_MAX]; + char path[LINE_MAX]; size_t n; struct stat sb; @@ -536,7 +538,7 @@ int table_parse_lookup(enum table_service service, const char *key, const char *line, union lookup *lk) { - char buffer[SMTPD_MAXLINESIZE], *p; + char buffer[LINE_MAX], *p; size_t len; len = strlen(line); @@ -565,7 +567,7 @@ table_parse_lookup(enum table_service service, const char *key, return (-1); /* too big to fit in a smtp session line */ - if (len >= SMTPD_MAXLINESIZE) + if (len >= LINE_MAX) return (-1); p = strchr(line, ':'); @@ -631,7 +633,7 @@ table_parse_lookup(enum table_service service, const char *key, static const char * table_dump_lookup(enum table_service s, union lookup *lk) { - static char buf[SMTPD_MAXLINESIZE]; + static char buf[LINE_MAX]; int ret; switch (s) { diff --git a/usr.sbin/smtpd/table_api.c b/usr.sbin/smtpd/table_api.c index 48d70a8d205..78cb2e9d90b 100644 --- a/usr.sbin/smtpd/table_api.c +++ b/usr.sbin/smtpd/table_api.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_api.c,v 1.6 2014/08/11 09:50:51 gilles Exp $ */ +/* $OpenBSD: table_api.c,v 1.7 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -18,7 +18,11 @@ #include #include -#include +#include +#include + +#include +#include #include #include @@ -28,6 +32,7 @@ #include #include #include +#include #include "smtpd-defines.h" #include "smtpd-api.h" diff --git a/usr.sbin/smtpd/table_db.c b/usr.sbin/smtpd/table_db.c index a0dc5b326e1..dd71684d575 100644 --- a/usr.sbin/smtpd/table_db.c +++ b/usr.sbin/smtpd/table_db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_db.c,v 1.7 2014/07/08 13:49:09 eric Exp $ */ +/* $OpenBSD: table_db.c,v 1.8 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -72,7 +72,7 @@ static struct keycmp { struct dbhandle { DB *db; - char pathname[SMTPD_MAXPATHLEN]; + char pathname[PATH_MAX]; time_t mtime; struct table *table; }; @@ -236,7 +236,7 @@ table_db_get_entry(void *hdl, const char *key, size_t *len) int ret; DBT dbk; DBT dbv; - char pkey[SMTPD_MAXLINESIZE]; + char pkey[LINE_MAX]; /* workaround the stupidity of the DB interface */ if (strlcpy(pkey, key, sizeof pkey) >= sizeof pkey) diff --git a/usr.sbin/smtpd/table_getpwnam.c b/usr.sbin/smtpd/table_getpwnam.c index 52e79c0d772..83cbf797d7b 100644 --- a/usr.sbin/smtpd/table_getpwnam.c +++ b/usr.sbin/smtpd/table_getpwnam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_getpwnam.c,v 1.3 2014/07/08 13:49:09 eric Exp $ */ +/* $OpenBSD: table_getpwnam.c,v 1.4 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Gilles Chehade @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/table_ldap.c b/usr.sbin/smtpd/table_ldap.c index 6be15d452c6..0b9b7451e79 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.12 2014/07/09 08:38:08 eric Exp $ */ +/* $OpenBSD: table_ldap.c,v 1.13 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -17,11 +17,19 @@ */ #include +#include +#include +#include + +#include +#include #include #include +#include #include #include +#include #include "smtpd-defines.h" #include "smtpd-api.h" diff --git a/usr.sbin/smtpd/table_passwd.c b/usr.sbin/smtpd/table_passwd.c index 0da86673c45..bc1524664f3 100644 --- a/usr.sbin/smtpd/table_passwd.c +++ b/usr.sbin/smtpd/table_passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_passwd.c,v 1.9 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: table_passwd.c,v 1.10 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Gilles Chehade @@ -17,6 +17,12 @@ */ #include +#include +#include +#include + +#include +#include #include #include diff --git a/usr.sbin/smtpd/table_proc.c b/usr.sbin/smtpd/table_proc.c index ed4e5dd8786..4b927477d56 100644 --- a/usr.sbin/smtpd/table_proc.c +++ b/usr.sbin/smtpd/table_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table_proc.c,v 1.4 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: table_proc.c,v 1.5 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/table_sqlite.c b/usr.sbin/smtpd/table_sqlite.c index 57e95939fe1..dd9065b7383 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.15 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: table_sqlite.c,v 1.16 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -17,6 +17,12 @@ */ #include +#include +#include +#include + +#include +#include #include #include @@ -27,6 +33,7 @@ #include #include #include +#include #include "smtpd-defines.h" #include "smtpd-api.h" diff --git a/usr.sbin/smtpd/table_static.c b/usr.sbin/smtpd/table_static.c index e7eb5291959..9224a576834 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.9 2014/07/08 13:49:09 eric Exp $ */ +/* $OpenBSD: table_static.c,v 1.10 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "smtpd.h" diff --git a/usr.sbin/smtpd/to.c b/usr.sbin/smtpd/to.c index 2ac22b523a5..0dbd3e35689 100644 --- a/usr.sbin/smtpd/to.c +++ b/usr.sbin/smtpd/to.c @@ -1,4 +1,4 @@ -/* $OpenBSD: to.c,v 1.18 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: to.c,v 1.19 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2009 Jacek Masiulaniec @@ -98,7 +98,7 @@ text_to_mailaddr(struct mailaddr *maddr, const char *email) { char *username; char *hostname; - char buffer[SMTPD_MAXLINESIZE]; + char buffer[LINE_MAX]; if (strlcpy(buffer, email, sizeof buffer) >= sizeof buffer) return 0; @@ -135,7 +135,7 @@ text_to_mailaddr(struct mailaddr *maddr, const char *email) const char * mailaddr_to_text(const struct mailaddr *maddr) { - static char buffer[SMTPD_MAXLINESIZE]; + static char buffer[LINE_MAX]; (void)strlcpy(buffer, maddr->user, sizeof buffer); (void)strlcat(buffer, "@", sizeof buffer); @@ -587,7 +587,7 @@ rule_to_text(struct rule *r) int text_to_userinfo(struct userinfo *userinfo, const char *s) { - char buf[SMTPD_MAXPATHLEN]; + char buf[PATH_MAX]; char *p; const char *errstr; @@ -636,7 +636,7 @@ int text_to_credentials(struct credentials *creds, const char *s) { char *p; - char buffer[SMTPD_MAXLINESIZE]; + char buffer[LINE_MAX]; size_t offset; p = strchr(s, ':'); diff --git a/usr.sbin/smtpd/tree.c b/usr.sbin/smtpd/tree.c index 796b1f26721..2022ebafb4e 100644 --- a/usr.sbin/smtpd/tree.c +++ b/usr.sbin/smtpd/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.4 2013/05/24 17:03:14 eric Exp $ */ +/* $OpenBSD: tree.c,v 1.5 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -27,6 +27,7 @@ #include #include #include +#include #include "smtpd.h" diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 9f8c86c97e8..419a6aa6ba6 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.111 2015/01/16 06:40:21 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.112 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -187,7 +187,7 @@ mkdirs_component(char *path, mode_t mode) int mkdirs(char *path, mode_t mode) { - char buf[SMTPD_MAXPATHLEN]; + char buf[PATH_MAX]; int i = 0; int done = 0; char *p; @@ -345,7 +345,7 @@ mvpurge(char *from, char *to) size_t n; int retry; const char *sep; - char buf[SMTPD_MAXPATHLEN]; + char buf[PATH_MAX]; if ((n = strlen(to)) == 0) fatalx("to is empty"); @@ -375,7 +375,7 @@ again: int mktmpfile(void) { - char path[SMTPD_MAXPATHLEN]; + char path[PATH_MAX]; int fd; mode_t omode; @@ -698,7 +698,7 @@ parse_smtp_response(char *line, size_t len, char **msg, int *cont) { size_t i; - if (len >= SMTPD_MAXLINESIZE) + if (len >= LINE_MAX) return "line too long"; if (len > 3) { diff --git a/usr.sbin/smtpd/waitq.c b/usr.sbin/smtpd/waitq.c index 09793624941..5340ab7a8c5 100644 --- a/usr.sbin/smtpd/waitq.c +++ b/usr.sbin/smtpd/waitq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: waitq.c,v 1.4 2013/05/24 17:03:14 eric Exp $ */ +/* $OpenBSD: waitq.c,v 1.5 2015/01/20 17:37:54 deraadt Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -17,6 +17,7 @@ */ #include +#include #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include "smtpd.h" -- 2.20.1