summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/relay_http.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2014-07-13 00:18:06 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2014-07-13 00:18:06 +0000
commitc816808afd54bdd609b284106c83dd549aaa9e8c (patch)
treea92ba4e3b2b933ac0b0b5c0b8cddf58e9f96aaff /usr.sbin/relayd/relay_http.c
parent44f25bba0c47312fe89e872253708d3836544ad1 (diff)
repair matching of headers, add regress test for this error
ok reyk
Diffstat (limited to 'usr.sbin/relayd/relay_http.c')
-rw-r--r--usr.sbin/relayd/relay_http.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c
index 9e30487d525..ede8aa4751b 100644
--- a/usr.sbin/relayd/relay_http.c
+++ b/usr.sbin/relayd/relay_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_http.c,v 1.27 2014/07/12 15:47:18 benno Exp $ */
+/* $OpenBSD: relay_http.c,v 1.28 2014/07/13 00:18:05 benno Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -1229,6 +1229,13 @@ relay_httpheader_test(struct ctl_relay_event *cre, struct relay_rule *rule,
} else if (match == NULL) {
/* Fail if header doesn't exist */
return (-1);
+ } else {
+ if (fnmatch(kv->kv_key, match->kv_key, FNM_CASEFOLD) == FNM_NOMATCH)
+ return (-1);
+ if (kv->kv_value != NULL &&
+ match->kv_value != NULL &&
+ fnmatch(kv->kv_value, match->kv_value, 0) == FNM_NOMATCH)
+ return (-1);
}
relay_match(actions, kv, match, &desc->http_headers);