1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

auth: Avoid casts in ntlm_check.c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Mon Jan  6 03:12:20 UTC 2020 on sn-devel-184
This commit is contained in:
Volker Lendecke 2020-01-03 14:24:13 +01:00 committed by Gary Lockyer
parent e02d24c087
commit e4ad001378

View File

@ -46,14 +46,13 @@ static bool smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx,
} }
if (sec_blob->length != 8) { if (sec_blob->length != 8) {
DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect challenge size (%lu)\n", DBG_ERR("incorrect challenge size (%zu)\n", sec_blob->length);
(unsigned long)sec_blob->length));
return false; return false;
} }
if (nt_response->length != 24) { if (nt_response->length != 24) {
DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect password length (%lu)\n", DBG_ERR("incorrect password length (%zu)\n",
(unsigned long)nt_response->length)); nt_response->length);
return false; return false;
} }
@ -113,8 +112,7 @@ static bool smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
} }
if (sec_blob->length != 8) { if (sec_blob->length != 8) {
DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect challenge size (%lu)\n", DBG_ERR("incorrect challenge size (%zu)\n", sec_blob->length);
(unsigned long)sec_blob->length));
return false; return false;
} }
@ -122,8 +120,8 @@ static bool smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx,
/* We MUST have more than 16 bytes, or the stuff below will go /* We MUST have more than 16 bytes, or the stuff below will go
crazy. No known implementation sends less than the 24 bytes crazy. No known implementation sends less than the 24 bytes
for LMv2, let alone NTLMv2. */ for LMv2, let alone NTLMv2. */
DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect password length (%lu)\n", DBG_ERR("incorrect password length (%zu)\n",
(unsigned long)ntv2_response->length)); ntv2_response->length);
return false; return false;
} }
@ -204,8 +202,7 @@ static bool smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx,
} }
if (sec_blob->length != 8) { if (sec_blob->length != 8) {
DEBUG(0, ("smb_sess_key_ntlmv2: incorrect challenge size (%lu)\n", DBG_ERR("incorrect challenge size (%zu)\n", sec_blob->length);
(unsigned long)sec_blob->length));
return false; return false;
} }
@ -213,8 +210,8 @@ static bool smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx,
/* We MUST have more than 16 bytes, or the stuff below will go /* We MUST have more than 16 bytes, or the stuff below will go
crazy. No known implementation sends less than the 24 bytes crazy. No known implementation sends less than the 24 bytes
for LMv2, let alone NTLMv2. */ for LMv2, let alone NTLMv2. */
DEBUG(0, ("smb_sess_key_ntlmv2: incorrect password length (%lu)\n", DBG_ERR("incorrect password length (%zu)\n",
(unsigned long)ntv2_response->length)); ntv2_response->length);
return false; return false;
} }
@ -397,8 +394,9 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
} }
if (nt_response->length != 0 && nt_response->length < 24) { if (nt_response->length != 0 && nt_response->length < 24) {
DEBUG(2,("ntlm_password_check: invalid NT password length (%lu) for user %s\n", DBG_NOTICE("invalid NT password length (%zu) for user %s\n",
(unsigned long)nt_response->length, username)); nt_response->length,
username);
} }
if (nt_response->length > 24 && stored_nt) { if (nt_response->length > 24 && stored_nt) {
@ -484,8 +482,9 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx,
} }
if (lm_response->length < 24) { if (lm_response->length < 24) {
DEBUG(2,("ntlm_password_check: invalid LanMan password length (%lu) for user %s\n", DBG_NOTICE("invalid LanMan password length (%zu) for "
(unsigned long)nt_response->length, username)); "user %s\n",
nt_response->length, username);
return NT_STATUS_WRONG_PASSWORD; return NT_STATUS_WRONG_PASSWORD;
} }