From 35573821b633e421fc02d6620abfdb13f25e7622 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 11 Jun 2019 15:16:31 +0200 Subject: [PATCH] auth:ntlmssp: Use gnutls_error_to_ntstatus() in ntlmssp_client Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- auth/ntlmssp/ntlmssp_client.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/auth/ntlmssp/ntlmssp_client.c b/auth/ntlmssp/ntlmssp_client.c index 792afcf6d20..8940522d39c 100644 --- a/auth/ntlmssp/ntlmssp_client.c +++ b/auth/ntlmssp/ntlmssp_client.c @@ -35,6 +35,7 @@ struct auth_session_info; #include "../auth/ntlmssp/ntlmssp_ndr.h" #include "../nsswitch/libwbclient/wbclient.h" +#include "libcli/util/gnutls_error.h" #include #include @@ -749,10 +750,7 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, session_key.data, MIN(session_key.length, 64)); if (rc < 0) { - nt_status = NT_STATUS_NO_MEMORY; - if (rc == GNUTLS_E_UNWANTED_ALGORITHM) { - nt_status = NT_STATUS_NTLM_BLOCKED; - } + nt_status = gnutls_error_to_ntstatus(rc, NT_STATUS_NTLM_BLOCKED); goto done; } @@ -761,19 +759,19 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, ntlmssp_state->negotiate_blob.length); if (rc < 0) { gnutls_hmac_deinit(hmac_hnd, NULL); - nt_status = NT_STATUS_INTERNAL_ERROR; + nt_status = gnutls_error_to_ntstatus(rc, NT_STATUS_NTLM_BLOCKED); goto done; } rc = gnutls_hmac(hmac_hnd, in.data, in.length); if (rc < 0) { gnutls_hmac_deinit(hmac_hnd, NULL); - nt_status = NT_STATUS_INTERNAL_ERROR; + nt_status = gnutls_error_to_ntstatus(rc, NT_STATUS_NTLM_BLOCKED); goto done; } rc = gnutls_hmac(hmac_hnd, out->data, out->length); if (rc < 0) { gnutls_hmac_deinit(hmac_hnd, NULL); - nt_status = NT_STATUS_INTERNAL_ERROR; + nt_status = gnutls_error_to_ntstatus(rc, NT_STATUS_NTLM_BLOCKED); goto done; }