]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/auth/AclProxyAuth.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / auth / AclProxyAuth.cc
index 90ed933c90a8636450c3f93937f058bee7361b7e..5e7228cd626de6c21c1c70d69d7a6af532ed9fee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -18,6 +18,7 @@
 #include "auth/User.h"
 #include "auth/UserRequest.h"
 #include "client_side.h"
+#include "http/Stream.h"
 #include "HttpRequest.h"
 
 ACLProxyAuth::~ACLProxyAuth()
@@ -25,9 +26,14 @@ ACLProxyAuth::~ACLProxyAuth()
     delete data;
 }
 
-ACLProxyAuth::ACLProxyAuth(ACLData<char const *> *newData, char const *theType) : data(newData), type_(theType) {}
+ACLProxyAuth::ACLProxyAuth(ACLData<char const *> *newData, char const *theType) :
+    data(newData),
+    type_(theType)
+{}
 
-ACLProxyAuth::ACLProxyAuth(ACLProxyAuth const &old) : data(old.data->clone()), type_(old.type_)
+ACLProxyAuth::ACLProxyAuth(ACLProxyAuth const &old) :
+    data(old.data->clone()),
+    type_(old.type_)
 {}
 
 ACLProxyAuth &
@@ -44,6 +50,12 @@ ACLProxyAuth::typeString() const
     return type_;
 }
 
+void
+ACLProxyAuth::parseFlags()
+{
+    ParseFlags(Acl::NoOptions(), data->supportedFlags());
+}
+
 void
 ACLProxyAuth::parse()
 {
@@ -53,7 +65,7 @@ ACLProxyAuth::parse()
 int
 ACLProxyAuth::match(ACLChecklist *checklist)
 {
-    allow_t answer = AuthenticateAcl(checklist);
+    auto answer = AuthenticateAcl(checklist);
 
     // convert to tri-state ACL match 1,0,-1
     switch (answer) {
@@ -165,10 +177,10 @@ int
 ACLProxyAuth::matchProxyAuth(ACLChecklist *cl)
 {
     ACLFilledChecklist *checklist = Filled(cl);
-    if (checklist->request->flags.sslBumped)
-        return 1; // AuthenticateAcl() already handled this bumped request
-    if (!authenticateUserAuthenticated(Filled(checklist)->auth_user_request)) {
-        return 0;
+    if (!checklist->request->flags.sslBumped) {
+        if (!authenticateUserAuthenticated(checklist->auth_user_request)) {
+            return 0;
+        }
     }
     /* check to see if we have matched the user-acl before */
     int result = cacheMatchAcl(&checklist->auth_user_request->user()->proxy_match_cache, checklist);