summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-06-26 16:41:05 +1200
committerAndreas Schneider <asn@cryptomilk.org>2019-06-27 12:54:22 +0000
commit8f4c30f785cd012597883016e35f794e9a800404 (patch)
treea424c283503356f74130a3c4499cfdb19caa4ca4 /libcli
parent29ee235caee7e703ee9ebee342c8decb017fd099 (diff)
downloadsamba-8f4c30f785cd012597883016e35f794e9a800404.tar.gz
lib/crypto: move gnutls error wrapper to own subsystem
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'libcli')
-rw-r--r--libcli/auth/credentials.c2
-rw-r--r--libcli/auth/wscript_build2
-rw-r--r--libcli/smb/smb2_signing.c2
-rw-r--r--libcli/smb/smbXcli_base.c2
-rw-r--r--libcli/smb/smb_signing.c2
-rw-r--r--libcli/smb/wscript2
-rw-r--r--libcli/util/gnutls_error.c69
-rw-r--r--libcli/util/gnutls_error.h31
-rw-r--r--libcli/util/wscript_build4
9 files changed, 8 insertions, 108 deletions
diff --git a/libcli/auth/credentials.c b/libcli/auth/credentials.c
index 1252d0539cd..0b1d84b9799 100644
--- a/libcli/auth/credentials.c
+++ b/libcli/auth/credentials.c
@@ -26,7 +26,7 @@
#include "libcli/auth/libcli_auth.h"
#include "../libcli/security/dom_sid.h"
-#include "libcli/util/gnutls_error.h"
+#include "lib/crypto/gnutls_helpers.h"
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
diff --git a/libcli/auth/wscript_build b/libcli/auth/wscript_build
index 96dcf981a3e..39489c20b4e 100644
--- a/libcli/auth/wscript_build
+++ b/libcli/auth/wscript_build
@@ -18,7 +18,7 @@ bld.SAMBA_SUBSYSTEM('NTLM_CHECK',
bld.SAMBA_SUBSYSTEM('LIBCLI_AUTH',
source='credentials.c session.c smbencrypt.c smbdes.c',
- public_deps='MSRPC_PARSE gnutls',
+ public_deps='MSRPC_PARSE gnutls GNUTLS_HELPERS',
public_headers='credentials.h:domain_credentials.h'
)
diff --git a/libcli/smb/smb2_signing.c b/libcli/smb/smb2_signing.c
index cfe89b6ef79..2f9bae4ba8e 100644
--- a/libcli/smb/smb2_signing.c
+++ b/libcli/smb/smb2_signing.c
@@ -24,7 +24,7 @@
#include "../lib/crypto/crypto.h"
#include "lib/util/iov_buf.h"
-#include "libcli/util/gnutls_error.h"
+#include "lib/crypto/gnutls_helpers.h"
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index 5135ad491fe..2f5fac08128 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -38,7 +38,7 @@
#include "lib/crypto/aes_ccm_128.h"
#include "lib/crypto/aes_gcm_128.h"
-#include "libcli/util/gnutls_error.h"
+#include "lib/crypto/gnutls_helpers.h"
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
diff --git a/libcli/smb/smb_signing.c b/libcli/smb/smb_signing.c
index b67702fe7c0..c75a0756821 100644
--- a/libcli/smb/smb_signing.c
+++ b/libcli/smb/smb_signing.c
@@ -23,7 +23,7 @@
#include "smb_common.h"
#include "smb_signing.h"
-#include "libcli/util/gnutls_error.h"
+#include "lib/crypto/gnutls_helpers.h"
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
diff --git a/libcli/smb/wscript b/libcli/smb/wscript
index 4665703fdef..2fad5ee37c3 100644
--- a/libcli/smb/wscript
+++ b/libcli/smb/wscript
@@ -47,7 +47,7 @@ def build(bld):
''',
deps='''
LIBCRYPTO gnutls NDR_SMB2_LEASE_STRUCT samba-errors gensec krb5samba
- smb_transport
+ smb_transport GNUTLS_HELPERS
''',
public_deps='talloc samba-util iov_buf',
private_library=True,
diff --git a/libcli/util/gnutls_error.c b/libcli/util/gnutls_error.c
deleted file mode 100644
index 306977cd771..00000000000
--- a/libcli/util/gnutls_error.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2019 Andreas Schneider <asn@samba.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "gnutls_error.h"
-
-#include <gnutls/gnutls.h>
-
-NTSTATUS _gnutls_error_to_ntstatus(int gnutls_rc,
- NTSTATUS blocked_status,
- const char *function,
- const char *location)
-{
- NTSTATUS status;
-
- if (gnutls_rc == GNUTLS_E_SUCCESS) {
- return NT_STATUS_OK;
- }
-
- switch (gnutls_rc) {
- case GNUTLS_E_UNWANTED_ALGORITHM:
- status = blocked_status;
- break;
- case GNUTLS_E_MEMORY_ERROR:
- status = NT_STATUS_NO_MEMORY;
- break;
- case GNUTLS_E_INVALID_REQUEST:
- status = NT_STATUS_INVALID_VARIANT;
- break;
- case GNUTLS_E_DECRYPTION_FAILED:
- status = NT_STATUS_DECRYPTION_FAILED;
- break;
- case GNUTLS_E_ENCRYPTION_FAILED:
- status = NT_STATUS_ENCRYPTION_FAILED;
- break;
- case GNUTLS_E_SHORT_MEMORY_BUFFER:
- status = NT_STATUS_INVALID_PARAMETER;
- break;
- case GNUTLS_E_BASE64_DECODING_ERROR:
- case GNUTLS_E_HASH_FAILED:
- case GNUTLS_E_LIB_IN_ERROR_STATE:
- case GNUTLS_E_INTERNAL_ERROR:
- default:
- status = NT_STATUS_INTERNAL_ERROR;
- break;
- }
-
- D_WARNING("%s: GNUTLS ERROR: %s, NTSTATUS: %s at %s\n",
- function,
- gnutls_strerror_name(gnutls_rc),
- nt_errstr(status),
- location);
-
- return status;
-}
diff --git a/libcli/util/gnutls_error.h b/libcli/util/gnutls_error.h
deleted file mode 100644
index fa6420cea30..00000000000
--- a/libcli/util/gnutls_error.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2019 Andreas Schneider <asn@samba.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _GNUTLS_ERROR_H
-#define _GNUTLS_ERROR_H
-
-#include "ntstatus.h"
-
-NTSTATUS _gnutls_error_to_ntstatus(int gnutls_rc,
- NTSTATUS blocked_status,
- const char *function,
- const char *location);
-#define gnutls_error_to_ntstatus(gnutls_rc, blocked_status) \
- _gnutls_error_to_ntstatus(gnutls_rc, blocked_status, \
- __FUNCTION__, __location__)
-
-#endif /* _GNUTLS_ERROR_H */
diff --git a/libcli/util/wscript_build b/libcli/util/wscript_build
index 56a70f888e9..9c8fddca94b 100644
--- a/libcli/util/wscript_build
+++ b/libcli/util/wscript_build
@@ -2,10 +2,10 @@
bld.SAMBA_LIBRARY('samba-errors',
- public_headers='error.h ntstatus.h ntstatus_gen.h doserr.h werror.h werror_gen.h hresult.h gnutls_error.h',
+ public_headers='error.h ntstatus.h ntstatus_gen.h doserr.h werror.h werror_gen.h hresult.h',
private_headers='nterr_private.h',
header_path='core',
- source='doserr.c errormap.c nterr.c errmap_unix.c hresult.c gnutls_error.c',
+ source='doserr.c errormap.c nterr.c errmap_unix.c hresult.c',
public_deps='talloc samba-debug',
deps='gnutls',
# private_library=True,