diff options
author | 2007-11-20 15:10:46 +0000 | |
---|---|---|
committer | 2007-11-20 15:10:46 +0000 | |
commit | 7fc3d0a94d50c4fcca5e5807153da297ea8d8e93 (patch) | |
tree | 735931701e98c9e18276b51eca7fc8698c559fb5 | |
parent | remove "unused variable" warning (diff) | |
download | wireguard-openbsd-7fc3d0a94d50c4fcca5e5807153da297ea8d8e93.tar.xz wireguard-openbsd-7fc3d0a94d50c4fcca5e5807153da297ea8d8e93.zip |
another fix to handle "expect" and "filter" actions in the new style
correctly.
ok pyr@
-rw-r--r-- | usr.sbin/hoststated/relay.c | 17 | ||||
-rw-r--r-- | usr.sbin/relayd/relay.c | 17 |
2 files changed, 16 insertions, 18 deletions
diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c index b20e082ea8d..80b1a03a7e5 100644 --- a/usr.sbin/hoststated/relay.c +++ b/usr.sbin/hoststated/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); } 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); } |