From e4ad0013787a726bfc3d1ba3644b60a6c77ace37 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 3 Jan 2020 14:24:13 +0100 Subject: [PATCH] auth: Avoid casts in ntlm_check.c Signed-off-by: Volker Lendecke Reviewed-by: Gary Lockyer Autobuild-User(master): Gary Lockyer Autobuild-Date(master): Mon Jan 6 03:12:20 UTC 2020 on sn-devel-184 --- libcli/auth/ntlm_check.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/libcli/auth/ntlm_check.c b/libcli/auth/ntlm_check.c index 9ae524452aa..846e0c07cd5 100644 --- a/libcli/auth/ntlm_check.c +++ b/libcli/auth/ntlm_check.c @@ -46,14 +46,13 @@ static bool smb_pwd_check_ntlmv1(TALLOC_CTX *mem_ctx, } if (sec_blob->length != 8) { - DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect challenge size (%lu)\n", - (unsigned long)sec_blob->length)); + DBG_ERR("incorrect challenge size (%zu)\n", sec_blob->length); return false; } if (nt_response->length != 24) { - DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect password length (%lu)\n", - (unsigned long)nt_response->length)); + DBG_ERR("incorrect password length (%zu)\n", + nt_response->length); return false; } @@ -113,8 +112,7 @@ static bool smb_pwd_check_ntlmv2(TALLOC_CTX *mem_ctx, } if (sec_blob->length != 8) { - DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect challenge size (%lu)\n", - (unsigned long)sec_blob->length)); + DBG_ERR("incorrect challenge size (%zu)\n", sec_blob->length); 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 crazy. No known implementation sends less than the 24 bytes for LMv2, let alone NTLMv2. */ - DEBUG(0, ("smb_pwd_check_ntlmv2: incorrect password length (%lu)\n", - (unsigned long)ntv2_response->length)); + DBG_ERR("incorrect password length (%zu)\n", + ntv2_response->length); return false; } @@ -204,8 +202,7 @@ static bool smb_sess_key_ntlmv2(TALLOC_CTX *mem_ctx, } if (sec_blob->length != 8) { - DEBUG(0, ("smb_sess_key_ntlmv2: incorrect challenge size (%lu)\n", - (unsigned long)sec_blob->length)); + DBG_ERR("incorrect challenge size (%zu)\n", sec_blob->length); 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 crazy. No known implementation sends less than the 24 bytes for LMv2, let alone NTLMv2. */ - DEBUG(0, ("smb_sess_key_ntlmv2: incorrect password length (%lu)\n", - (unsigned long)ntv2_response->length)); + DBG_ERR("incorrect password length (%zu)\n", + ntv2_response->length); return false; } @@ -397,8 +394,9 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, } if (nt_response->length != 0 && nt_response->length < 24) { - DEBUG(2,("ntlm_password_check: invalid NT password length (%lu) for user %s\n", - (unsigned long)nt_response->length, username)); + DBG_NOTICE("invalid NT password length (%zu) for user %s\n", + nt_response->length, + username); } if (nt_response->length > 24 && stored_nt) { @@ -484,8 +482,9 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, } if (lm_response->length < 24) { - DEBUG(2,("ntlm_password_check: invalid LanMan password length (%lu) for user %s\n", - (unsigned long)nt_response->length, username)); + DBG_NOTICE("invalid LanMan password length (%zu) for " + "user %s\n", + nt_response->length, username); return NT_STATUS_WRONG_PASSWORD; }