diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-04-27 16:06:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:05:03 -0500 |
commit | 70d10653ad3dcc4c12c83d4ca14752d0a0c89fe8 (patch) | |
tree | cf6f08e2606e1d48f3059904bbcfa726aa414ea1 /source4/utils | |
parent | 8d137d97858a618c8c5451bb7b11fb95990540c8 (diff) | |
download | samba-70d10653ad3dcc4c12c83d4ca14752d0a0c89fe8.tar.gz samba-70d10653ad3dcc4c12c83d4ca14752d0a0c89fe8.tar.bz2 samba-70d10653ad3dcc4c12c83d4ca14752d0a0c89fe8.zip |
r15296: Move ntlm_auth-specific functions from util to ntlm_auth so libutil doesn't need ldb
(This used to be commit 137ace965e3477c4d92dfd33758d59db346acbcf)
Diffstat (limited to 'source4/utils')
-rw-r--r-- | source4/utils/config.mk | 3 | ||||
-rw-r--r-- | source4/utils/ntlm_auth.c | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/source4/utils/config.mk b/source4/utils/config.mk index 53ae16a789..9ffe72352e 100644 --- a/source4/utils/config.mk +++ b/source4/utils/config.mk @@ -28,7 +28,8 @@ PRIVATE_DEPENDENCIES = \ LIBSAMBA-UTIL \ LIBPOPT \ POPT_SAMBA \ - POPT_CREDENTIALS + POPT_CREDENTIALS \ + gensec MANPAGE = man/ntlm_auth.1 # End BINARY ntlm_auth ################################# diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 6e600dc33d..5532a9ad0b 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -29,6 +29,7 @@ #include "pstring.h" #include "libcli/auth/libcli_auth.h" #include "librpc/gen_ndr/ndr_security.h" +#include "lib/ldb/include/ldb.h" #define SQUID_BUFFER_SIZE 2010 @@ -127,6 +128,34 @@ static BOOL parse_ntlm_auth_domain_user(const char *domuser, fstring domain, return True; } +/** + * Decode a base64 string into a DATA_BLOB - simple and slow algorithm + **/ +static DATA_BLOB base64_decode_data_blob(TALLOC_CTX *mem_ctx, const char *s) +{ + DATA_BLOB ret = data_blob_talloc(mem_ctx, s, strlen(s)+1); + ret.length = ldb_base64_decode((char *)ret.data); + return ret; +} + +/** + * Encode a base64 string into a talloc()ed string caller to free. + **/ +static char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data) +{ + return ldb_base64_encode(mem_ctx, (const char *)data.data, data.length); +} + +/** + * Decode a base64 string in-place - wrapper for the above + **/ +static void base64_decode_inplace(char *s) +{ + ldb_base64_decode(s); +} + + + /* Authenticate a user with a plaintext password */ static BOOL check_plaintext_auth(const char *user, const char *pass, |