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.
-/* $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 <aschrijver@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdio.h>
#include "ber.h"
#define LDAP_URL "ldap://"
-/* $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 <gilles@poolp.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <util.h>
#include "smtpd.h"
int
aliases_virtual_check(struct table *table, const struct mailaddr *maddr)
{
- char buf[SMTPD_MAXLINESIZE];
+ char buf[LINE_MAX];
char *pbuf;
int ret;
{
struct expandnode *xn;
union lookup lk;
- char buf[SMTPD_MAXLINESIZE];
+ char buf[LINE_MAX];
char *pbuf;
int nbaliases;
int ret;
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
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;
bounce_next_message(struct bounce_session *s)
{
struct bounce_message *msg;
- char buf[SMTPD_MAXLINESIZE];
+ char buf[LINE_MAX];
int fd;
time_t now;
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;
-/* $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 <reyk@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
+#include <sys/tree.h>
#include <signal.h>
#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <imsg.h>
#include <pwd.h>
#include <err.h>
-/* $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 <chl@openbsd.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
-/* $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 <gilles@poolp.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <zlib.h>
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
/* table name too long */
len = strlen(imsg->data);
- if (len >= SMTPD_MAXLINESIZE)
+ if (len >= LINE_MAX)
goto invalid;
m_forward(p_lka, imsg);
-/* $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 <gilles@poolp.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <ashish.is@lostca.se>
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/queue.h>
#include <sys/tree.h>
-#include <sys/socket.h>
#include <sys/un.h>
#include <ctype.h>
#include <fcntl.h>
#include <imsg.h>
#include <paths.h>
+#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
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;
-/* $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 <gilles@poolp.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
#include <imsg.h> /* for smtpd.h */
#include <err.h>
-//#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "smtpd.h"
-/* $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 <gilles@poolp.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
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;
-/* $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 <henning@bulabula.org>
#include <sysexits.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#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;
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;
static int
savedeadletter(struct passwd *pw, FILE *in)
{
- char buffer[SMTPD_MAXPATHLEN];
+ char buffer[PATH_MAX];
FILE *fp;
char *buf, *lbuf;
size_t len;
-/* $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 <gilles@poolp.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/queue.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <stdio.h>
+#include <limits.h>
#include "smtpd-defines.h"
#include "smtpd-api.h"
-/* $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 <gilles@poolp.org>
#include <event.h>
#include <imsg.h>
#include <stdio.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
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;
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;
-/* $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 <eric@openbsd.org>
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;
}
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);
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <util.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-
-#include <stdarg.h>
-
struct ioqbuf {
struct ioqbuf *next;
char *buf;
-/* $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 <eric@openbsd.org>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include "smtpd.h"
-/* $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 <pyr@openbsd.org>
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;
-/* $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 <gilles@poolp.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
main(int argc, char *argv[])
{
struct stat sb;
- char dbname[SMTPD_MAXPATHLEN];
+ char dbname[PATH_MAX];
char *opts;
char *conf;
int ch;
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include "smtpd.h"
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;
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;
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);
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';
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;
-/* $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 <pyr@openbsd.org>
#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;
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;
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))
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;
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;
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))
-/* $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 <pyr@openbsd.org>
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:
struct sockaddr *sa;
const char *domain;
socklen_t sa_len;
- char buf[SMTPD_MAXLINESIZE];
+ char buf[LINE_MAX];
int delivery;
switch (s->state) {
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;
int cache)
{
struct mta_envelope *e;
- char relay[SMTPD_MAXLINESIZE];
+ char relay[LINE_MAX];
size_t n;
struct sockaddr_storage ss;
struct sockaddr *sa;
-/* $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 <gilles@poolp.org>
{
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);
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include "smtpd.h"
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
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) ||
-/* $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 <eric@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
-#include <sys/uio.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <imsg.h>
#include <pwd.h>
-/* $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 <gilles@poolp.org>
int
queue_message_fd_rw(uint32_t msgid)
{
- char buf[SMTPD_MAXPATHLEN];
+ char buf[PATH_MAX];
queue_message_path(msgid, buf, sizeof(buf));
-/* $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 <gilles@poolp.org>
static int
queue_fs_message_create(uint32_t *msgid)
{
- char rootdir[SMTPD_MAXPATHLEN];
+ char rootdir[PATH_MAX];
struct stat sb;
if (! fsqueue_check_space())
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));
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))
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));
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;
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;
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;
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));
static int
queue_fs_envelope_delete(uint64_t evpid)
{
- char pathname[SMTPD_MAXPATHLEN];
+ char pathname[PATH_MAX];
uint32_t msgid;
int *n;
static void *
fsqueue_qwalk_new(void)
{
- char path[SMTPD_MAXPATHLEN];
+ char path[PATH_MAX];
char * const path_argv[] = { path, NULL };
struct qwalk *q;
{
unsigned int n;
char *paths[] = { PATH_QUEUE, PATH_CORRUPT, PATH_INCOMING };
- char path[SMTPD_MAXPATHLEN];
+ char path[PATH_MAX];
int ret;
struct timeval tv;
-/* $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 <eric@openbsd.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
#include <imsg.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/queue.h>
#include <sys/tree.h>
#include <sys/uio.h>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <time.h>
#include "smtpd.h"
-/* $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 <gilles@poolp.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
-#include <sys/uio.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <imsg.h>
#include <pwd.h>
-/* $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 <gilles@poolp.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
#include <fcntl.h>
#include <imsg.h>
#include <stdio.h>
+#include <limits.h>
#include "smtpd.h"
-/* $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 <eric@openbsd.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <gilles@poolp.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <time.h>
#include "smtpd.h"
-/* $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 <gilles@poolp.org>
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) {
-/* $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 <gilles@poolp.org>
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;
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);
}
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;
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));
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:
{
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");
-/* $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 <eric@openbsd.org>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd.h"
#include "parser.h"
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,
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)
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;
-/* $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 <eric@openbsd.org>
#ifndef _SMTPD_API_H_
#define _SMTPD_API_H_
-#include <sys/queue.h>
-#include <sys/tree.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-#include <netdb.h>
-
#define FILTER_API_VERSION 50
struct mailaddr {
struct table_open_params {
uint32_t version;
- char name[SMTPD_MAXLINESIZE];
+ char name[LINE_MAX];
};
enum table_service {
-/* $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 <gilles@poolp.org>
#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"
-/* $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 <gilles@poolp.org>
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();
{
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)) {
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;
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;
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));
-/* $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 <gilles@poolp.org>
#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;
};
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 {
struct addrname {
struct sockaddr_storage addr;
- char name[SMTPD_MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
};
union lookup {
};
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;
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];
};
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;
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
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;
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;
uint8_t dsn_notify;
enum dsn_ret dsn_ret;
- char status[SMTPD_MAXLINESIZE];
+ char status[LINE_MAX];
};
struct mta_task {
struct ca_cert_req_msg {
uint64_t reqid;
- char name[SMTPD_MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
};
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;
-/* $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 <gilles@poolp.org>
#include <imsg.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "log.h"
#include "smtpd.h"
-/* $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 <gilles@poolp.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "smtpd.h"
#include "log.h"
-/* $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 <eric@openbsd.org>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <netdb.h>
+#include <limits.h>
#include <string.h>
#include <unistd.h>
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);
{
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;
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);
return (-1);
/* too big to fit in a smtp session line */
- if (len >= SMTPD_MAXLINESIZE)
+ if (len >= LINE_MAX)
return (-1);
p = strchr(line, ':');
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) {
-/* $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 <eric@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
-#include <sys/uio.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <event.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd-defines.h"
#include "smtpd-api.h"
-/* $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 <gilles@poolp.org>
struct dbhandle {
DB *db;
- char pathname[SMTPD_MAXPATHLEN];
+ char pathname[PATH_MAX];
time_t mtime;
struct table *table;
};
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)
-/* $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 <gilles@poolp.org>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include "smtpd.h"
-/* $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 <eric@openbsd.org>
*/
#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <ctype.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd-defines.h"
#include "smtpd-api.h"
-/* $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 <gilles@poolp.org>
*/
#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <err.h>
#include <pwd.h>
-/* $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 <eric@openbsd.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <unistd.h>
#include "smtpd.h"
-/* $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 <eric@openbsd.org>
*/
#include <sys/types.h>
+#include <sys/queue.h>
+#include <sys/tree.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
#include <ctype.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "smtpd-defines.h"
#include "smtpd-api.h"
-/* $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 <eric@openbsd.org>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include "smtpd.h"
-/* $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 <jacekm@dobremiasto.net>
{
char *username;
char *hostname;
- char buffer[SMTPD_MAXLINESIZE];
+ char buffer[LINE_MAX];
if (strlcpy(buffer, email, sizeof buffer) >= sizeof buffer)
return 0;
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);
int
text_to_userinfo(struct userinfo *userinfo, const char *s)
{
- char buf[SMTPD_MAXPATHLEN];
+ char buf[PATH_MAX];
char *p;
const char *errstr;
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, ':');
-/* $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 <eric@openbsd.org>
#include <err.h>
#include <inttypes.h>
#include <stdlib.h>
+#include <limits.h>
#include "smtpd.h"
-/* $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.
int
mkdirs(char *path, mode_t mode)
{
- char buf[SMTPD_MAXPATHLEN];
+ char buf[PATH_MAX];
int i = 0;
int done = 0;
char *p;
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");
int
mktmpfile(void)
{
- char path[SMTPD_MAXPATHLEN];
+ char path[PATH_MAX];
int fd;
mode_t omode;
{
size_t i;
- if (len >= SMTPD_MAXLINESIZE)
+ if (len >= LINE_MAX)
return "line too long";
if (len > 3) {
-/* $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 <eric@openbsd.org>
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/queue.h>
#include <sys/tree.h>
#include <sys/uio.h>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include "smtpd.h"