Blame SOURCES/squid-4.11-cache-mgr-auth-strdup.patch
|
|
692579 |
diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc
|
|
|
692579 |
index 36d8e38..50bb9b6 100644
|
|
|
692579 |
--- a/tools/cachemgr.cc
|
|
|
692579 |
+++ b/tools/cachemgr.cc
|
|
|
692579 |
@@ -1092,14 +1092,20 @@ make_pub_auth(cachemgr_request * req)
|
|
|
692579 |
if (!req->passwd || !strlen(req->passwd))
|
|
|
692579 |
return;
|
|
|
692579 |
|
|
|
692579 |
+ auto *rfc1738_username = xstrdup(rfc1738_escape(safe_str(req->user_name)));
|
|
|
692579 |
+ auto *rfc1738_passwd = xstrdup(rfc1738_escape(req->passwd));
|
|
|
692579 |
+
|
|
|
692579 |
/* host | time | user | passwd */
|
|
|
692579 |
const int bufLen = snprintf(buf, sizeof(buf), "%s|%d|%s|%s",
|
|
|
692579 |
req->hostname,
|
|
|
692579 |
(int) now,
|
|
|
692579 |
- rfc1738_escape(safe_str(req->user_name)),
|
|
|
692579 |
- rfc1738_escape(req->passwd));
|
|
|
692579 |
+ rfc1738_username,
|
|
|
692579 |
+ rfc1738_passwd);
|
|
|
692579 |
debug("cmgr: pre-encoded for pub: %s\n", buf);
|
|
|
692579 |
|
|
|
692579 |
+ safe_free(rfc1738_username);
|
|
|
692579 |
+ safe_free(rfc1738_passwd);
|
|
|
692579 |
+
|
|
|
692579 |
const int encodedLen = base64_encode_len(bufLen);
|
|
|
692579 |
req->pub_auth = (char *) xmalloc(encodedLen);
|
|
|
692579 |
struct base64_encode_ctx ctx;
|