]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: Use gnutls_error_to_ntstatus() in smb2_sesssetup
authorAndreas Schneider <asn@samba.org>
Tue, 11 Jun 2019 12:44:10 +0000 (14:44 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 24 Jun 2019 06:11:17 +0000 (06:11 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/smb2_sesssetup.c

index c302929335cddba59dbdf1418272252bcb4e14ea..eb81e2379149145f1677f2de11c1277f53a3a48c 100644 (file)
@@ -32,6 +32,7 @@
 #include "lib/crypto/aes_ccm_128.h"
 #include "lib/crypto/aes_gcm_128.h"
 
+#include "libcli/util/gnutls_error.h"
 #include <gnutls/gnutls.h>
 #include <gnutls/crypto.h>
 
@@ -229,7 +230,7 @@ static NTSTATUS smbd_smb2_auth_generic_return(struct smbXsrv_session *session,
 
                rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_SHA512);
                if (rc < 0) {
-                       return NT_STATUS_NO_MEMORY;
+                       return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
                }
                rc = gnutls_hash(hash_hnd,
                                 preauth->sha512_value,
@@ -682,7 +683,7 @@ static NTSTATUS smbd_smb2_bind_auth_return(struct smbXsrv_session *session,
 
                rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_SHA512);
                if (rc < 0) {
-                       return NT_STATUS_NO_MEMORY;
+                       return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
                }
 
                rc = gnutls_hash(hash_hnd,
@@ -690,7 +691,7 @@ static NTSTATUS smbd_smb2_bind_auth_return(struct smbXsrv_session *session,
                                 sizeof(preauth->sha512_value));
                if (rc < 0) {
                        gnutls_hash_deinit(hash_hnd, NULL);
-                       return NT_STATUS_INTERNAL_ERROR;
+                       return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
                }
                for (i = 1; i < smb2req->in.vector_count; i++) {
                        rc = gnutls_hash(hash_hnd,
@@ -698,7 +699,7 @@ static NTSTATUS smbd_smb2_bind_auth_return(struct smbXsrv_session *session,
                                         smb2req->in.vector[i].iov_len);
                        if (rc < 0) {
                                gnutls_hash_deinit(hash_hnd, NULL);
-                               return NT_STATUS_INTERNAL_ERROR;
+                               return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
                        }
                }
                gnutls_hash_deinit(hash_hnd, preauth->sha512_value);