summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2011-04-17 11:39:24 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2011-04-17 11:39:24 +0000
commitc47b42a036abf532822fdf80ce52298ad8b2d9ce (patch)
tree25233bd6efe03645b35829cd05f1ca81f5a98906 /usr.sbin/smtpd
parent1541cc4dd793cb295324ed5c8a8d25cd859ca1cc (diff)
a structure describing an envelope should be called struct envelope, not
struct message ...
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/bounce.c20
-rw-r--r--usr.sbin/smtpd/lka.c4
-rw-r--r--usr.sbin/smtpd/mda.c4
-rw-r--r--usr.sbin/smtpd/mfa.c10
-rw-r--r--usr.sbin/smtpd/mta.c24
-rw-r--r--usr.sbin/smtpd/queue.c12
-rw-r--r--usr.sbin/smtpd/queue_backend.c22
-rw-r--r--usr.sbin/smtpd/queue_fsqueue.c78
-rw-r--r--usr.sbin/smtpd/queue_shared.c100
-rw-r--r--usr.sbin/smtpd/ramqueue.c22
-rw-r--r--usr.sbin/smtpd/runner.c20
-rw-r--r--usr.sbin/smtpd/smtp.c4
-rw-r--r--usr.sbin/smtpd/smtpd.h48
-rw-r--r--usr.sbin/smtpd/util.c12
14 files changed, 190 insertions, 190 deletions
diff --git a/usr.sbin/smtpd/bounce.c b/usr.sbin/smtpd/bounce.c
index 6130e7d3c95..f48c3d22256 100644
--- a/usr.sbin/smtpd/bounce.c
+++ b/usr.sbin/smtpd/bounce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bounce.c,v 1.29 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: bounce.c,v 1.30 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org>
@@ -40,14 +40,14 @@
struct client_ctx {
struct event ev;
- struct message m;
+ struct envelope m;
struct smtp_client *pcb;
struct smtpd *env;
FILE *msgfp;
};
int
-bounce_session(struct smtpd *env, int fd, struct message *messagep)
+bounce_session(struct smtpd *env, int fd, struct envelope *m)
{
struct client_ctx *cc = NULL;
int msgfd = -1;
@@ -55,7 +55,7 @@ bounce_session(struct smtpd *env, int fd, struct message *messagep)
FILE *msgfp = NULL;
u_int32_t msgid;
- msgid = evpid_to_msgid(messagep->evpid);
+ msgid = evpid_to_msgid(m->evpid);
/* get message content */
if ((msgfd = queue_message_fd_r(env, Q_QUEUE, msgid)) == -1)
@@ -69,16 +69,16 @@ bounce_session(struct smtpd *env, int fd, struct message *messagep)
goto fail;
cc->pcb = client_init(fd, msgfp, env->sc_hostname, 1);
cc->env = env;
- cc->m = *messagep;
+ cc->m = *m;
cc->msgfp = msgfp;
client_ssl_optional(cc->pcb);
client_sender(cc->pcb, "");
- client_rcpt(cc->pcb, NULL, "%s@%s", messagep->sender.user,
- messagep->sender.domain);
+ client_rcpt(cc->pcb, NULL, "%s@%s", m->sender.user,
+ m->sender.domain);
/* Construct an appropriate reason line. */
- reason = messagep->session_errorline;
+ reason = m->session_errorline;
if (strlen(reason) > 4 && (*reason == '1' || *reason == '6'))
reason += 4;
@@ -102,9 +102,9 @@ bounce_session(struct smtpd *env, int fd, struct message *messagep)
"Below is a copy of the original message:\n"
"\n",
env->sc_hostname,
- messagep->sender.user, messagep->sender.domain,
+ m->sender.user, m->sender.domain,
time_to_text(time(NULL)),
- messagep->recipient.user, messagep->recipient.domain,
+ m->recipient.user, m->recipient.domain,
reason);
/* setup event */
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index 3e8aa3ded91..7ee4bace72d 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.123 2010/11/29 15:25:55 gilles Exp $ */
+/* $OpenBSD: lka.c,v 1.124 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -614,7 +614,7 @@ lka_expand_resume(struct smtpd *env, struct lkasession *lkasession)
void
lka_expansion_done(struct smtpd *env, struct lkasession *lkasession)
{
- struct message message;
+ struct envelope message;
struct path *path;
/* delivery list is empty OR expansion led to an error, reject */
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index 5ac6326286d..c507aea44e1 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.52 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: mda.c,v 1.53 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -61,7 +61,7 @@ mda_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
if (s == NULL)
fatal(NULL);
msgbuf_init(&s->w);
- s->msg = *(struct message *)imsg->data;
+ s->msg = *(struct envelope *)imsg->data;
s->msg.status = S_MESSAGE_TEMPFAILURE;
s->id = mda_id++;
s->datafp = fdopen(imsg->fd, "r");
diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c
index 72dac373691..9a376ed16f2 100644
--- a/usr.sbin/smtpd/mfa.c
+++ b/usr.sbin/smtpd/mfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa.c,v 1.55 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: mfa.c,v 1.56 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -37,8 +37,8 @@
void mfa_imsg(struct smtpd *, struct imsgev *, struct imsg *);
__dead void mfa_shutdown(void);
void mfa_sig_handler(int, short, void *);
-void mfa_test_mail(struct smtpd *, struct message *);
-void mfa_test_rcpt(struct smtpd *, struct message *);
+void mfa_test_mail(struct smtpd *, struct envelope *);
+void mfa_test_rcpt(struct smtpd *, struct envelope *);
void mfa_test_rcpt_resume(struct smtpd *, struct submit_status *);
int mfa_strip_source_route(char *, size_t);
@@ -167,7 +167,7 @@ mfa(struct smtpd *env)
}
void
-mfa_test_mail(struct smtpd *env, struct message *m)
+mfa_test_mail(struct smtpd *env, struct envelope *m)
{
struct submit_status ss;
@@ -202,7 +202,7 @@ accept:
}
void
-mfa_test_rcpt(struct smtpd *env, struct message *m)
+mfa_test_rcpt(struct smtpd *env, struct envelope *m)
{
struct submit_status ss;
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index 24d20942a6a..b6fa2aa3742 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.102 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: mta.c,v 1.103 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -49,9 +49,9 @@ void mta_pickup(struct mta_session *, void *);
void mta_event(int, short, void *);
void mta_status(struct mta_session *, const char *, ...);
-void mta_message_status(struct message *, char *);
-void mta_message_log(struct mta_session *, struct message *);
-void mta_message_done(struct mta_session *, struct message *);
+void mta_message_status(struct envelope *, char *);
+void mta_message_log(struct mta_session *, struct envelope *);
+void mta_message_done(struct mta_session *, struct envelope *);
void mta_connect_done(int, short, void *);
void mta_request_datafd(struct mta_session *);
@@ -61,7 +61,7 @@ mta_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
struct ramqueue_batch *rq_batch;
struct mta_session *s;
struct mta_relay *relay;
- struct message *m;
+ struct envelope *m;
struct secret *secret;
struct dns *dns;
struct ssl *ssl;
@@ -135,7 +135,7 @@ mta_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
m = malloc(sizeof *m);
if (m == NULL)
fatal(NULL);
- *m = *(struct message *)imsg->data;
+ *m = *(struct envelope *)imsg->data;
strlcpy(m->session_errorline, "000 init",
sizeof(m->session_errorline));
@@ -347,7 +347,7 @@ mta_enter_state(struct mta_session *s, int newstate, void *p)
struct secret secret;
struct mta_relay *relay;
struct sockaddr *sa;
- struct message *m;
+ struct envelope *m;
struct smtp_client *pcb;
int max_reuse;
@@ -658,7 +658,7 @@ void
mta_status(struct mta_session *s, const char *fmt, ...)
{
char *status;
- struct message *m, *next;
+ struct envelope *m, *next;
va_list ap;
va_start(ap, fmt);
@@ -683,7 +683,7 @@ mta_status(struct mta_session *s, const char *fmt, ...)
}
void
-mta_message_status(struct message *m, char *status)
+mta_message_status(struct envelope *m, char *status)
{
/*
* Previous delivery attempts might have assigned an errorline of
@@ -700,7 +700,7 @@ mta_message_status(struct message *m, char *status)
}
void
-mta_message_log(struct mta_session *s, struct message *m)
+mta_message_log(struct mta_session *s, struct envelope *m)
{
struct mta_relay *relay = TAILQ_FIRST(&s->relays);
char *status = m->session_errorline;
@@ -717,7 +717,7 @@ mta_message_log(struct mta_session *s, struct message *m)
}
void
-mta_message_done(struct mta_session *s, struct message *m)
+mta_message_done(struct mta_session *s, struct envelope *m)
{
switch (m->session_errorline[0]) {
case '6':
@@ -747,7 +747,7 @@ void
mta_request_datafd(struct mta_session *s)
{
struct ramqueue_batch rq_batch;
- struct message *m;
+ struct envelope *m;
m = TAILQ_FIRST(&s->recipients);
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index 22b57be98f5..e0ffc834296 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.100 2011/04/17 11:16:57 gilles Exp $ */
+/* $OpenBSD: queue.c,v 1.101 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -47,7 +47,7 @@ void
queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
{
struct submit_status ss;
- struct message *m;
+ struct envelope *m;
struct ramqueue_batch *rq_batch;
int fd, ret;
@@ -341,17 +341,17 @@ queue_purge(struct smtpd *env, enum queue_kind qkind, char *queuepath)
}
void
-queue_submit_envelope(struct smtpd *env, struct message *message)
+queue_submit_envelope(struct smtpd *env, struct envelope *m)
{
imsg_compose_event(env->sc_ievs[PROC_QUEUE],
IMSG_QUEUE_SUBMIT_ENVELOPE, 0, 0, -1,
- message, sizeof(struct message));
+ m, sizeof(*m));
}
void
-queue_commit_envelopes(struct smtpd *env, struct message *message)
+queue_commit_envelopes(struct smtpd *env, struct envelope *m)
{
imsg_compose_event(env->sc_ievs[PROC_QUEUE],
IMSG_QUEUE_COMMIT_ENVELOPES, 0, 0, -1,
- message, sizeof(struct message));
+ m, sizeof(*m));
}
diff --git a/usr.sbin/smtpd/queue_backend.c b/usr.sbin/smtpd/queue_backend.c
index 555a9d08d08..4d14f47881b 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.8 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: queue_backend.c,v 1.9 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -40,7 +40,7 @@ int fsqueue_init(struct smtpd *);
int fsqueue_message(struct smtpd *, enum queue_kind,
enum queue_op, u_int32_t *);
int fsqueue_envelope(struct smtpd *, enum queue_kind,
- enum queue_op , struct message *);
+ enum queue_op , struct envelope *);
struct queue_backend queue_backends[] = {
@@ -103,29 +103,29 @@ queue_message_fd_rw(struct smtpd *env, enum queue_kind qkind, u_int32_t msgid)
int
queue_envelope_create(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
- return env->sc_queue->envelope(env, qkind, QOP_CREATE, envelope);
+ return env->sc_queue->envelope(env, qkind, QOP_CREATE, m);
}
int
queue_envelope_delete(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
- return env->sc_queue->envelope(env, qkind, QOP_DELETE, envelope);
+ return env->sc_queue->envelope(env, qkind, QOP_DELETE, m);
}
int
queue_envelope_load(struct smtpd *env, enum queue_kind qkind,
- u_int64_t evpid, struct message *envelope)
+ u_int64_t evpid, struct envelope *m)
{
- envelope->evpid = evpid;
- return env->sc_queue->envelope(env, qkind, QOP_LOAD, envelope);
+ m->evpid = evpid;
+ return env->sc_queue->envelope(env, qkind, QOP_LOAD, m);
}
int
queue_envelope_update(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
- return env->sc_queue->envelope(env, qkind, QOP_UPDATE, envelope);
+ return env->sc_queue->envelope(env, qkind, QOP_UPDATE, m);
}
diff --git a/usr.sbin/smtpd/queue_fsqueue.c b/usr.sbin/smtpd/queue_fsqueue.c
index 76c3f747f10..4b4f80c44a8 100644
--- a/usr.sbin/smtpd/queue_fsqueue.c
+++ b/usr.sbin/smtpd/queue_fsqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_fsqueue.c,v 1.9 2011/04/16 09:13:38 gilles Exp $ */
+/* $OpenBSD: queue_fsqueue.c,v 1.10 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -41,9 +41,9 @@
static char *fsqueue_getpath(enum queue_kind);
/*static*/ u_int16_t fsqueue_hash(u_int32_t);
-static int fsqueue_envelope_load(struct smtpd *, enum queue_kind, struct message *);
-static int fsqueue_envelope_update(struct smtpd *, enum queue_kind, struct message *);
-static int fsqueue_envelope_delete(struct smtpd *, enum queue_kind, struct message *);
+static int fsqueue_envelope_load(struct smtpd *, enum queue_kind, struct envelope *);
+static int fsqueue_envelope_update(struct smtpd *, enum queue_kind, struct envelope *);
+static int fsqueue_envelope_delete(struct smtpd *, enum queue_kind, struct envelope *);
static int fsqueue_message_create(struct smtpd *, enum queue_kind, u_int32_t *);
static int fsqueue_message_commit(struct smtpd *, enum queue_kind, u_int32_t);
@@ -56,7 +56,7 @@ int fsqueue_init(struct smtpd *);
int fsqueue_message(struct smtpd *, enum queue_kind,
enum queue_op, u_int32_t *);
int fsqueue_envelope(struct smtpd *, enum queue_kind,
- enum queue_op , struct message *);
+ enum queue_op , struct envelope *);
static char *
fsqueue_getpath(enum queue_kind kind)
@@ -94,7 +94,7 @@ fsqueue_hash(u_int32_t h)
static int
fsqueue_envelope_create(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
char evpname[MAXPATHLEN];
FILE *fp;
@@ -108,7 +108,7 @@ again:
rnd = (u_int32_t)arc4random();
if (rnd == 0)
goto again;
- evpid = envelope->evpid | rnd;
+ evpid = m->evpid | rnd;
if (! bsnprintf(evpname, sizeof(evpname), "%s/%08x%s/%016llx",
fsqueue_getpath(qkind),
@@ -129,15 +129,15 @@ again:
if (fp == NULL)
fatal("fsqueue_envelope_create: fdopen");
- envelope->creation = time(NULL);
- envelope->evpid = evpid;
+ m->creation = time(NULL);
+ m->evpid = evpid;
if (qkind == Q_BOUNCE) {
- envelope->lasttry = 0;
- envelope->retry = 0;
+ m->lasttry = 0;
+ m->retry = 0;
}
- if (fwrite(envelope, sizeof (struct message), 1, fp) != 1) {
+ if (fwrite(m, sizeof (*m), 1, fp) != 1) {
if (errno == ENOSPC)
goto tempfail;
fatal("fsqueue_envelope_create: write");
@@ -157,24 +157,24 @@ tempfail:
fclose(fp);
else if (fd != -1)
close(fd);
- envelope->creation = 0;
- envelope->evpid = 0;
+ m->creation = 0;
+ m->evpid = 0;
return 0;
}
static int
fsqueue_envelope_load(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
char pathname[MAXPATHLEN];
FILE *fp;
if (! bsnprintf(pathname, sizeof(pathname), "%s/%04x/%08x%s/%016llx",
fsqueue_getpath(qkind),
- fsqueue_hash(evpid_to_msgid(envelope->evpid)),
- evpid_to_msgid(envelope->evpid),
- PATH_ENVELOPES, envelope->evpid))
+ fsqueue_hash(evpid_to_msgid(m->evpid)),
+ evpid_to_msgid(m->evpid),
+ PATH_ENVELOPES, m->evpid))
fatalx("fsqueue_envelope_load: snprintf");
fp = fopen(pathname, "r");
@@ -183,7 +183,7 @@ fsqueue_envelope_load(struct smtpd *env, enum queue_kind qkind,
return 0;
fatal("fsqueue_envelope_load: fopen");
}
- if (fread(envelope, sizeof(struct message), 1, fp) != 1)
+ if (fread(m, sizeof(*m), 1, fp) != 1)
fatal("fsqueue_envelope_load: fread");
fclose(fp);
return 1;
@@ -191,24 +191,24 @@ fsqueue_envelope_load(struct smtpd *env, enum queue_kind qkind,
static int
fsqueue_envelope_update(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
char temp[MAXPATHLEN];
char dest[MAXPATHLEN];
FILE *fp;
u_int64_t batch_id;
- batch_id = envelope->batch_id;
- envelope->batch_id = 0;
+ batch_id = m->batch_id;
+ m->batch_id = 0;
if (! bsnprintf(temp, sizeof(temp), "%s/envelope.tmp", PATH_QUEUE))
fatalx("fsqueue_envelope_update");
if (! bsnprintf(dest, sizeof(dest), "%s/%04x/%08x%s/%016llx",
fsqueue_getpath(qkind),
- fsqueue_hash(evpid_to_msgid(envelope->evpid)),
- evpid_to_msgid(envelope->evpid),
- PATH_ENVELOPES, envelope->evpid))
+ fsqueue_hash(evpid_to_msgid(m->evpid)),
+ evpid_to_msgid(m->evpid),
+ PATH_ENVELOPES, m->evpid))
fatal("fsqueue_envelope_update: snprintf");
fp = fopen(temp, "w");
@@ -217,7 +217,7 @@ fsqueue_envelope_update(struct smtpd *env, enum queue_kind qkind,
goto tempfail;
fatal("fsqueue_envelope_update: open");
}
- if (fwrite(envelope, sizeof(struct message), 1, fp) != 1) {
+ if (fwrite(m, sizeof(*m), 1, fp) != 1) {
if (errno == ENOSPC)
goto tempfail;
fatal("fsqueue_envelope_update: fwrite");
@@ -231,7 +231,7 @@ fsqueue_envelope_update(struct smtpd *env, enum queue_kind qkind,
fatal("fsqueue_envelope_update: rename");
}
- envelope->batch_id = batch_id;
+ m->batch_id = batch_id;
return 1;
tempfail:
@@ -240,36 +240,36 @@ tempfail:
if (fp)
fclose(fp);
- envelope->batch_id = batch_id;
+ m->batch_id = batch_id;
return 0;
}
static int
fsqueue_envelope_delete(struct smtpd *env, enum queue_kind qkind,
- struct message *envelope)
+ struct envelope *m)
{
char pathname[MAXPATHLEN];
u_int16_t hval;
- hval = fsqueue_hash(evpid_to_msgid(envelope->evpid));
+ hval = fsqueue_hash(evpid_to_msgid(m->evpid));
if (! bsnprintf(pathname, sizeof(pathname), "%s/%04x/%08x%s/%016llx",
fsqueue_getpath(qkind),
hval,
- evpid_to_msgid(envelope->evpid),
+ evpid_to_msgid(m->evpid),
PATH_ENVELOPES,
- envelope->evpid))
+ m->evpid))
fatal("fsqueue_envelope_delete: snprintf");
if (unlink(pathname) == -1)
fatal("fsqueue_envelope_delete: unlink");
if (! bsnprintf(pathname, sizeof(pathname), "%s/%04x/%08x%s", PATH_QUEUE,
- hval, evpid_to_msgid(envelope->evpid), PATH_ENVELOPES))
+ hval, evpid_to_msgid(m->evpid), PATH_ENVELOPES))
fatal("fsqueue_envelope_delete: snprintf");
if (rmdir(pathname) != -1)
- fsqueue_message_delete(env, qkind, evpid_to_msgid(envelope->evpid));
+ fsqueue_message_delete(env, qkind, evpid_to_msgid(m->evpid));
return 1;
}
@@ -632,20 +632,20 @@ fsqueue_message(struct smtpd *env, enum queue_kind qkind,
int
fsqueue_envelope(struct smtpd *env, enum queue_kind qkind,
- enum queue_op qop, struct message *envelope)
+ enum queue_op qop, struct envelope *m)
{
switch (qop) {
case QOP_CREATE:
- return fsqueue_envelope_create(env, qkind, envelope);
+ return fsqueue_envelope_create(env, qkind, m);
case QOP_DELETE:
- return fsqueue_envelope_delete(env, qkind, envelope);
+ return fsqueue_envelope_delete(env, qkind, m);
case QOP_LOAD:
- return fsqueue_envelope_load(env, qkind, envelope);
+ return fsqueue_envelope_load(env, qkind, m);
case QOP_UPDATE:
- return fsqueue_envelope_update(env, qkind, envelope);
+ return fsqueue_envelope_update(env, qkind, m);
default:
fatalx("queue_fsqueue_envelope: unsupported operation.");
diff --git a/usr.sbin/smtpd/queue_shared.c b/usr.sbin/smtpd/queue_shared.c
index 12f17bfd2c3..494c76c5ecf 100644
--- a/usr.sbin/smtpd/queue_shared.c
+++ b/usr.sbin/smtpd/queue_shared.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_shared.c,v 1.45 2011/04/15 17:30:23 gilles Exp $ */
+/* $OpenBSD: queue_shared.c,v 1.46 2011/04/17 11:39:22 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -55,61 +55,61 @@ struct qwalk {
int walk_simple(struct qwalk *, char *);
int walk_queue(struct qwalk *, char *);
-void display_envelope(struct message *, int);
+void display_envelope(struct envelope *, int);
void getflag(u_int *, int, char *, char *, size_t);
int
-bounce_record_message(struct smtpd *env, struct message *messagep, struct message *mbounce)
+bounce_record_message(struct smtpd *env, struct envelope *m, struct envelope *bounce)
{
u_int32_t msgid;
- if (messagep->type == T_BOUNCE_MESSAGE) {
+ if (m->type == T_BOUNCE_MESSAGE) {
log_debug("mailer daemons loop detected !");
return 0;
}
- *mbounce = *messagep;
- mbounce->type = T_BOUNCE_MESSAGE;
- mbounce->status &= ~S_MESSAGE_PERMFAILURE;
+ *bounce = *m;
+ bounce->type = T_BOUNCE_MESSAGE;
+ bounce->status &= ~S_MESSAGE_PERMFAILURE;
- msgid = evpid_to_msgid(messagep->evpid);
+ msgid = evpid_to_msgid(m->evpid);
if (! queue_message_create(env, Q_BOUNCE, &msgid))
return 0;
- mbounce->evpid = msgid_to_evpid(msgid);
- if (! queue_envelope_create(env, Q_BOUNCE, mbounce))
+ bounce->evpid = msgid_to_evpid(msgid);
+ if (! queue_envelope_create(env, Q_BOUNCE, bounce))
return 0;
return queue_message_commit(env, Q_BOUNCE, msgid);
}
void
-queue_message_update(struct smtpd *env, struct message *messagep)
+queue_message_update(struct smtpd *env, struct envelope *m)
{
- messagep->flags &= ~F_MESSAGE_PROCESSING;
- messagep->status &= ~(S_MESSAGE_ACCEPTED|S_MESSAGE_REJECTED);
- messagep->batch_id = 0;
- messagep->retry++;
+ m->flags &= ~F_MESSAGE_PROCESSING;
+ m->status &= ~(S_MESSAGE_ACCEPTED|S_MESSAGE_REJECTED);
+ m->batch_id = 0;
+ m->retry++;
- if (messagep->status & S_MESSAGE_PERMFAILURE) {
- if (messagep->type != T_BOUNCE_MESSAGE &&
- messagep->sender.user[0] != '\0') {
- struct message bounce;
+ if (m->status & S_MESSAGE_PERMFAILURE) {
+ if (m->type != T_BOUNCE_MESSAGE &&
+ m->sender.user[0] != '\0') {
+ struct envelope bounce;
- bounce_record_message(env, messagep, &bounce);
+ bounce_record_message(env, m, &bounce);
}
- queue_envelope_delete(env, Q_QUEUE, messagep);
+ queue_envelope_delete(env, Q_QUEUE, m);
return;
}
- if (messagep->status & S_MESSAGE_TEMPFAILURE) {
- messagep->status &= ~S_MESSAGE_TEMPFAILURE;
- queue_envelope_update(env, Q_QUEUE, messagep);
+ if (m->status & S_MESSAGE_TEMPFAILURE) {
+ m->status &= ~S_MESSAGE_TEMPFAILURE;
+ queue_envelope_update(env, Q_QUEUE, m);
return;
}
/* no error, remove envelope */
- queue_envelope_delete(env, Q_QUEUE, messagep);
+ queue_envelope_delete(env, Q_QUEUE, m);
}
struct qwalk *
@@ -247,7 +247,7 @@ void
show_queue(char *queuepath, int flags)
{
char path[MAXPATHLEN];
- struct message message;
+ struct envelope message;
struct qwalk *q;
FILE *fp;
@@ -267,7 +267,7 @@ show_queue(char *queuepath, int flags)
}
errno = 0;
- if (fread(&message, sizeof(struct message), 1, fp) != 1)
+ if (fread(&message, sizeof(message), 1, fp) != 1)
err(1, "%s", path);
fclose(fp);
@@ -278,42 +278,42 @@ show_queue(char *queuepath, int flags)
}
void
-display_envelope(struct message *envelope, int flags)
+display_envelope(struct envelope *m, int flags)
{
char status[128];
status[0] = '\0';
- getflag(&envelope->status, S_MESSAGE_TEMPFAILURE, "TEMPFAIL",
+ getflag(&m->status, S_MESSAGE_TEMPFAILURE, "TEMPFAIL",
status, sizeof(status));
- if (envelope->status)
- errx(1, "%016llx: unexpected status 0x%04x", envelope->evpid,
- envelope->status);
+ if (m->status)
+ errx(1, "%016llx: unexpected status 0x%04x", m->evpid,
+ m->status);
- getflag(&envelope->flags, F_MESSAGE_BOUNCE, "BOUNCE",
+ getflag(&m->flags, F_MESSAGE_BOUNCE, "BOUNCE",
status, sizeof(status));
- getflag(&envelope->flags, F_MESSAGE_AUTHENTICATED, "AUTH",
+ getflag(&m->flags, F_MESSAGE_AUTHENTICATED, "AUTH",
status, sizeof(status));
- getflag(&envelope->flags, F_MESSAGE_PROCESSING, "PROCESSING",
+ getflag(&m->flags, F_MESSAGE_PROCESSING, "PROCESSING",
status, sizeof(status));
- getflag(&envelope->flags, F_MESSAGE_SCHEDULED, "SCHEDULED",
+ getflag(&m->flags, F_MESSAGE_SCHEDULED, "SCHEDULED",
status, sizeof(status));
- getflag(&envelope->flags, F_MESSAGE_ENQUEUED, "ENQUEUED",
+ getflag(&m->flags, F_MESSAGE_ENQUEUED, "ENQUEUED",
status, sizeof(status));
- getflag(&envelope->flags, F_MESSAGE_FORCESCHEDULE, "SCHEDULED_MANUAL",
+ getflag(&m->flags, F_MESSAGE_FORCESCHEDULE, "SCHEDULED_MANUAL",
status, sizeof(status));
- if (envelope->flags)
- errx(1, "%016llx: unexpected flags 0x%04x", envelope->evpid,
- envelope->flags);
+ if (m->flags)
+ errx(1, "%016llx: unexpected flags 0x%04x", m->evpid,
+ m->flags);
if (status[0])
status[strlen(status) - 1] = '\0';
else
strlcpy(status, "-", sizeof(status));
- switch (envelope->type) {
+ switch (m->type) {
case T_MDA_MESSAGE:
printf("MDA");
break;
@@ -328,16 +328,16 @@ display_envelope(struct message *envelope, int flags)
}
printf("|%016llx|%s|%s@%s|%s@%s|%d|%d|%u",
- envelope->evpid,
+ m->evpid,
status,
- envelope->sender.user, envelope->sender.domain,
- envelope->recipient.user, envelope->recipient.domain,
- envelope->lasttry,
- envelope->expire,
- envelope->retry);
+ m->sender.user, m->sender.domain,
+ m->recipient.user, m->recipient.domain,
+ m->lasttry,
+ m->expire,
+ m->retry);
- if (envelope->session_errorline[0] != '\0')
- printf("|%s", envelope->session_errorline);
+ if (m->session_errorline[0] != '\0')
+ printf("|%s", m->session_errorline);
printf("\n");
}
diff --git a/usr.sbin/smtpd/ramqueue.c b/usr.sbin/smtpd/ramqueue.c
index 9045956d6e1..5beb2076561 100644
--- a/usr.sbin/smtpd/ramqueue.c
+++ b/usr.sbin/smtpd/ramqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ramqueue.c,v 1.4 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: ramqueue.c,v 1.5 2011/04/17 11:39:23 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -38,13 +38,13 @@
#include "smtpd.h"
#include "log.h"
-int ramqueue_expire(struct smtpd *, struct message *, time_t);
-void ramqueue_insert(struct ramqueue *, struct message *, time_t);
-time_t ramqueue_next_schedule(struct message *, time_t);
+int ramqueue_expire(struct smtpd *, struct envelope *, time_t);
+void ramqueue_insert(struct ramqueue *, struct envelope *, time_t);
+time_t ramqueue_next_schedule(struct envelope *, time_t);
int ramqueue_host_cmp(struct ramqueue_host *, struct ramqueue_host *);
struct ramqueue_host *ramqueue_get_host(struct ramqueue *, char *);
struct ramqueue_batch *ramqueue_get_batch(struct ramqueue *,
- struct ramqueue_host *, struct message *);
+ struct ramqueue_host *, struct envelope *);
void ramqueue_put_host(struct ramqueue *, struct ramqueue_host *);
void ramqueue_put_batch(struct ramqueue *, struct ramqueue_batch *);
int ramqueue_load_offline(struct ramqueue *);
@@ -129,7 +129,7 @@ ramqueue_load(struct ramqueue *rqueue, time_t *nsched)
{
char path[MAXPATHLEN];
time_t curtm;
- struct message envelope;
+ struct envelope envelope;
static struct qwalk *q = NULL;
struct ramqueue_envelope *rq_evp;
@@ -169,7 +169,7 @@ ramqueue_load(struct ramqueue *rqueue, time_t *nsched)
}
void
-ramqueue_insert(struct ramqueue *rqueue, struct message *envelope, time_t curtm)
+ramqueue_insert(struct ramqueue *rqueue, struct envelope *envelope, time_t curtm)
{
struct ramqueue_envelope *rq_evp;
struct ramqueue_envelope *evp;
@@ -214,9 +214,9 @@ ramqueue_remove(struct ramqueue *rqueue, struct ramqueue_envelope *rq_evp)
}
int
-ramqueue_expire(struct smtpd *env, struct message *envelope, time_t curtm)
+ramqueue_expire(struct smtpd *env, struct envelope *envelope, time_t curtm)
{
- struct message bounce;
+ struct envelope bounce;
if (curtm - envelope->creation >= envelope->expire) {
message_set_errormsg(envelope,
@@ -231,7 +231,7 @@ ramqueue_expire(struct smtpd *env, struct message *envelope, time_t curtm)
}
time_t
-ramqueue_next_schedule(struct message *envelope, time_t curtm)
+ramqueue_next_schedule(struct envelope *envelope, time_t curtm)
{
time_t delay;
@@ -297,7 +297,7 @@ ramqueue_put_host(struct ramqueue *rqueue, struct ramqueue_host *host)
struct ramqueue_batch *
ramqueue_get_batch(struct ramqueue *rqueue, struct ramqueue_host *host,
- struct message *envelope)
+ struct envelope *envelope)
{
struct ramqueue_batch *rq_batch;
diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c
index cf4844bb384..28eb88fe33f 100644
--- a/usr.sbin/smtpd/runner.c
+++ b/usr.sbin/smtpd/runner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: runner.c,v 1.103 2011/04/15 19:03:28 gilles Exp $ */
+/* $OpenBSD: runner.c,v 1.104 2011/04/17 11:39:23 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -57,11 +57,11 @@ void runner_process_batch(struct smtpd *, struct ramqueue_envelope *, time_t);
void runner_purge_run(void);
void runner_purge_message(u_int32_t);
-int runner_check_loop(struct smtpd *, struct message *);
+int runner_check_loop(struct smtpd *, struct envelope *);
int runner_force_message_to_ramqueue(struct ramqueue *, u_int32_t);
-void ramqueue_insert(struct ramqueue *, struct message *, time_t);
+void ramqueue_insert(struct ramqueue *, struct envelope *, time_t);
/*temporary*/
u_int16_t fsqueue_hash(u_int32_t);
@@ -71,7 +71,7 @@ u_int32_t filename_to_msgid(char *);
void
runner_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
{
- struct message *m;
+ struct envelope *m;
switch (imsg->hdr.type) {
case IMSG_QUEUE_COMMIT_MESSAGE:
@@ -100,7 +100,7 @@ runner_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
* bounce (and insert bounce in ramqueue).
*/
if (m->status & S_MESSAGE_PERMFAILURE) {
- struct message bounce;
+ struct envelope bounce;
if (m->type != T_BOUNCE_MESSAGE &&
m->sender.user[0] != '\0') {
@@ -349,7 +349,7 @@ int
runner_process_envelope(struct smtpd *env, struct ramqueue_envelope *rq_evp, time_t curtm)
{
size_t mta_av, mda_av, bnc_av;
- struct message envelope;
+ struct envelope envelope;
mta_av = env->sc_maxconn - env->stats->mta.sessions_active;
mda_av = env->sc_maxconn - env->stats->mda.sessions_active;
@@ -380,7 +380,7 @@ runner_process_envelope(struct smtpd *env, struct ramqueue_envelope *rq_evp, tim
}
if (runner_check_loop(env, &envelope)) {
- struct message bounce;
+ struct envelope bounce;
message_set_errormsg(&envelope, "loop has been detected");
bounce_record_message(env, &envelope, &bounce);
@@ -405,7 +405,7 @@ runner_process_batch(struct smtpd *env, struct ramqueue_envelope *rq_evp, time_t
{
struct ramqueue_host *host = rq_evp->host;
struct ramqueue_batch *batch = rq_evp->batch;
- struct message envelope;
+ struct envelope envelope;
int fd;
switch (batch->type) {
@@ -506,7 +506,7 @@ runner_force_message_to_ramqueue(struct ramqueue *rqueue, u_int32_t msgid)
char path[MAXPATHLEN];
DIR *dirp;
struct dirent *dp;
- struct message envelope;
+ struct envelope envelope;
time_t curtm;
if (! bsnprintf(path, MAXPATHLEN, "%s/%04x/%08x/envelopes",
@@ -620,7 +620,7 @@ delroot:
}
int
-runner_check_loop(struct smtpd *env, struct message *messagep)
+runner_check_loop(struct smtpd *env, struct envelope *messagep)
{
int fd;
FILE *fp;
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index 1908db95caa..2164f8bc6c3 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.82 2011/04/15 17:01:05 gilles Exp $ */
+/* $OpenBSD: smtp.c,v 1.83 2011/04/17 11:39:23 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -152,7 +152,7 @@ smtp_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg)
case IMSG_SMTP_ENQUEUE:
imsg_compose_event(iev, IMSG_SMTP_ENQUEUE, 0, 0,
smtp_enqueue(env, NULL), imsg->data,
- sizeof(struct message));
+ sizeof(struct envelope));
return;
}
}
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index cf9aa129b2f..a6a207b74a6 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.216 2011/04/17 11:16:57 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.217 2011/04/17 11:39:23 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -430,8 +430,8 @@ enum message_flags {
F_MESSAGE_BOUNCE = 0x40
};
-struct message {
- TAILQ_ENTRY(message) entry;
+struct envelope {
+ TAILQ_ENTRY(envelope) entry;
enum message_type type;
@@ -560,7 +560,7 @@ struct session {
u_char *s_buf;
int s_buflen;
struct timeval s_tv;
- struct message s_msg;
+ struct envelope s_msg;
short s_nresp[STATE_COUNT];
size_t rcptcount;
long s_datalen;
@@ -638,7 +638,7 @@ struct smtpd {
TAILQ_HEAD(maplist, map) *sc_maps, *sc_maps_reload;
TAILQ_HEAD(rulelist, rule) *sc_rules, *sc_rules_reload;
SPLAY_HEAD(sessiontree, session) sc_sessions;
- SPLAY_HEAD(msgtree, message) sc_messages;
+ SPLAY_HEAD(msgtree, envelope) sc_messages;
SPLAY_HEAD(ssltree, ssl) *sc_ssl;
SPLAY_HEAD(childtree, child) children;
SPLAY_HEAD(lkatree, lkasession) lka_sessions;
@@ -752,7 +752,7 @@ struct submit_status {
} u;
enum message_flags flags;
struct sockaddr_storage ss;
- struct message msg;
+ struct envelope msg;
};
struct forward_req {
@@ -782,7 +782,7 @@ struct secret {
struct mda_session {
LIST_ENTRY(mda_session) entry;
- struct message msg;
+ struct envelope msg;
struct msgbuf w;
struct event ev;
u_int32_t id;
@@ -816,7 +816,7 @@ struct lkasession {
u_int8_t iterations;
u_int32_t pending;
enum lkasession_flags flags;
- struct message message;
+ struct envelope message;
struct submit_status ss;
};
@@ -871,7 +871,7 @@ struct mta_session {
char *host;
int port;
int flags;
- TAILQ_HEAD(,message) recipients;
+ TAILQ_HEAD(,envelope) recipients;
TAILQ_HEAD(,mta_relay) relays;
objid_t secmapid;
char *secret;
@@ -934,7 +934,7 @@ struct queue_backend {
int (*init)(struct smtpd *);
int (*message)(struct smtpd *, enum queue_kind, enum queue_op, u_int32_t *);
int (*envelope)(struct smtpd *, enum queue_kind, enum queue_op,
- struct message *);
+ struct envelope *);
};
extern void (*imsg_callback)(struct smtpd *, struct imsgev *, struct imsg *);
@@ -955,9 +955,9 @@ int authenticate_user(char *, char *);
/* bounce.c */
-int bounce_session(struct smtpd *, int, struct message *);
+int bounce_session(struct smtpd *, int, struct envelope *);
int bounce_session_switch(struct smtpd *, FILE *, enum session_state *, char *,
- struct message *);
+ struct envelope *);
void bounce_event(int, short, void *);
@@ -1045,8 +1045,8 @@ int cmdline_symset(char *);
/* queue.c */
pid_t queue(struct smtpd *);
-void queue_submit_envelope(struct smtpd *, struct message *);
-void queue_commit_envelopes(struct smtpd *, struct message *);
+void queue_submit_envelope(struct smtpd *, struct envelope *);
+void queue_commit_envelopes(struct smtpd *, struct envelope *);
/* queue_backend.c */
@@ -1058,21 +1058,21 @@ int queue_message_fd_r(struct smtpd *, enum queue_kind, u_int32_t);
int queue_message_fd_rw(struct smtpd *, enum queue_kind, u_int32_t);
int queue_message_purge(struct smtpd *, enum queue_kind, u_int32_t);
int queue_envelope_create(struct smtpd *, enum queue_kind,
- struct message *);
+ struct envelope *);
int queue_envelope_delete(struct smtpd *, enum queue_kind,
- struct message *);
+ struct envelope *);
int queue_envelope_load(struct smtpd *, enum queue_kind,
- u_int64_t, struct message *);
+ u_int64_t, struct envelope *);
int queue_envelope_update(struct smtpd *, enum queue_kind,
- struct message *);
+ struct envelope *);
/* queue_shared.c */
-void queue_message_update(struct smtpd *, struct message *);
+void queue_message_update(struct smtpd *, struct envelope *);
struct qwalk *qwalk_new(char *);
int qwalk(struct qwalk *, char *);
void qwalk_close(struct qwalk *);
-int bounce_record_message(struct smtpd *, struct message *, struct message *);
+int bounce_record_message(struct smtpd *, struct envelope *, struct envelope *);
void show_queue(char *, int);
@@ -1096,7 +1096,7 @@ RB_PROTOTYPE(hosttree, ramqueue_host, host_entry, ramqueue_host_cmp);
/* runner.c */
pid_t runner(struct smtpd *);
-void message_reset_flags(struct message *);
+void message_reset_flags(struct envelope *);
/* smtp.c */
@@ -1164,8 +1164,8 @@ int valid_message_uid(char *);
char *time_to_text(time_t);
int secure_file(int, char *, struct passwd *, int);
void lowercase(char *, char *, size_t);
-void message_set_errormsg(struct message *, char *, ...);
-char *message_get_errormsg(struct message *);
+void message_set_errormsg(struct envelope *, char *, ...);
+char *message_get_errormsg(struct envelope *);
void sa_set_port(struct sockaddr *, int);
struct path *path_dup(struct path *);
u_int64_t generate_uid(void);
@@ -1173,5 +1173,5 @@ void fdlimit(double);
int availdesc(void);
u_int32_t evpid_to_msgid(u_int64_t);
u_int64_t msgid_to_evpid(u_int32_t);
-u_int32_t filename_to_msgpid(char *);
+u_int32_t filename_to_msgid(char *);
u_int64_t filename_to_evpid(char *);
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 2adb910efda..34072fab662 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.42 2011/04/15 17:21:24 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.43 2011/04/17 11:39:23 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -351,16 +351,16 @@ lowercase(char *buf, char *s, size_t len)
}
void
-message_set_errormsg(struct message *messagep, char *fmt, ...)
+message_set_errormsg(struct envelope *m, char *fmt, ...)
{
int ret;
va_list ap;
va_start(ap, fmt);
- ret = vsnprintf(messagep->session_errorline, MAX_LINE_SIZE, fmt, ap);
+ ret = vsnprintf(m->session_errorline, MAX_LINE_SIZE, fmt, ap);
if (ret >= MAX_LINE_SIZE)
- strlcpy(messagep->session_errorline + (MAX_LINE_SIZE - 4), "...", 4);
+ strlcpy(m->session_errorline + (MAX_LINE_SIZE - 4), "...", 4);
/* this should not happen */
if (ret == -1)
@@ -370,9 +370,9 @@ message_set_errormsg(struct message *messagep, char *fmt, ...)
}
char *
-message_get_errormsg(struct message *messagep)
+message_get_errormsg(struct envelope *m)
{
- return messagep->session_errorline;
+ return m->session_errorline;
}
void