BUG/MEDIUM: http-ana: Handle NTLM messages correctly.
When checking www-authenticate headers, we don't want to just accept
"NTLM" as value, because the server may send "HTLM <base64 value>". Instead,
just check that it starts with NTLM.
This should be backported to 2.1, 2.0, 1.9 and 1.8.
(cherry picked from commit 9df188695fbf1ff17de3861ec5b281365800c7f0)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit a542024400c49f0b4602b4a0270f79f4d6aa7232)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/proto_htx.c b/src/proto_htx.c
index 7bae526..ec08fb6 100644
--- a/src/proto_htx.c
+++ b/src/proto_htx.c
@@ -1803,7 +1803,7 @@
ctx.blk = NULL;
while (http_find_header(htx, hdr, &ctx, 0)) {
if ((ctx.value.len >= 9 && word_match(ctx.value.ptr, ctx.value.len, "Negotiate", 9)) ||
- (ctx.value.len >= 4 && word_match(ctx.value.ptr, ctx.value.len, "NTLM", 4))) {
+ (ctx.value.len >= 4 && !memcmp(ctx.value.ptr, "NTLM", 4))) {
sess->flags |= SESS_FL_PREFER_LAST;
srv_conn->flags |= CO_FL_PRIVATE;
}