summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchl <chl@openbsd.org>2012-01-18 13:41:54 +0000
committerchl <chl@openbsd.org>2012-01-18 13:41:54 +0000
commit5bf7149be58acb76cd5f4d1881d6fc3d4c35313c (patch)
treed0ccf3c5486073a35a7555e63d5a97ad20a4d5a4
parentnpppdctl related files should be removed. Added a mention about that. (diff)
downloadwireguard-openbsd-5bf7149be58acb76cd5f4d1881d6fc3d4c35313c.tar.xz
wireguard-openbsd-5bf7149be58acb76cd5f4d1881d6fc3d4c35313c.zip
Add new filters callbacks for:
- network events (CONNECT/CLOSE) - commands (QUIT/RSET) ok gilles@ eric@
-rw-r--r--usr.sbin/smtpd/filter.c84
-rw-r--r--usr.sbin/smtpd/filter.h44
-rw-r--r--usr.sbin/smtpd/mfa.c70
-rw-r--r--usr.sbin/smtpd/mfa_session.c47
-rw-r--r--usr.sbin/smtpd/smtp.c7
-rw-r--r--usr.sbin/smtpd/smtp_session.c40
-rw-r--r--usr.sbin/smtpd/smtpd.c6
-rw-r--r--usr.sbin/smtpd/smtpd.h23
8 files changed, 284 insertions, 37 deletions
diff --git a/usr.sbin/smtpd/filter.c b/usr.sbin/smtpd/filter.c
index d9ac54b92d8..0dad92ead2a 100644
--- a/usr.sbin/smtpd/filter.c
+++ b/usr.sbin/smtpd/filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filter.c,v 1.5 2011/11/28 22:13:27 chl Exp $ */
+/* $OpenBSD: filter.c,v 1.6 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -35,6 +35,9 @@ static struct filter_internals {
struct event ev;
struct imsgbuf ibuf;
+ enum filter_status (*connect_cb)(u_int64_t, struct filter_connect *, void *);
+ void *connect_cb_arg;
+
enum filter_status (*helo_cb)(u_int64_t, struct filter_helo *, void *);
void *helo_cb_arg;
@@ -49,6 +52,16 @@ static struct filter_internals {
enum filter_status (*dataline_cb)(u_int64_t, struct filter_dataline *, void *);
void *dataline_cb_arg;
+
+ enum filter_status (*quit_cb)(u_int64_t, void *);
+ void *quit_cb_arg;
+
+ enum filter_status (*close_cb)(u_int64_t, void *);
+ void *close_cb_arg;
+
+ enum filter_status (*rset_cb)(u_int64_t, void *);
+ void *rset_cb_arg;
+
} fi;
static void filter_handler(int, short, void *);
@@ -74,6 +87,12 @@ filter_loop(void)
}
void
+filter_register_connect_callback(enum filter_status (*cb)(u_int64_t, struct filter_connect *, void *), void *cb_arg)
+{
+ filter_register_callback(FILTER_CONNECT, cb, cb_arg);
+}
+
+void
filter_register_helo_callback(enum filter_status (*cb)(u_int64_t, struct filter_helo *, void *), void *cb_arg)
{
filter_register_callback(FILTER_HELO, cb, cb_arg);
@@ -103,10 +122,33 @@ filter_register_dataline_callback(enum filter_status (*cb)(u_int64_t, struct fil
filter_register_callback(FILTER_DATALINE, cb, cb_arg);
}
+void
+filter_register_quit_callback(enum filter_status (*cb)(u_int64_t, void *), void *cb_arg)
+{
+ filter_register_callback(FILTER_QUIT, cb, cb_arg);
+}
+
+void
+filter_register_close_callback(enum filter_status (*cb)(u_int64_t, void *), void *cb_arg)
+{
+ filter_register_callback(FILTER_CLOSE, cb, cb_arg);
+}
+
+void
+filter_register_rset_callback(enum filter_status (*cb)(u_int64_t, void *), void *cb_arg)
+{
+ filter_register_callback(FILTER_RSET, cb, cb_arg);
+}
+
static void
filter_register_callback(enum filter_type type, void *cb, void *cb_arg)
{
switch (type) {
+ case FILTER_CONNECT:
+ fi.connect_cb = cb;
+ fi.connect_cb_arg = cb_arg;
+ break;
+
case FILTER_HELO:
fi.helo_cb = cb;
fi.helo_cb_arg = cb_arg;
@@ -131,6 +173,24 @@ filter_register_callback(enum filter_type type, void *cb, void *cb_arg)
fi.dataline_cb = cb;
fi.dataline_cb_arg = cb_arg;
break;
+
+ case FILTER_QUIT:
+ fi.quit_cb = cb;
+ fi.quit_cb_arg = cb_arg;
+ break;
+
+ case FILTER_CLOSE:
+ fi.close_cb = cb;
+ fi.close_cb_arg = cb_arg;
+ break;
+
+ case FILTER_RSET:
+ fi.rset_cb = cb;
+ fi.rset_cb_arg = cb_arg;
+ break;
+
+ default:
+ errx(1, "filter_register_callback: unknown filter type");
}
}
@@ -177,6 +237,12 @@ filter_handler(int fd, short event, void *p)
errx(1, "API version mismatch");
switch (imsg.hdr.type) {
+ case FILTER_CONNECT:
+ if (fi.connect_cb == NULL)
+ goto ignore;
+ ret = fi.connect_cb(fm.cl_id, &fm.u.connect,
+ fi.connect_cb_arg);
+ break;
case FILTER_HELO:
if (fi.helo_cb == NULL)
goto ignore;
@@ -207,6 +273,22 @@ filter_handler(int fd, short event, void *p)
ret = fi.dataline_cb(fm.cl_id, &fm.u.dataline,
fi.dataline_cb_arg);
break;
+ case FILTER_QUIT:
+ if (fi.quit_cb == NULL)
+ goto ignore;
+ ret = fi.quit_cb(fm.cl_id, fi.quit_cb_arg);
+ break;
+ case FILTER_CLOSE:
+ if (fi.close_cb == NULL)
+ goto ignore;
+ ret = fi.close_cb(fm.cl_id, fi.close_cb_arg);
+ break;
+ case FILTER_RSET:
+ if (fi.rset_cb == NULL)
+ goto ignore;
+ ret = fi.rset_cb(fm.cl_id, fi.rset_cb_arg);
+ break;
+
default:
errx(1, "unsupported imsg");
}
diff --git a/usr.sbin/smtpd/filter.h b/usr.sbin/smtpd/filter.h
index 5ccd66b4194..4768a370f1d 100644
--- a/usr.sbin/smtpd/filter.h
+++ b/usr.sbin/smtpd/filter.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: filter.h,v 1.6 2011/11/28 22:13:27 chl Exp $ */
+/* $OpenBSD: filter.h,v 1.7 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -16,6 +16,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/socket.h>
+
+#include <netdb.h>
#define FILTER_API_VERSION 50
@@ -39,32 +42,42 @@ enum filter_status {
};
enum filter_type {
- FILTER_HELO = 0x01,
- FILTER_EHLO = 0x02,
- FILTER_MAIL = 0x04,
- FILTER_RCPT = 0x08,
- FILTER_DATALINE = 0x10,
+ FILTER_CONNECT = 0x001,
+ FILTER_HELO = 0x002,
+ FILTER_EHLO = 0x004,
+ FILTER_MAIL = 0x008,
+ FILTER_RCPT = 0x010,
+ FILTER_DATALINE = 0x020,
+ FILTER_QUIT = 0x040,
+ FILTER_CLOSE = 0x080,
+ FILTER_RSET = 0x100,
};
-struct filter_helo {
- char buffer[1024];
+struct filter_connect {
+ char hostname[MAXHOSTNAMELEN];
+ struct sockaddr_storage hostaddr;
};
+struct filter_helo {
+ char helohost[MAXHOSTNAMELEN];
+};
+
struct filter_mail {
- char user[MAX_LOCALPART_SIZE];
- char domain[MAX_DOMAINPART_SIZE];
+ char user[MAX_LOCALPART_SIZE];
+ char domain[MAX_DOMAINPART_SIZE];
};
struct filter_rcpt {
- char user[MAX_LOCALPART_SIZE];
- char domain[MAX_DOMAINPART_SIZE];
+ char user[MAX_LOCALPART_SIZE];
+ char domain[MAX_DOMAINPART_SIZE];
};
struct filter_dataline {
- char line[MAX_LINE_SIZE];
+ char line[MAX_LINE_SIZE];
};
union filter_union {
+ struct filter_connect connect;
struct filter_helo helo;
struct filter_mail mail;
struct filter_rcpt rcpt;
@@ -84,8 +97,13 @@ struct filter_msg {
void filter_init(void);
void filter_loop(void);
+void filter_register_connect_callback(enum filter_status (*)(u_int64_t, struct filter_connect *, void *), void *);
void filter_register_helo_callback(enum filter_status (*)(u_int64_t, struct filter_helo *, void *), void *);
void filter_register_ehlo_callback(enum filter_status (*)(u_int64_t, struct filter_helo *, void *), void *);
void filter_register_mail_callback(enum filter_status (*)(u_int64_t, struct filter_mail *, void *), void *);
void filter_register_rcpt_callback(enum filter_status (*)(u_int64_t, struct filter_rcpt *, void *), void *);
void filter_register_dataline_callback(enum filter_status (*)(u_int64_t, struct filter_dataline *, void *), void *);
+void filter_register_quit_callback(enum filter_status (*)(u_int64_t, void *), void *);
+void filter_register_close_callback(enum filter_status (*)(u_int64_t, void *), void *);
+void filter_register_rset_callback(enum filter_status (*)(u_int64_t, void *), void *);
+
diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c
index 16658d9121f..2296973c849 100644
--- a/usr.sbin/smtpd/mfa.c
+++ b/usr.sbin/smtpd/mfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa.c,v 1.66 2011/11/14 19:23:41 chl Exp $ */
+/* $OpenBSD: mfa.c,v 1.67 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -41,11 +41,15 @@
static void mfa_imsg(struct imsgev *, struct imsg *);
static void mfa_shutdown(void);
static void mfa_sig_handler(int, short, void *);
+static void mfa_test_connect(struct envelope *);
static void mfa_test_helo(struct envelope *);
static void mfa_test_mail(struct envelope *);
static void mfa_test_rcpt(struct envelope *);
static void mfa_test_rcpt_resume(struct submit_status *);
static void mfa_test_dataline(struct submit_status *);
+static void mfa_test_quit(struct envelope *);
+static void mfa_test_close(struct envelope *);
+static void mfa_test_rset(struct envelope *);
static int mfa_strip_source_route(char *, size_t);
static int mfa_fork_filter(struct filter *);
void mfa_session(struct submit_status *, enum session_state);
@@ -59,6 +63,9 @@ mfa_imsg(struct imsgev *iev, struct imsg *imsg)
if (iev->proc == PROC_SMTP) {
switch (imsg->hdr.type) {
+ case IMSG_MFA_CONNECT:
+ mfa_test_connect(imsg->data);
+ return;
case IMSG_MFA_HELO:
mfa_test_helo(imsg->data);
return;
@@ -71,6 +78,15 @@ mfa_imsg(struct imsgev *iev, struct imsg *imsg)
case IMSG_MFA_DATALINE:
mfa_test_dataline(imsg->data);
return;
+ case IMSG_MFA_QUIT:
+ mfa_test_quit(imsg->data);
+ return;
+ case IMSG_MFA_CLOSE:
+ mfa_test_close(imsg->data);
+ return;
+ case IMSG_MFA_RSET:
+ mfa_test_rset(imsg->data);
+ return;
}
}
@@ -227,6 +243,18 @@ mfa(void)
}
static void
+mfa_test_connect(struct envelope *e)
+{
+ struct submit_status ss;
+
+ ss.id = e->session_id;
+ ss.code = 530;
+ ss.envelope = *e;
+
+ mfa_session(&ss, S_CONNECTED);
+}
+
+static void
mfa_test_helo(struct envelope *e)
{
struct submit_status ss;
@@ -236,7 +264,6 @@ mfa_test_helo(struct envelope *e)
ss.envelope = *e;
mfa_session(&ss, S_HELO);
- return;
}
static void
@@ -297,7 +324,8 @@ refuse:
}
static void
-mfa_test_rcpt_resume(struct submit_status *ss) {
+mfa_test_rcpt_resume(struct submit_status *ss)
+{
if (ss->code != 250) {
imsg_compose_event(env->sc_ievs[PROC_SMTP], IMSG_MFA_RCPT, 0, 0, -1, ss,
sizeof(*ss));
@@ -318,6 +346,42 @@ mfa_test_dataline(struct submit_status *ss)
mfa_session(ss, S_DATACONTENT);
}
+static void
+mfa_test_quit(struct envelope *e)
+{
+ struct submit_status ss;
+
+ ss.id = e->session_id;
+ ss.code = 530;
+ ss.envelope = *e;
+
+ mfa_session(&ss, S_QUIT);
+}
+
+static void
+mfa_test_close(struct envelope *e)
+{
+ struct submit_status ss;
+
+ ss.id = e->session_id;
+ ss.code = 530;
+ ss.envelope = *e;
+
+ mfa_session(&ss, S_CLOSE);
+}
+
+static void
+mfa_test_rset(struct envelope *e)
+{
+ struct submit_status ss;
+
+ ss.id = e->session_id;
+ ss.code = 530;
+ ss.envelope = *e;
+
+ mfa_session(&ss, S_RSET);
+}
+
static int
mfa_strip_source_route(char *buf, size_t len)
{
diff --git a/usr.sbin/smtpd/mfa_session.c b/usr.sbin/smtpd/mfa_session.c
index 585dee20383..9a9c5609325 100644
--- a/usr.sbin/smtpd/mfa_session.c
+++ b/usr.sbin/smtpd/mfa_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa_session.c,v 1.6 2011/11/28 22:13:27 chl Exp $ */
+/* $OpenBSD: mfa_session.c,v 1.7 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org>
@@ -96,10 +96,19 @@ mfa_session_proceed(struct mfa_session *ms)
fm.version = FILTER_API_VERSION;
switch (ms->state) {
- case S_HELO:
+
+ case S_CONNECTED:
+ fm.type = FILTER_CONNECT;
+ if (strlcpy(fm.u.connect.hostname, ms->ss.envelope.hostname,
+ sizeof(fm.u.connect.hostname)) >= sizeof(fm.u.connect.hostname))
+ fatalx("mfa_session_proceed: CONNECT: truncation");
+ fm.u.connect.hostaddr = ms->ss.envelope.ss;
+ break;
+
+ case S_HELO:
fm.type = FILTER_HELO;
- if (strlcpy(fm.u.helo.buffer, ms->ss.envelope.helo,
- sizeof(fm.u.helo.buffer)) >= sizeof(fm.u.helo.buffer))
+ if (strlcpy(fm.u.helo.helohost, ms->ss.envelope.helo,
+ sizeof(fm.u.helo.helohost)) >= sizeof(fm.u.helo.helohost))
fatalx("mfa_session_proceed: HELO: truncation");
break;
@@ -130,6 +139,18 @@ mfa_session_proceed(struct mfa_session *ms)
fatalx("mfa_session_proceed: DATA: line truncation");
break;
+ case S_QUIT:
+ fm.type = FILTER_QUIT;
+ break;
+
+ case S_CLOSE:
+ fm.type = FILTER_CLOSE;
+ break;
+
+ case S_RSET:
+ fm.type = FILTER_RSET;
+ break;
+
default:
fatalx("mfa_session_proceed: no such state");
}
@@ -162,6 +183,9 @@ mfa_session_done(struct mfa_session *ms)
enum imsg_type imsg_type;
switch (ms->state) {
+ case S_CONNECTED:
+ imsg_type = IMSG_MFA_CONNECT;
+ break;
case S_HELO:
imsg_type = IMSG_MFA_HELO;
break;
@@ -189,6 +213,17 @@ mfa_session_done(struct mfa_session *ms)
sizeof(ms->ss.u.dataline));
imsg_type = IMSG_MFA_DATALINE;
break;
+ case S_QUIT:
+ imsg_type = IMSG_MFA_QUIT;
+ break;
+ case S_CLOSE:
+ imsg_type = IMSG_MFA_CLOSE;
+ /* Why answer back to SMTP? The session is closed! */
+ mfa_session_destroy(ms);
+ return;
+ case S_RSET:
+ imsg_type = IMSG_MFA_RSET;
+ break;
default:
fatalx("mfa_session_done: unsupported state");
}
@@ -277,11 +312,15 @@ mfa_session_imsg(int fd, short event, void *p)
fatalx("API version mismatch");
switch (imsg.hdr.type) {
+ case FILTER_CONNECT:
case FILTER_HELO:
case FILTER_EHLO:
case FILTER_MAIL:
case FILTER_RCPT:
case FILTER_DATALINE:
+ case FILTER_QUIT:
+ case FILTER_CLOSE:
+ case FILTER_RSET:
ms = mfa_session_xfind(fm.id);
/* overwrite filter code */
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index dcc3ac222ac..e56913c47f0 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.98 2012/01/13 14:27:55 eric Exp $ */
+/* $OpenBSD: smtp.c,v 1.99 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -82,16 +82,21 @@ smtp_imsg(struct imsgev *iev, struct imsg *imsg)
if (iev->proc == PROC_MFA) {
switch (imsg->hdr.type) {
+ case IMSG_MFA_CONNECT:
case IMSG_MFA_HELO:
case IMSG_MFA_MAIL:
case IMSG_MFA_RCPT:
case IMSG_MFA_DATALINE:
+ case IMSG_MFA_QUIT:
+ case IMSG_MFA_RSET:
ss = imsg->data;
s = session_lookup(ss->id);
if (s == NULL)
return;
session_pickup(s, ss);
return;
+ case IMSG_MFA_CLOSE:
+ return;
}
}
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index fd037c06732..65c6887f211 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.153 2012/01/13 14:27:55 eric Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.154 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -370,9 +370,10 @@ session_rfc5321_ehlo_handler(struct session *s, char *args)
static int
session_rfc5321_rset_handler(struct session *s, char *args)
{
- session_enter_state(s, S_HELO);
- session_respond(s, "250 2.0.0 Reset state");
+ session_enter_state(s, S_RSET);
+ session_imsg(s, PROC_MFA, IMSG_MFA_RSET, 0, 0, -1, &s->s_msg,
+ sizeof(s->s_msg));
return 1;
}
@@ -405,7 +406,6 @@ session_rfc5321_mail_handler(struct session *s, char *args)
s->rcptcount = 0;
s->s_msg.id = 0;
- s->s_msg.ss = s->s_ss;
session_enter_state(s, S_MAIL_MFA);
session_imsg(s, PROC_MFA, IMSG_MFA_MAIL, 0, 0, -1, &s->s_msg,
@@ -443,6 +443,8 @@ session_rfc5321_quit_handler(struct session *s, char *args)
{
s->s_flags |= F_QUIT;
session_respond(s, "221 2.0.0 %s Closing connection", env->sc_hostname);
+ session_imsg(s, PROC_MFA, IMSG_MFA_QUIT, 0, 0, -1, &s->s_msg,
+ sizeof(s->s_msg));
return 1;
}
@@ -603,7 +605,22 @@ session_pickup(struct session *s, struct submit_status *ss)
}
switch (s->s_state) {
+
+ case S_CONNECTED:
+ session_enter_state(s, S_INIT);
+ s->s_msg.session_id = s->s_id;
+ s->s_msg.ss = s->s_ss;
+ session_imsg(s, PROC_MFA, IMSG_MFA_CONNECT, 0, 0, -1,
+ &s->s_msg, sizeof(s->s_msg));
+ break;
+
case S_INIT:
+ if (ss->code != 250) {
+ session_enter_state(s, S_CLOSE);
+ session_respond(s, "%d Connection rejected", ss->code);
+ return;
+ }
+ log_debug("session_pickup: greeting client");
session_respond(s, SMTPD_BANNER, env->sc_hostname);
session_enter_state(s, S_GREETED);
break;
@@ -623,6 +640,11 @@ session_pickup(struct session *s, struct submit_status *ss)
session_enter_state(s, S_HELO);
break;
+ case S_RSET:
+ session_respond(s, "250 2.0.0 Reset state");
+ session_enter_state(s, S_HELO);
+ break;
+
case S_HELO:
if (ss == NULL)
fatalx("bad ss at S_HELO");
@@ -760,7 +782,7 @@ session_pickup(struct session *s, struct submit_status *ss)
void
session_init(struct listener *l, struct session *s)
{
- s->s_state = S_INIT;
+ session_enter_state(s, S_CONNECTED);
if (l->flags & F_SMTPS) {
ssl_session_init(s);
@@ -1033,6 +1055,9 @@ session_destroy(struct session *s)
IMSG_QUEUE_REMOVE_MESSAGE, 0, 0, -1, &s->s_msg,
sizeof(s->s_msg));
+ session_imsg(s, PROC_MFA, IMSG_MFA_CLOSE, 0, 0, -1, &s->s_msg,
+ sizeof(s->s_msg));
+
ssl_session_destroy(s);
if (s->s_bev != NULL)
@@ -1236,7 +1261,8 @@ session_strstate(int state)
static char buf[32];
switch (state) {
- CASE(S_INVALID);
+ CASE(S_NEW);
+ CASE(S_CONNECTED);
CASE(S_INIT);
CASE(S_GREETED);
CASE(S_TLS);
@@ -1244,6 +1270,7 @@ session_strstate(int state)
CASE(S_AUTH_USERNAME);
CASE(S_AUTH_PASSWORD);
CASE(S_AUTH_FINALIZE);
+ CASE(S_RSET);
CASE(S_HELO);
CASE(S_MAIL_MFA);
CASE(S_MAIL_QUEUE);
@@ -1255,6 +1282,7 @@ session_strstate(int state)
CASE(S_DATACONTENT);
CASE(S_DONE);
CASE(S_QUIT);
+ CASE(S_CLOSE);
default:
snprintf(buf, sizeof(buf), "S_??? (%d)", state);
return buf;
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 4a97c923f04..2f98c62de04 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.147 2012/01/13 14:01:58 eric Exp $ */
+/* $OpenBSD: smtpd.c,v 1.148 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -1183,10 +1183,14 @@ imsg_to_str(int type)
CASE(IMSG_MDA_SESS_NEW);
CASE(IMSG_MDA_DONE);
+ CASE(IMSG_MFA_CONNECT);
CASE(IMSG_MFA_HELO);
CASE(IMSG_MFA_MAIL);
CASE(IMSG_MFA_RCPT);
CASE(IMSG_MFA_DATALINE);
+ CASE(IMSG_MFA_QUIT);
+ CASE(IMSG_MFA_CLOSE);
+ CASE(IMSG_MFA_RSET);
CASE(IMSG_QUEUE_CREATE_MESSAGE);
CASE(IMSG_QUEUE_SUBMIT_ENVELOPE);
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 516bdededd6..b6db0f6642e 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.279 2012/01/13 21:58:35 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.280 2012/01/18 13:41:54 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -132,10 +132,14 @@ enum imsg_type {
IMSG_MDA_SESS_NEW,
IMSG_MDA_DONE,
- IMSG_MFA_HELO,
- IMSG_MFA_MAIL,
- IMSG_MFA_RCPT,
- IMSG_MFA_DATALINE,
+ IMSG_MFA_CONNECT,
+ IMSG_MFA_HELO,
+ IMSG_MFA_MAIL,
+ IMSG_MFA_RCPT,
+ IMSG_MFA_DATALINE,
+ IMSG_MFA_QUIT,
+ IMSG_MFA_CLOSE,
+ IMSG_MFA_RSET,
IMSG_QUEUE_CREATE_MESSAGE,
IMSG_QUEUE_SUBMIT_ENVELOPE,
@@ -475,7 +479,8 @@ struct child {
};
enum session_state {
- S_INVALID = 0,
+ S_NEW = 0,
+ S_CONNECTED,
S_INIT,
S_GREETED,
S_TLS,
@@ -483,6 +488,7 @@ enum session_state {
S_AUTH_USERNAME,
S_AUTH_PASSWORD,
S_AUTH_FINALIZE,
+ S_RSET,
S_HELO,
S_MAIL_MFA,
S_MAIL_QUEUE,
@@ -493,9 +499,10 @@ enum session_state {
S_DATA_QUEUE,
S_DATACONTENT,
S_DONE,
- S_QUIT
+ S_QUIT,
+ S_CLOSE
};
-#define STATE_COUNT 19
+#define STATE_COUNT 22
struct ssl {
SPLAY_ENTRY(ssl) ssl_nodes;