summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relay.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-11-20 15:10:47 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-11-20 15:10:47 +0000
commitce660b2ac3ee604b365811a2954bdf69f0f509bb (patch)
treeb6ac04e3db7198e79abf07c70cdc0e91e50968ef /usr.sbin/relayd/relay.c
parent99a28ee8511d6bcbc1901562af4c4966c7a6f367 (diff)
another fix to handle "expect" and "filter" actions in the new style
correctly. ok pyr@
Diffstat (limited to 'usr.sbin/relayd/relay.c')
-rw-r--r--usr.sbin/relayd/relay.c17
1 files changed, 8 insertions, 9 deletions
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 <reyk@openbsd.org>
@@ -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);
}