diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-04-10 18:14:18 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-04-10 18:14:18 +0000 |
commit | 947570c2dfa143c02843251a4a25174dc82b8f6d (patch) | |
tree | 75540a7de8967a70b8accc4472de26e5d40cda94 /usr.sbin/relayd/relay.c | |
parent | cb8567a8fbd81d929ec3617f3232c13214d6ce99 (diff) |
the relay filter action needs special handling to work correctly
Diffstat (limited to 'usr.sbin/relayd/relay.c')
-rw-r--r-- | usr.sbin/relayd/relay.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 71925f42995..0929369ebc9 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.22 2007/03/21 00:08:08 reyk Exp $ */ +/* $OpenBSD: relay.c,v 1.23 2007/04/10 18:14:17 reyk Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -863,8 +863,7 @@ relay_handle_http(struct ctl_relay_event *cre, struct protonode *pn, case NODE_ACTION_FILTER: DPRINTF("relay_handle_http: filter '%s: %s'", pn->key, pn->value); - if (fnmatch(pn->value, pk->value, FNM_CASEFOLD) == - FNM_NOMATCH) { + if (fnmatch(pn->value, pk->value, FNM_CASEFOLD) == 0) { if (pn->flags & PNFLAG_MARK) cre->marked++; cre->nodes[pn->id] = 1; @@ -1261,9 +1260,20 @@ relay_read_http(struct bufferevent *bev, void *arg) } if (cre->done) { RB_FOREACH(pn, proto_tree, cre->tree) { - if (cre->nodes[pn->id]) { + switch (pn->action) { + case NODE_ACTION_FILTER: + if (!cre->nodes[pn->id]) + continue; cre->nodes[pn->id] = 0; - continue; + break; + case NODE_ACTION_APPEND: + case NODE_ACTION_CHANGE: + case NODE_ACTION_EXPECT: + if (cre->nodes[pn->id]) { + cre->nodes[pn->id] = 0; + continue; + } + break; } switch (pn->action) { case NODE_ACTION_APPEND: |