summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.h
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-05-18 20:23:36 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-05-18 20:23:36 +0000
commit70d04b4454983db7f8ade89c13bbf7afd8c5c946 (patch)
treed75be19c4c8d99803499e99d4c00ac0170e449ac /usr.sbin/smtpd/smtpd.h
parent8ea800ac124a5b897090f73a4ecb57ffc0b0075d (diff)
Complete rework of bufferevent event masking allowing for more
strictness: - Drop clients attempting command pipelining; protects the daemon from all kinds of abuse. - Replace F_EVLOCKED flag with F_WRITEONLY which has cleaner sematics: when up, session must not be destroyed nor read from, but may be written to. - Write callback becomes a central place for enabling EV_READ. - Delay bufferevent creation until after ssl handshake is completed. A bunch of session error stats were added to smtpctl's "show stats". These could help spotting event masking errors in the future. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtpd.h')
-rw-r--r--usr.sbin/smtpd/smtpd.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 5a25bb49864..2d464a3db45 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.107 2009/05/09 20:03:07 jacekm Exp $ */
+/* $OpenBSD: smtpd.h,v 1.108 2009/05/18 20:23:35 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -547,7 +547,6 @@ enum session_state {
S_DONE,
S_QUIT
};
-#define IS_AUTH(x) ((x) == S_AUTH_INIT || (x) == S_AUTH_USERNAME || (x) == S_AUTH_PASSWORD || (x) == S_AUTH_FINALIZE)
struct ssl {
SPLAY_ENTRY(ssl) ssl_nodes;
@@ -590,7 +589,7 @@ enum session_flags {
F_AUTHENTICATED = 0x10,
F_PEERHASTLS = 0x20,
F_PEERHASAUTH = 0x40,
- F_EVLOCKED = 0x80
+ F_WRITEONLY = 0x80
};
struct session {
@@ -680,8 +679,15 @@ struct s_session {
size_t starttls;
size_t starttls_active;
- size_t aborted;
- size_t timeout;
+ size_t read_error;
+ size_t read_timeout;
+ size_t read_eof;
+ size_t write_error;
+ size_t write_timeout;
+ size_t write_eof;
+ size_t toofast;
+ size_t tempfail;
+ size_t linetoolong;
};
struct stats {
@@ -907,6 +913,7 @@ void session_pickup(struct session *, struct submit_status *);
void session_destroy(struct session *);
void session_respond(struct session *, char *, ...)
__attribute__ ((format (printf, 2, 3)));
+void session_bufferevent_new(struct session *);
SPLAY_PROTOTYPE(sessiontree, session, s_nodes, session_cmp);