diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-12-21 18:51:09 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2008-12-21 18:51:09 +0000 |
commit | 84b08bf7a81edb9d2b318384c7885dfa1994bcff (patch) | |
tree | 875d0f8c69935cc8470b52260f082d934f874ff6 | |
parent | 3de5604e2caf04b966d719c4930e572d83947d58 (diff) |
- missing prototype + smtp.c was misusing session_auth_pickup()
- unlike starttls, ssmtp sets the F_SECURE flag on session before helo/ehlo
handlers are called. this means that if we clear all flags in helo/
helo handlers, we prevent smtpd from advertising AUTH as it will do
so only for F_SECURE sessions. This commits unbreaks SMTP AUTH with
smtp sessions. Problem spotted by James Turner <james@bsdgroup.org>
-rw-r--r-- | usr.sbin/smtpd/smtp.c | 5 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index 3219d07e260..84d0e345432 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp.c,v 1.10 2008/12/21 02:18:46 gilles Exp $ */ +/* $OpenBSD: smtp.c,v 1.11 2008/12/21 18:51:08 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -46,6 +46,7 @@ void smtp_setup_events(struct smtpd *); void smtp_disable_events(struct smtpd *); void smtp_accept(int, short, void *); void session_timeout(int, short, void *); +void session_auth_pickup(struct session *, char *, size_t); void smtp_sig_handler(int sig, short event, void *p) @@ -178,7 +179,7 @@ smtp_dispatch_parent(int sig, short event, void *p) if (reply->value) s->s_flags |= F_AUTHENTICATED; - session_auth_pickup(s, NULL); + session_auth_pickup(s, NULL, 0); break; } diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 15d30207d60..2a4080b6c27 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.33 2008/12/21 02:18:46 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.34 2008/12/21 18:51:08 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -304,7 +304,8 @@ session_rfc5321_helo_handler(struct session *s, char *args) } s->s_state = S_HELO; - s->s_flags = 0; + if (s->s_flags & F_SECURE) + s->s_flags = F_SECURE; if (s->s_ss.ss_family == PF_INET) { struct sockaddr_in *ssin = (struct sockaddr_in *)&s->s_ss; @@ -343,7 +344,9 @@ session_rfc5321_ehlo_handler(struct session *s, char *args) } s->s_state = S_HELO; - s->s_flags = F_EHLO; + if (s->s_flags & F_SECURE) + s->s_flags = F_SECURE; + s->s_flags |= F_EHLO; s->s_flags |= F_8BITMIME; if (s->s_ss.ss_family == PF_INET) { |