summaryrefslogtreecommitdiff
path: root/source4/libcli/auth/ntlm_check.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-06-07 22:17:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:37 -0500
commitf3826432fb14b1e10516afe9f6525aab7c1b720f (patch)
tree63e27b1fb30d80143c1530f0f6295a78fc8dcd5a /source4/libcli/auth/ntlm_check.c
parentb717b40235b2433b26b20ced36142c250f9c411e (diff)
downloadsamba-f3826432fb14b1e10516afe9f6525aab7c1b720f.tar.gz
samba-f3826432fb14b1e10516afe9f6525aab7c1b720f.tar.bz2
samba-f3826432fb14b1e10516afe9f6525aab7c1b720f.zip
r1080: Make sure to initialise all the returned elements in the SamLogon
reply also initialise the LM session key, when we have it (was failing because the auth code was setting it's length wrong). Andrew Bartlett (This used to be commit de97d9df224f769953e850a276515923a830839c)
Diffstat (limited to 'source4/libcli/auth/ntlm_check.c')
-rw-r--r--source4/libcli/auth/ntlm_check.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/source4/libcli/auth/ntlm_check.c b/source4/libcli/auth/ntlm_check.c
index eab150ad4d..f101b230d4 100644
--- a/source4/libcli/auth/ntlm_check.c
+++ b/source4/libcli/auth/ntlm_check.c
@@ -326,10 +326,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
so use it only if we otherwise allow LM authentication */
if (lp_lanman_auth() && lm_pw) {
- uint8_t first_8_lm_hash[16];
- memcpy(first_8_lm_hash, lm_pw, 8);
- memset(first_8_lm_hash + 8, '\0', 8);
- *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ *lm_sess_key = data_blob(lm_pw, 8);
}
return NT_STATUS_OK;
} else {
@@ -367,11 +364,17 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
if (smb_pwd_check_ntlmv1(lm_response,
lm_pw, challenge,
NULL)) {
- uint8_t first_8_lm_hash[16];
- memcpy(first_8_lm_hash, lm_pw, 8);
- memset(first_8_lm_hash + 8, '\0', 8);
- *user_sess_key = data_blob(first_8_lm_hash, 16);
- *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ /* The session key for this response is still very odd.
+ It not very secure, so use it only if we otherwise
+ allow LM authentication */
+
+ if (lp_lanman_auth() && lm_pw) {
+ uint8_t first_8_lm_hash[16];
+ memcpy(first_8_lm_hash, lm_pw, 8);
+ memset(first_8_lm_hash + 8, '\0', 8);
+ *user_sess_key = data_blob(first_8_lm_hash, 16);
+ *lm_sess_key = data_blob(lm_pw, 8);
+ }
return NT_STATUS_OK;
}
}
@@ -431,7 +434,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
memcpy(first_8_lm_hash, lm_pw, 8);
memset(first_8_lm_hash + 8, '\0', 8);
*user_sess_key = data_blob(first_8_lm_hash, 16);
- *lm_sess_key = data_blob(first_8_lm_hash, 16);
+ *lm_sess_key = data_blob(lm_pw, 8);
}
return NT_STATUS_OK;
}