]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http-auth: last fix was wrong
authorKrzysztof Olędzki <ole@ans.pl>
Mon, 1 Feb 2010 11:36:53 +0000 (12:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 1 Feb 2010 11:54:32 +0000 (12:54 +0100)
I'm not sure if the fix is correct:

- if (req_acl->cond)
-         ret = acl_exec_cond(req_acl->cond, px, s, txn, ACL_DIR_REQ);
+ if (!req_acl->cond)
+         continue;

Doesn't it ignore rules with no condition attached? I think that the
proper solution would be the following.

src/proto_http.c

index 692bb9f10926ee374c669655c962085783ebf806..b4ec788150fbd012f45e52ae1939497104c5848a 100644 (file)
@@ -2862,13 +2862,13 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
                        continue;
 
                /* check condition, but only if attached */
-               if (!req_acl->cond)
-                       continue;
+               if (req_acl->cond) {
+                       ret = acl_exec_cond(req_acl->cond, px, s, txn, ACL_DIR_REQ);
+                       ret = acl_pass(ret);
 
-               ret = acl_exec_cond(req_acl->cond, px, s, txn, ACL_DIR_REQ);
-               ret = acl_pass(ret);
-               if (req_acl->cond->pol == ACL_COND_UNLESS)
-                       ret = !ret;
+                       if (req_acl->cond->pol == ACL_COND_UNLESS)
+                               ret = !ret;
+               }
 
                if (ret) {
                        req_acl_final = req_acl;