From ce660b2ac3ee604b365811a2954bdf69f0f509bb Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Tue, 20 Nov 2007 15:10:47 +0000 Subject: another fix to handle "expect" and "filter" actions in the new style correctly. ok pyr@ --- usr.sbin/relayd/relay.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'usr.sbin/relayd/relay.c') diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index b20e082ea8d..80b1a03a7e5 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.57 2007/11/20 09:59:09 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.58 2007/11/20 15:10:46 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter @@ -825,21 +825,20 @@ relay_resolve(struct ctl_relay_event *cre, { struct session *con = (struct session *)cre->con; char buf[READ_BUF_SIZE], *ptr; + int id; switch (pn->action) { case NODE_ACTION_FILTER: - if (!cre->nodes[pn->id]) + if (cre->nodes[proot->id] <= 1) return (0); cre->nodes[pn->id] = 0; break; case NODE_ACTION_EXPECT: - if (proot == pn) - cre->nodes[proot->id]--; - if (cre->nodes[proot->id]) { - if (SIMPLEQ_NEXT(pn, entry) == NULL) - cre->nodes[proot->id] = 0; + id = cre->nodes[proot->id]; + if (SIMPLEQ_NEXT(pn, entry) == NULL) + cre->nodes[proot->id] = 0; + if (id > 1) return (0); - } break; default: if (cre->nodes[pn->id]) { @@ -979,7 +978,7 @@ relay_handle_http(struct ctl_relay_event *cre, struct protonode *proot, * A client may specify the header line for multiple times * trying to circumvent the filter. */ - if (cre->nodes[proot->id]) { + if (cre->nodes[proot->id] > 1) { relay_close(con, "repeated header line"); return (PN_FAIL); } -- cgit v1.2.3