summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-02-19 23:41:48 +0100
committerVolker Lendecke <vl@samba.org>2009-02-21 14:04:14 +0100
commit4aed9abbf84deb47e7a3aec025268a3c1e6b29bb (patch)
treed11cd47acd6bcf3617fd2075c02ebed8ef653146 /source3/auth
parente9467ff26ed429dbb2d4249da5bedf545664253b (diff)
downloadsamba-4aed9abbf84deb47e7a3aec025268a3c1e6b29bb.tar.gz
samba-4aed9abbf84deb47e7a3aec025268a3c1e6b29bb.tar.bz2
samba-4aed9abbf84deb47e7a3aec025268a3c1e6b29bb.zip
Remove the static "chal" from ntlmssp.c:get_challenge()
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth.c14
-rw-r--r--source3/auth/auth_compat.c5
-rw-r--r--source3/auth/auth_ntlmssp.c6
3 files changed, 15 insertions, 10 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 505098c76a..b19fa764f0 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -76,7 +76,8 @@ static struct auth_init_function_entry *auth_find_backend_entry(const char *name
Returns a const char of length 8 bytes.
****************************************************************************/
-static const uint8 *get_ntlm_challenge(struct auth_context *auth_context)
+static void get_ntlm_challenge(struct auth_context *auth_context,
+ uint8_t chal[8])
{
DATA_BLOB challenge = data_blob_null;
const char *challenge_set_by = NULL;
@@ -86,7 +87,8 @@ static const uint8 *get_ntlm_challenge(struct auth_context *auth_context)
if (auth_context->challenge.length) {
DEBUG(5, ("get_ntlm_challenge (auth subsystem): returning previous challenge by module %s (normal)\n",
auth_context->challenge_set_by));
- return auth_context->challenge.data;
+ memcpy(chal, auth_context->challenge.data, 8);
+ return;
}
auth_context->challenge_may_be_modified = False;
@@ -123,11 +125,11 @@ static const uint8 *get_ntlm_challenge(struct auth_context *auth_context)
}
if (!challenge_set_by) {
- uchar chal[8];
+ uchar tmp[8];
- generate_random_buffer(chal, sizeof(chal));
+ generate_random_buffer(tmp, sizeof(tmp));
auth_context->challenge = data_blob_talloc(auth_context->mem_ctx,
- chal, sizeof(chal));
+ tmp, sizeof(tmp));
challenge_set_by = "random";
auth_context->challenge_may_be_modified = True;
@@ -141,7 +143,7 @@ static const uint8 *get_ntlm_challenge(struct auth_context *auth_context)
auth_context->challenge_set_by=challenge_set_by;
- return auth_context->challenge.data;
+ memcpy(chal, auth_context->challenge.data, 8);
}
diff --git a/source3/auth/auth_compat.c b/source3/auth/auth_compat.c
index 00d9dea816..925c0d4f81 100644
--- a/source3/auth/auth_compat.c
+++ b/source3/auth/auth_compat.c
@@ -39,13 +39,14 @@ NTSTATUS check_plaintext_password(const char *smb_name, DATA_BLOB plaintext_pass
{
struct auth_context *plaintext_auth_context = NULL;
auth_usersupplied_info *user_info = NULL;
- const uint8 *chal;
+ uint8_t chal[8];
NTSTATUS nt_status;
if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(&plaintext_auth_context))) {
return nt_status;
}
- chal = plaintext_auth_context->get_ntlm_challenge(plaintext_auth_context);
+ plaintext_auth_context->get_ntlm_challenge(plaintext_auth_context,
+ chal);
if (!make_user_info_for_reply(&user_info,
smb_name, lp_workgroup(), chal,
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index 0d46b14f97..98f5838707 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -27,11 +27,13 @@
* @return an 8 byte random challenge
*/
-static const uint8 *auth_ntlmssp_get_challenge(const struct ntlmssp_state *ntlmssp_state)
+static void auth_ntlmssp_get_challenge(const struct ntlmssp_state *ntlmssp_state,
+ uint8_t chal[8])
{
AUTH_NTLMSSP_STATE *auth_ntlmssp_state =
(AUTH_NTLMSSP_STATE *)ntlmssp_state->auth_context;
- return auth_ntlmssp_state->auth_context->get_ntlm_challenge(auth_ntlmssp_state->auth_context);
+ return auth_ntlmssp_state->auth_context->get_ntlm_challenge(
+ auth_ntlmssp_state->auth_context, chal);
}
/**