summaryrefslogtreecommitdiffstats
path: root/source/lib/util_str.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-11-24 08:32:03 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-11-24 08:32:03 +0000
commit82dbf838879e8a2d2d3f9dd5be6eda50b780b787 (patch)
tree350c3897519787e78fc44e46e29b09063f6db22c /source/lib/util_str.c
parentc31a17889e3e4daf7c1e807038efc2c0fba78be3 (diff)
downloadsamba-82dbf838879e8a2d2d3f9dd5be6eda50b780b787.tar.gz
samba-82dbf838879e8a2d2d3f9dd5be6eda50b780b787.tar.xz
samba-82dbf838879e8a2d2d3f9dd5be6eda50b780b787.zip
Add ntlm_auth, a new program to provide a stable interface to winbind's
authentication code. In particular, ntlm_auth is designed to replace the winbind authentication 'helpers' currently supplied by Squid. I have added support for the current plaintext password protocol used by Squid, and will add the real guts (NTLMSSP support) shortly. I'll merge this into 3.0 when I've got the interface more stable (error message format etc) and got the important NTLMSSP support added. Also move SWAT's URL decoding code into util_str.c, for use in both utilities. Andrew Bartlett
Diffstat (limited to 'source/lib/util_str.c')
-rw-r--r--source/lib/util_str.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index 32efee1536a..dfadac0e47e 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -1366,3 +1366,44 @@ BOOL str_list_substitute(char **list, const char *pattern, const char *insert)
return True;
}
+
+/***********************************************************
+ Unescape a URL encoded string, in place.
+***********************************************************/
+
+void rfc1738_unescape(char *buf)
+{
+ char *p=buf;
+
+ while ((p=strchr_m(p,'+')))
+ *p = ' ';
+
+ p = buf;
+
+ while (p && *p && (p=strchr_m(p,'%'))) {
+ int c1 = p[1];
+ int c2 = p[2];
+
+ if (c1 >= '0' && c1 <= '9')
+ c1 = c1 - '0';
+ else if (c1 >= 'A' && c1 <= 'F')
+ c1 = 10 + c1 - 'A';
+ else if (c1 >= 'a' && c1 <= 'f')
+ c1 = 10 + c1 - 'a';
+ else {p++; continue;}
+
+ if (c2 >= '0' && c2 <= '9')
+ c2 = c2 - '0';
+ else if (c2 >= 'A' && c2 <= 'F')
+ c2 = 10 + c2 - 'A';
+ else if (c2 >= 'a' && c2 <= 'f')
+ c2 = 10 + c2 - 'a';
+ else {p++; continue;}
+
+ *p = (c1<<4) | c2;
+
+ memmove(p+1, p+3, strlen(p+3)+1);
+ p++;
+ }
+}
+