]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use AnyP::Uri::Decode() for urllogin checks (#1659)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Wed, 7 Feb 2024 14:19:28 +0000 (14:19 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 8 Feb 2024 11:42:56 +0000 (11:42 +0000)
src/acl/UrlLogin.cc

index f56031bac3997301acfbff3d896bcf875324bb70..df9322c2ecba3ece44d431ccb2b1ac8540aff454 100644 (file)
@@ -11,8 +11,8 @@
 #include "squid.h"
 #include "acl/FilledChecklist.h"
 #include "acl/UrlLogin.h"
+#include "anyp/Uri.h"
 #include "HttpRequest.h"
-#include "rfc1738.h"
 
 int
 Acl::UrlLoginCheck::match(ACLChecklist * const ch)
@@ -24,11 +24,7 @@ Acl::UrlLoginCheck::match(ACLChecklist * const ch)
         return 0; // nothing can match
     }
 
-    static char str[MAX_URL]; // should be big enough for a single URI segment
-
-    const SBuf::size_type len = checklist->request->url.userInfo().copy(str, sizeof(str)-1);
-    str[len] = '\0';
-    rfc1738_unescape(str);
-    return data->match(str);
+    auto decodedUserInfo = AnyP::Uri::Decode(checklist->request->url.userInfo());
+    return data->match(decodedUserInfo.c_str());
 }