summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-08-07 20:59:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:27 -0500
commitdb8c38340b35574fc553b5ef7019f942699356f4 (patch)
tree986d7e824a68db139b13d14c94d8faf31b5bd888 /source3/utils
parentfd6dde216168fba678346c2520051ddc63e70ae5 (diff)
downloadsamba-db8c38340b35574fc553b5ef7019f942699356f4.tar.gz
samba-db8c38340b35574fc553b5ef7019f942699356f4.tar.bz2
samba-db8c38340b35574fc553b5ef7019f942699356f4.zip
r9198: Convert hex_encode and strhex_to_data_blob to take a talloc context.
Volker (This used to be commit c7d10e2c834d8d5136e2d01dea1ad286757deddb)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/ntlm_auth.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 6d5737aad4..3fdd657a2d 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -1470,21 +1470,21 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
if (ntlm_server_1_lm_session_key
&& (memcmp(zeros, lm_key,
sizeof(lm_key)) != 0)) {
- hex_encode((const unsigned char *)lm_key,
- sizeof(lm_key),
- &hex_lm_key);
+ hex_lm_key = hex_encode(NULL,
+ (const unsigned char *)lm_key,
+ sizeof(lm_key));
x_fprintf(x_stdout, "LANMAN-Session-Key: %s\n", hex_lm_key);
- SAFE_FREE(hex_lm_key);
+ talloc_free(hex_lm_key);
}
if (ntlm_server_1_user_session_key
&& (memcmp(zeros, user_session_key,
sizeof(user_session_key)) != 0)) {
- hex_encode((const unsigned char *)user_session_key,
- sizeof(user_session_key),
- &hex_user_session_key);
+ hex_user_session_key = hex_encode(NULL,
+ (const unsigned char *)user_session_key,
+ sizeof(user_session_key));
x_fprintf(x_stdout, "User-Session-Key: %s\n", hex_user_session_key);
- SAFE_FREE(hex_user_session_key);
+ talloc_free(hex_user_session_key);
}
}
}
@@ -1533,7 +1533,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
}
if (strequal(request, "LANMAN-Challenge")) {
- challenge = strhex_to_data_blob(parameter);
+ challenge = strhex_to_data_blob(NULL, parameter);
if (challenge.length != 8) {
x_fprintf(x_stdout, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n",
parameter,
@@ -1541,7 +1541,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
challenge = data_blob(NULL, 0);
}
} else if (strequal(request, "NT-Response")) {
- nt_response = strhex_to_data_blob(parameter);
+ nt_response = strhex_to_data_blob(NULL, parameter);
if (nt_response.length < 24) {
x_fprintf(x_stdout, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n",
parameter,
@@ -1549,7 +1549,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
nt_response = data_blob(NULL, 0);
}
} else if (strequal(request, "LANMAN-Response")) {
- lm_response = strhex_to_data_blob(parameter);
+ lm_response = strhex_to_data_blob(NULL, parameter);
if (lm_response.length != 24) {
x_fprintf(x_stdout, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n",
parameter,
@@ -1672,20 +1672,18 @@ static BOOL check_auth_crap(void)
if (request_lm_key
&& (memcmp(zeros, lm_key,
sizeof(lm_key)) != 0)) {
- hex_encode((const unsigned char *)lm_key,
- sizeof(lm_key),
- &hex_lm_key);
+ hex_lm_key = hex_encode(NULL, (const unsigned char *)lm_key,
+ sizeof(lm_key));
x_fprintf(x_stdout, "LM_KEY: %s\n", hex_lm_key);
- SAFE_FREE(hex_lm_key);
+ talloc_free(hex_lm_key);
}
if (request_user_session_key
&& (memcmp(zeros, user_session_key,
sizeof(user_session_key)) != 0)) {
- hex_encode((const unsigned char *)user_session_key,
- sizeof(user_session_key),
- &hex_user_session_key);
+ hex_user_session_key = hex_encode(NULL, (const unsigned char *)user_session_key,
+ sizeof(user_session_key));
x_fprintf(x_stdout, "NT_KEY: %s\n", hex_user_session_key);
- SAFE_FREE(hex_user_session_key);
+ talloc_free(hex_user_session_key);
}
return True;
@@ -1775,7 +1773,7 @@ enum {
while((opt = poptGetNextOpt(pc)) != -1) {
switch (opt) {
case OPT_CHALLENGE:
- opt_challenge = strhex_to_data_blob(hex_challenge);
+ opt_challenge = strhex_to_data_blob(NULL, hex_challenge);
if (opt_challenge.length != 8) {
x_fprintf(x_stderr, "hex decode of %s failed! (only got %d bytes)\n",
hex_challenge,
@@ -1784,7 +1782,7 @@ enum {
}
break;
case OPT_LM:
- opt_lm_response = strhex_to_data_blob(hex_lm_response);
+ opt_lm_response = strhex_to_data_blob(NULL, hex_lm_response);
if (opt_lm_response.length != 24) {
x_fprintf(x_stderr, "hex decode of %s failed! (only got %d bytes)\n",
hex_lm_response,
@@ -1794,7 +1792,7 @@ enum {
break;
case OPT_NT:
- opt_nt_response = strhex_to_data_blob(hex_nt_response);
+ opt_nt_response = strhex_to_data_blob(NULL, hex_nt_response);
if (opt_nt_response.length < 24) {
x_fprintf(x_stderr, "hex decode of %s failed! (only got %d bytes)\n",
hex_nt_response,