|
|
24a36d |
diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc
|
|
|
24a36d |
index 0c745c2..8a67eba 100644
|
|
|
24a36d |
--- a/tools/cachemgr.cc
|
|
|
24a36d |
+++ b/tools/cachemgr.cc
|
|
|
24a36d |
@@ -355,7 +355,7 @@ auth_html(const char *host, int port, const char *user_name)
|
|
|
24a36d |
|
|
|
24a36d |
printf("Manager name:
|
|
|
24a36d |
|
|
|
24a36d |
- printf("size=\"30\" VALUE=\"%s\">\n", user_name);
|
|
|
24a36d |
+ printf("size=\"30\" VALUE=\"%s\">\n", rfc1738_escape(user_name));
|
|
|
24a36d |
|
|
|
24a36d |
printf("Password:
|
|
|
24a36d |
|
|
|
24a36d |
@@ -419,7 +419,7 @@ menu_url(cachemgr_request * req, const char *action)
|
|
|
24a36d |
script_name,
|
|
|
24a36d |
req->hostname,
|
|
|
24a36d |
req->port,
|
|
|
24a36d |
- safe_str(req->user_name),
|
|
|
24a36d |
+ rfc1738_escape(safe_str(req->user_name)),
|
|
|
24a36d |
action,
|
|
|
24a36d |
safe_str(req->pub_auth));
|
|
|
24a36d |
return url;
|
|
|
24a36d |
@@ -1074,8 +1074,8 @@ make_pub_auth(cachemgr_request * req)
|
|
|
24a36d |
const int bufLen = snprintf(buf, sizeof(buf), "%s|%d|%s|%s",
|
|
|
24a36d |
req->hostname,
|
|
|
24a36d |
(int) now,
|
|
|
24a36d |
- req->user_name ? req->user_name : "",
|
|
|
24a36d |
- req->passwd);
|
|
|
24a36d |
+ rfc1738_escape(safe_str(req->user_name)),
|
|
|
24a36d |
+ rfc1738_escape(req->passwd));
|
|
|
24a36d |
debug("cmgr: pre-encoded for pub: %s\n", buf);
|
|
|
24a36d |
|
|
|
24a36d |
const int encodedLen = base64_encode_len(bufLen);
|
|
|
24a36d |
@@ -1094,8 +1094,6 @@ decode_pub_auth(cachemgr_request * req)
|
|
|
24a36d |
char *buf;
|
|
|
24a36d |
const char *host_name;
|
|
|
24a36d |
const char *time_str;
|
|
|
24a36d |
- const char *user_name;
|
|
|
24a36d |
- const char *passwd;
|
|
|
24a36d |
|
|
|
24a36d |
debug("cmgr: decoding pub: '%s'\n", safe_str(req->pub_auth));
|
|
|
24a36d |
safe_free(req->passwd);
|
|
|
24a36d |
@@ -1131,17 +1129,21 @@ decode_pub_auth(cachemgr_request * req)
|
|
|
24a36d |
|
|
|
24a36d |
debug("cmgr: decoded time: '%s' (now: %d)\n", time_str, (int) now);
|
|
|
24a36d |
|
|
|
24a36d |
+ char *user_name;
|
|
|
24a36d |
if ((user_name = strtok(NULL, "|")) == NULL) {
|
|
|
24a36d |
xfree(buf);
|
|
|
24a36d |
return;
|
|
|
24a36d |
}
|
|
|
24a36d |
+ rfc1738_unescape(user_name);
|
|
|
24a36d |
|
|
|
24a36d |
debug("cmgr: decoded uname: '%s'\n", user_name);
|
|
|
24a36d |
|
|
|
24a36d |
+ char *passwd;
|
|
|
24a36d |
if ((passwd = strtok(NULL, "|")) == NULL) {
|
|
|
24a36d |
xfree(buf);
|
|
|
24a36d |
return;
|
|
|
24a36d |
}
|
|
|
24a36d |
+ rfc1738_unescape(passwd);
|
|
|
24a36d |
|
|
|
24a36d |
debug("cmgr: decoded passwd: '%s'\n", passwd);
|
|
|
24a36d |
|