mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-27 20:02:17 -04:00
BUG/MINOR: http-fetch: check against the whole token in get_http_auth()
In 1.4, Basic authentication support was added by commitf9423ae43a("[MINOR] acl: add http_auth and http_auth_group"). Interestingly, a mistake there consisted in taking the length of the comparison from the input token, so "b" matches "Basic". It was later propagated to Bearer in 2.5 with commitf5dd337b12("MINOR: http: Add http_auth_bearer sample fetch"). Let's just compare the entire tokens. This may be backported though it is very minor.
This commit is contained in:
parent
ffdc91c4a1
commit
e583b38c63
1 changed files with 2 additions and 2 deletions
|
|
@ -135,7 +135,7 @@ static int get_http_auth(struct sample *smp, struct htx *htx)
|
|||
|
||||
chunk_initlen(&txn->auth.method_data, p, 0, istend(ctx.value) - p);
|
||||
|
||||
if (!strncasecmp("Basic", auth_method.area, auth_method.data)) {
|
||||
if (isteqi(ist2(auth_method.area, auth_method.data), ist("Basic"))) {
|
||||
struct buffer *http_auth = get_trash_chunk();
|
||||
|
||||
len = base64dec(txn->auth.method_data.area,
|
||||
|
|
@ -159,7 +159,7 @@ static int get_http_auth(struct sample *smp, struct htx *htx)
|
|||
|
||||
txn->auth.method = HTTP_AUTH_BASIC;
|
||||
return 1;
|
||||
} else if (!strncasecmp("Bearer", auth_method.area, auth_method.data)) {
|
||||
} else if (isteqi(ist2(auth_method.area, auth_method.data), ist("Bearer"))) {
|
||||
txn->auth.method = HTTP_AUTH_BEARER;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue