From 791fa9e812bffdd1d18a422a95f1a38d088de2a0 Mon Sep 17 00:00:00 2001 From: Charles Longeau Date: Mon, 28 Nov 2011 22:13:28 +0000 Subject: use STATUS_* filter codes, instead of -1/0/1 hard coded values ok gilles@ --- usr.sbin/smtpd/filter.c | 6 ++---- usr.sbin/smtpd/filter.h | 3 ++- usr.sbin/smtpd/mfa_session.c | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/smtpd/filter.c b/usr.sbin/smtpd/filter.c index 39c4e634c84..d9ac54b92d8 100644 --- a/usr.sbin/smtpd/filter.c +++ b/usr.sbin/smtpd/filter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.c,v 1.4 2011/11/16 10:24:41 chl Exp $ */ +/* $OpenBSD: filter.c,v 1.5 2011/11/28 22:13:27 chl Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -215,8 +215,6 @@ filter_handler(int fd, short event, void *p) case STATUS_ACCEPT: case STATUS_REJECT: fm.code = ret; - if (ret == STATUS_REJECT) - fm.code = -1; imsg_compose(&fi.ibuf, imsg.hdr.type, 0, 0, -1, &fm, sizeof fm); evflags |= EV_WRITE; @@ -235,7 +233,7 @@ filter_handler(int fd, short event, void *p) ignore: imsg_free(&imsg); - fm.code = 0; + fm.code = STATUS_IGNORE; imsg_compose(&fi.ibuf, imsg.hdr.type, 0, 0, -1, &fm, sizeof fm); evflags |= EV_WRITE; event_set(&fi.ev, 0, evflags, filter_handler, &fi); diff --git a/usr.sbin/smtpd/filter.h b/usr.sbin/smtpd/filter.h index 6c33e4654a1..5ccd66b4194 100644 --- a/usr.sbin/smtpd/filter.h +++ b/usr.sbin/smtpd/filter.h @@ -1,4 +1,4 @@ -/* $OpenBSD: filter.h,v 1.5 2011/11/16 10:24:41 chl Exp $ */ +/* $OpenBSD: filter.h,v 1.6 2011/11/28 22:13:27 chl Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -32,6 +32,7 @@ #endif enum filter_status { + STATUS_IGNORE, STATUS_REJECT, STATUS_ACCEPT, STATUS_WAITING diff --git a/usr.sbin/smtpd/mfa_session.c b/usr.sbin/smtpd/mfa_session.c index 4d92262a181..585dee20383 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.5 2011/10/23 09:30:07 gilles Exp $ */ +/* $OpenBSD: mfa_session.c,v 1.6 2011/11/28 22:13:27 chl Exp $ */ /* * Copyright (c) 2011 Gilles Chehade @@ -144,7 +144,7 @@ mfa_session_proceed(struct mfa_session *ms) void mfa_session_pickup(struct mfa_session *ms) { - if (ms->fm.code == -1) { + if (ms->fm.code == STATUS_REJECT) { mfa_session_fail(ms); return; } @@ -288,7 +288,7 @@ mfa_session_imsg(int fd, short event, void *p) ms->fm.code = fm.code; /* success, overwrite */ - if (fm.code == 1) + if (fm.code == STATUS_ACCEPT) ms->fm = fm; mfa_session_pickup(ms); -- cgit v1.2.3