From 3227121c77a9f3359c21cefe580a085c77bf3c9e Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Fri, 30 Jan 2009 21:52:56 +0000 Subject: when decreasing ssl related counters, make sure the session was flagged as F_SECURE. while at it, add "smtp.sessions.aborted" which keeps track of sessions which were interrupted before completion. --- usr.sbin/smtpd/smtp_session.c | 3 ++- usr.sbin/smtpd/smtpctl.c | 3 ++- usr.sbin/smtpd/smtpd.h | 4 +++- usr.sbin/smtpd/ssl.c | 8 +++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 7d890bf93ab..408765b1663 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.51 2009/01/30 21:40:21 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.52 2009/01/30 21:52:55 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -947,6 +947,7 @@ session_error(struct bufferevent *bev, short event, void *p) * but set F_QUIT flag so that we destroy it as * soon as the event lock is removed. */ + s_smtp.aborted++; if (s->s_flags & F_EVLOCKED) s->s_flags |= F_QUIT; else diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 34d49d3a9ef..cd465cac18f 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.11 2009/01/30 21:40:21 gilles Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.12 2009/01/30 21:52:55 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard @@ -279,6 +279,7 @@ show_stats_output(struct imsg *imsg) printf("runner.active = %zd\n", s_runner.active); printf("smtp.sessions = %zd\n", s_smtp.sessions); + printf("smtp.sessions.aborted = %zd\n", s_smtp.aborted); printf("smtp.sessions.active = %zd\n", s_smtp.sessions_active); printf("smtp.sessions.ssmtp = %zd\n", s_smtp.ssmtp); printf("smtp.sessions.ssmtp.active = %zd\n", s_smtp.ssmtp_active); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index da097f01504..de87462f5bd 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.67 2009/01/30 21:40:21 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.68 2009/01/30 21:52:55 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade @@ -663,6 +663,8 @@ struct s_smtp { size_t starttls; size_t starttls_active; + + size_t aborted; }; struct stats { diff --git a/usr.sbin/smtpd/ssl.c b/usr.sbin/smtpd/ssl.c index 4cf4b88c672..6dd662c9f42 100644 --- a/usr.sbin/smtpd/ssl.c +++ b/usr.sbin/smtpd/ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl.c,v 1.8 2009/01/30 21:40:21 gilles Exp $ */ +/* $OpenBSD: ssl.c,v 1.9 2009/01/30 21:52:55 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -595,10 +595,12 @@ void ssl_session_destroy(struct session *s) { if (s->s_l->flags & F_SSMTP) { - s_smtp.ssmtp_active--; + if (s->s_flags & F_SECURE) + s_smtp.ssmtp_active--; } if (s->s_l->flags & F_STARTTLS) { - s_smtp.starttls_active--; + if (s->s_flags & F_SECURE) + s_smtp.starttls_active--; } SSL_free(s->s_ssl); } -- cgit v1.2.3