[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Thu Jul 8 10:22:01 UTC 2021


The branch, master has been updated
       via  51012692703 lib/tsocket: Free subreq as soon as possible
       via  8cce23acb9f witness.idl: fix length calculation for witness_IPaddrInfoList
       via  cf1baa8be90 torture/ndr: reproduce a problem with witness_AsyncNotify
       via  cb60901604c torture/ndr: add more details to the test names
       via  f0a1f1789c3 torture/ndr: make check functions typesafe
       via  2b8c73b5494 libcli: Move map_errno_from_nt_status from s3 lib to common libcli
       via  f1181ade379 s3:lib: Map ECANCELED to NT_STATUS_CANCELLED
       via  0c94e48c644 auth:creds: Remove unused simple.c file
       via  252275f3a6b lib:tdb: Fix a memory leak on error
      from  7e9c97ba1cd selftest: Add test for one-way trust wbinfo auth

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 51012692703776d7fde15284cc0e8af71b15ac55
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Fri Jul 31 11:13:27 2020 +0200

    lib/tsocket: Free subreq as soon as possible
    
    This is not a memory leak as it is freed when the parent req's state is
    freed, but will help in low memory situations.
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Thu Jul  8 10:21:25 UTC 2021 on sn-devel-184

commit 8cce23acb9f9bdde8bff3c3a7ffa83361e3a64a6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 31 11:27:25 2020 +0200

    witness.idl: fix length calculation for witness_IPaddrInfoList
    
    If r->num is 0, we should not dereference r->addr.
    
    Using ndr_size_witness_IPaddrInfoList() also make this much simpler
    and avoids the magic 12.
    
    Credit Oss-Fuzz
    
    REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22175
    REF: https://oss-fuzz.com/testcase-detail/5686294157197312
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14452
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

commit cf1baa8be90a3f141d07da430146f06cbd2d1e09
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 31 11:27:10 2020 +0200

    torture/ndr: reproduce a problem with witness_AsyncNotify
    
    Credit Oss-Fuzz
    
    REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22175
    REF: https://oss-fuzz.com/testcase-detail/5686294157197312
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14452
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

commit cb60901604cd2f2e45acb609281b5a52b0b39aea
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 31 13:23:19 2020 +0200

    torture/ndr: add more details to the test names
    
    We can have more than one blob for a given idl function
    and we should avoid using the same name for all of them.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14452
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

commit f0a1f1789c3c96a654ccaa0f803e247070be117b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 31 13:20:09 2020 +0200

    torture/ndr: make check functions typesafe
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14452
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Samuel Cabrero <scabrero at samba.org>

commit 2b8c73b5494e0a12834e2189b2e89b30ef92d19d
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Fri Jan 22 14:04:35 2021 +0100

    libcli: Move map_errno_from_nt_status from s3 lib to common libcli
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit f1181ade37961fea0deb6c99635b8f8c8c508d47
Author: Samuel Cabrero <scabrero at samba.org>
Date:   Thu Jul 30 12:07:57 2020 +0200

    s3:lib: Map ECANCELED to NT_STATUS_CANCELLED
    
    Now map_nt_error_from_unix() returns the same value as
    map_nt_error_from_unix_common().
    
    Signed-off-by: Samuel Cabrero <scabrero at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0c94e48c6447249b0ed8858bde5463f524948bf6
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jun 22 09:31:29 2021 +0200

    auth:creds: Remove unused simple.c file
    
    This code is tested by the cmocka unit test:
    auth/credentials/tests/test_creds.c
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 252275f3a6b5d81d23ca0eb35bcb67c2d01dd807
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jul 7 11:12:37 2021 +0200

    lib:tdb: Fix a memory leak on error
    
    Found by covscan.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/credentials/tests/simple.c | 168 ----------------------------------------
 lib/tdb/common/transaction.c    |   1 +
 lib/tsocket/tsocket_helpers.c   |   1 +
 libcli/util/errmap_unix.c       | 140 +++++++++++++++++++++++++++++++++
 libcli/util/error.h             |   5 ++
 librpc/idl/witness.idl          |   6 +-
 source3/include/proto.h         |   1 -
 source3/lib/errmap_unix.c       | 135 --------------------------------
 source3/wscript_build           |   1 -
 source4/torture/ndr/lsa.c       |   3 +-
 source4/torture/ndr/ndr.c       |  19 +++--
 source4/torture/ndr/ndr.h       | 100 +++++++++++++++++++++---
 source4/torture/ndr/witness.c   |  43 ++++++++++
 13 files changed, 299 insertions(+), 324 deletions(-)
 delete mode 100644 auth/credentials/tests/simple.c


Changeset truncated at 500 lines:

diff --git a/auth/credentials/tests/simple.c b/auth/credentials/tests/simple.c
deleted file mode 100644
index 32a9ca7c533..00000000000
--- a/auth/credentials/tests/simple.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Samba utility functions
-   Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
-   
-   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 "auth/credentials/credentials.h"
-#include "torture/torture.h"
-#include "torture/local/proto.h"
-
-static bool test_init(struct torture_context *tctx)
-{
-	struct cli_credentials *creds = cli_credentials_init(tctx);
-
-	cli_credentials_set_domain(creds, "bla", CRED_SPECIFIED);
-
-	torture_assert_str_equal(tctx, "BLA", cli_credentials_get_domain(creds),
-				 "domain");
-
-	cli_credentials_set_username(creds, "someuser", CRED_SPECIFIED);
-
-	torture_assert_str_equal(tctx, "someuser", 
-				 cli_credentials_get_username(creds), 
-				 "username");
-
-	cli_credentials_set_password(creds, "p4ssw0rd", CRED_SPECIFIED);
-
-	torture_assert_str_equal(tctx, "p4ssw0rd", 
-				 cli_credentials_get_password(creds),
-				 "password");
-
-	return true;
-}
-
-static bool test_init_anonymous(struct torture_context *tctx)
-{
-	struct cli_credentials *creds = cli_credentials_init_anon(tctx);
-
-	torture_assert_str_equal(tctx, cli_credentials_get_domain(creds),
-				 "", "domain");
-
-	torture_assert_str_equal(tctx, cli_credentials_get_username(creds),
-				 "", "username");
-
-	torture_assert(tctx, cli_credentials_get_password(creds) == NULL,
-				 "password");
-
-	return true;
-}
-
-static bool test_guess(struct torture_context *tctx)
-{
-	struct cli_credentials *creds = cli_credentials_init_anon(tctx);
-	enum credentials_use_kerberos old_kerb_state = \
-		cli_credentials_get_kerberos_state(creds);
-	const char *logname = getenv("LOGNAME");
-	const char *user = getenv("USER");
-	const char *passwd = getenv("PASSWD");
-	const char *passwd_fd = getenv("PASSWD_FD");
-	const char *passwd_file = getenv("PASSWD_FILE");
-
-	cli_credentials_set_kerberos_state(creds,
-					   CRED_USE_KERBEROS_REQUIRED,
-					   CRED_SPECIFIED);
-
-	unsetenv("USER");
-	unsetenv("PASSWD_FD");
-	unsetenv("PASSWD_FILE");
-
-	setenv("LOGNAME", "xx", 1);
-	setenv("PASSWD", "xx", 1);
-
-	cli_credentials_guess(creds, NULL);
-	if (logname != NULL) {
-		setenv("LOGNAME", logname, 1);
-	}
-	if (user != NULL) {
-		setenv("USER", user, 1);
-	}
-	if (passwd != NULL) {
-		setenv("PASSWD", passwd, 1);
-	}
-	if (passwd_fd != NULL) {
-		setenv("PASSWD_FD", passwd_fd, 1);
-	}
-	if (passwd_file != NULL) {
-		setenv("PASSWD_FILE", passwd_file, 1);
-	}
-	cli_credentials_set_kerberos_state(creds,
-					   old_kerb_state,
-					   CRED_SPECIFIED);
-
-	return true;
-}
-
-
-static bool test_parse_string(struct torture_context *tctx)
-{
-	struct cli_credentials *creds = cli_credentials_init_anon(tctx);
-
-	/* anonymous */
-	cli_credentials_parse_string(creds, "%", CRED_SPECIFIED);
-
-	torture_assert_str_equal(tctx, cli_credentials_get_domain(creds),
-				 "", "domain");
-
-	torture_assert_str_equal(tctx, cli_credentials_get_username(creds),
-				 "", "username");
-
-	torture_assert(tctx, cli_credentials_get_password(creds) == NULL,
-				 "password");
-
-	/* username + password */
-	cli_credentials_parse_string(creds, "somebody%secret", 
-				     CRED_SPECIFIED);
-
-	torture_assert_str_equal(tctx, cli_credentials_get_domain(creds),
-				 "", "domain");
-
-	torture_assert_str_equal(tctx, cli_credentials_get_username(creds),
-				 "somebody", "username");
-
-	torture_assert_str_equal(tctx, cli_credentials_get_password(creds),
-				 "secret", "password");
-
-	/* principal */
-	cli_credentials_parse_string(creds, "prin at styx", 
-				     CRED_SPECIFIED);
-
-	torture_assert_str_equal(tctx, cli_credentials_get_realm(creds),
-				 "STYX", "realm");
-
-	torture_assert_str_equal(tctx, 
-				 cli_credentials_get_principal(creds, tctx),
-				 "prin at styx", "principal");
-
-	return true;
-}
-
-struct torture_suite *torture_local_credentials(TALLOC_CTX *mem_ctx)
-{
-	struct torture_suite *suite = torture_suite_create(mem_ctx, "credentials");
-
-	torture_suite_add_simple_test(suite, "init", test_init);
-	torture_suite_add_simple_test(suite, "init anonymous", 
-				      test_init_anonymous);
-	torture_suite_add_simple_test(suite, "guess",
-				      test_guess);
-	torture_suite_add_simple_test(suite, "parse_string",
-				      test_parse_string);
-
-	return suite;
-}
-
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c
index 4f8d1f8cdcc..5ab38d0809f 100644
--- a/lib/tdb/common/transaction.c
+++ b/lib/tdb/common/transaction.c
@@ -1301,6 +1301,7 @@ int tdb_transaction_recover(struct tdb_context *tdb)
 				   rec.data_len, 0) == -1) {
 		TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n"));
 		tdb->ecode = TDB_ERR_IO;
+		free(data);
 		return -1;
 	}
 
diff --git a/lib/tsocket/tsocket_helpers.c b/lib/tsocket/tsocket_helpers.c
index 49c6840f873..c7ad5312214 100644
--- a/lib/tsocket/tsocket_helpers.c
+++ b/lib/tsocket/tsocket_helpers.c
@@ -308,6 +308,7 @@ static void tstream_readv_pdu_readv_done(struct tevent_req *subreq)
 	int sys_errno;
 
 	ret = tstream_readv_recv(subreq, &sys_errno);
+	TALLOC_FREE(subreq);
 	if (ret == -1) {
 		tevent_req_error(req, sys_errno);
 		return;
diff --git a/libcli/util/errmap_unix.c b/libcli/util/errmap_unix.c
index 9ac680919d8..714fead6efc 100644
--- a/libcli/util/errmap_unix.c
+++ b/libcli/util/errmap_unix.c
@@ -155,3 +155,143 @@ NTSTATUS map_nt_error_from_unix_common(int unix_error)
 	return NT_STATUS_UNSUCCESSFUL;
 }
 
+/* Return a UNIX errno from a NT status code */
+static const struct {
+	NTSTATUS status;
+	int error;
+} nt_errno_map[] = {
+	{NT_STATUS_ACCESS_VIOLATION, EACCES},
+	{NT_STATUS_INVALID_HANDLE, EBADF},
+	{NT_STATUS_ACCESS_DENIED, EACCES},
+	{NT_STATUS_OBJECT_NAME_NOT_FOUND, ENOENT},
+	{NT_STATUS_OBJECT_PATH_NOT_FOUND, ENOENT},
+	{NT_STATUS_SHARING_VIOLATION, EBUSY},
+	{NT_STATUS_OBJECT_PATH_INVALID, ENOTDIR},
+	{NT_STATUS_OBJECT_NAME_COLLISION, EEXIST},
+	{NT_STATUS_PATH_NOT_COVERED, ENOENT},
+	{NT_STATUS_UNSUCCESSFUL, EINVAL},
+	{NT_STATUS_NOT_IMPLEMENTED, ENOSYS},
+	{NT_STATUS_IN_PAGE_ERROR, EFAULT},
+	{NT_STATUS_BAD_NETWORK_NAME, ENOENT},
+#ifdef EDQUOT
+	{NT_STATUS_PAGEFILE_QUOTA, EDQUOT},
+	{NT_STATUS_QUOTA_EXCEEDED, EDQUOT},
+	{NT_STATUS_REGISTRY_QUOTA_LIMIT, EDQUOT},
+	{NT_STATUS_LICENSE_QUOTA_EXCEEDED, EDQUOT},
+#endif
+#ifdef ETIME
+	{NT_STATUS_TIMER_NOT_CANCELED, ETIME},
+#endif
+	{NT_STATUS_INVALID_PARAMETER, EINVAL},
+	{NT_STATUS_NO_SUCH_DEVICE, ENODEV},
+	{NT_STATUS_NO_SUCH_FILE, ENOENT},
+#ifdef ENODATA
+	{NT_STATUS_END_OF_FILE, ENODATA},
+#endif
+#ifdef ENOMEDIUM
+	{NT_STATUS_NO_MEDIA_IN_DEVICE, ENOMEDIUM},
+	{NT_STATUS_NO_MEDIA, ENOMEDIUM},
+#endif
+	{NT_STATUS_NONEXISTENT_SECTOR, ESPIPE},
+	{NT_STATUS_NO_MEMORY, ENOMEM},
+	{NT_STATUS_CONFLICTING_ADDRESSES, EADDRINUSE},
+	{NT_STATUS_NOT_MAPPED_VIEW, EINVAL},
+	{NT_STATUS_UNABLE_TO_FREE_VM, EADDRINUSE},
+	{NT_STATUS_ACCESS_DENIED, EACCES},
+	{NT_STATUS_BUFFER_TOO_SMALL, ENOBUFS},
+	{NT_STATUS_WRONG_PASSWORD, EACCES},
+	{NT_STATUS_LOGON_FAILURE, EACCES},
+	{NT_STATUS_INVALID_WORKSTATION, EACCES},
+	{NT_STATUS_INVALID_LOGON_HOURS, EACCES},
+	{NT_STATUS_PASSWORD_EXPIRED, EACCES},
+	{NT_STATUS_ACCOUNT_DISABLED, EACCES},
+	{NT_STATUS_DISK_FULL, ENOSPC},
+	{NT_STATUS_INVALID_PIPE_STATE, EPIPE},
+	{NT_STATUS_PIPE_BUSY, EPIPE},
+	{NT_STATUS_PIPE_DISCONNECTED, EPIPE},
+	{NT_STATUS_PIPE_NOT_AVAILABLE, ENOSYS},
+	{NT_STATUS_FILE_IS_A_DIRECTORY, EISDIR},
+	{NT_STATUS_NOT_SUPPORTED, ENOSYS},
+	{NT_STATUS_NOT_A_DIRECTORY, ENOTDIR},
+	{NT_STATUS_DIRECTORY_NOT_EMPTY, ENOTEMPTY},
+	{NT_STATUS_NETWORK_UNREACHABLE, ENETUNREACH},
+	{NT_STATUS_HOST_UNREACHABLE, EHOSTUNREACH},
+	{NT_STATUS_CONNECTION_ABORTED, ECONNABORTED},
+	{NT_STATUS_CONNECTION_REFUSED, ECONNREFUSED},
+	{NT_STATUS_TOO_MANY_LINKS, EMLINK},
+	{NT_STATUS_NETWORK_BUSY, EBUSY},
+	{NT_STATUS_DEVICE_DOES_NOT_EXIST, ENODEV},
+#ifdef ELIBACC
+	{NT_STATUS_DLL_NOT_FOUND, ELIBACC},
+#endif
+	{NT_STATUS_PIPE_BROKEN, EPIPE},
+	{NT_STATUS_REMOTE_NOT_LISTENING, ECONNREFUSED},
+	{NT_STATUS_NETWORK_ACCESS_DENIED, EACCES},
+	{NT_STATUS_TOO_MANY_OPENED_FILES, EMFILE},
+#ifdef EPROTO
+	{NT_STATUS_DEVICE_PROTOCOL_ERROR, EPROTO},
+#endif
+	{NT_STATUS_FLOAT_OVERFLOW, ERANGE},
+	{NT_STATUS_FLOAT_UNDERFLOW, ERANGE},
+	{NT_STATUS_INTEGER_OVERFLOW, ERANGE},
+	{NT_STATUS_MEDIA_WRITE_PROTECTED, EROFS},
+	{NT_STATUS_PIPE_CONNECTED, EISCONN},
+	{NT_STATUS_MEMORY_NOT_ALLOCATED, EFAULT},
+	{NT_STATUS_FLOAT_INEXACT_RESULT, ERANGE},
+	{NT_STATUS_ILL_FORMED_PASSWORD, EACCES},
+	{NT_STATUS_PASSWORD_RESTRICTION, EACCES},
+	{NT_STATUS_ACCOUNT_RESTRICTION, EACCES},
+	{NT_STATUS_PORT_CONNECTION_REFUSED, ECONNREFUSED},
+	{NT_STATUS_NAME_TOO_LONG, ENAMETOOLONG},
+	{NT_STATUS_REMOTE_DISCONNECT, ESHUTDOWN},
+	{NT_STATUS_CONNECTION_DISCONNECTED, ECONNABORTED},
+	{NT_STATUS_CONNECTION_RESET, ENETRESET},
+#ifdef ENOTUNIQ
+	{NT_STATUS_IP_ADDRESS_CONFLICT1, ENOTUNIQ},
+	{NT_STATUS_IP_ADDRESS_CONFLICT2, ENOTUNIQ},
+#endif
+	{NT_STATUS_PORT_MESSAGE_TOO_LONG, EMSGSIZE},
+	{NT_STATUS_PROTOCOL_UNREACHABLE, ENOPROTOOPT},
+	{NT_STATUS_ADDRESS_ALREADY_EXISTS, EADDRINUSE},
+	{NT_STATUS_PORT_UNREACHABLE, EHOSTUNREACH},
+	{NT_STATUS_IO_TIMEOUT, ETIMEDOUT},
+	{NT_STATUS_RETRY, EAGAIN},
+#ifdef ENOTUNIQ
+	{NT_STATUS_DUPLICATE_NAME, ENOTUNIQ},
+#endif
+#ifdef ECOMM
+	{NT_STATUS_NET_WRITE_FAULT, ECOMM},
+#endif
+#ifdef EXDEV
+	{NT_STATUS_NOT_SAME_DEVICE, EXDEV},
+#endif
+#ifdef ECANCELED
+	{NT_STATUS_CANCELLED, ECANCELED},
+#endif
+};
+
+/*********************************************************************
+ Map a Unix error code from a NT error code.
+*********************************************************************/
+int map_errno_from_nt_status(NTSTATUS status)
+{
+	size_t i;
+
+	DBG_DEBUG("32 bit codes: code=%08x\n", NT_STATUS_V(status));
+
+	/* Status codes without this bit set are not errors */
+
+	if (!(NT_STATUS_V(status) & 0xc0000000)) {
+		return 0;
+	}
+
+	for (i=0;i<ARRAY_SIZE(nt_errno_map);i++) {
+		if (NT_STATUS_V(nt_errno_map[i].status) ==
+			    NT_STATUS_V(status)) {
+			return nt_errno_map[i].error;
+		}
+	}
+
+	/* for all other cases - a default code */
+	return EINVAL;
+}
diff --git a/libcli/util/error.h b/libcli/util/error.h
index 14614458473..3e74e6edf98 100644
--- a/libcli/util/error.h
+++ b/libcli/util/error.h
@@ -44,6 +44,11 @@ WERROR ntstatus_to_werror(NTSTATUS error);
 *********************************************************************/
 NTSTATUS map_nt_error_from_unix_common(int unix_error);
 
+/*********************************************************************
+ Map a Unix error code from a NT error code.
+*********************************************************************/
+int map_errno_from_nt_status(NTSTATUS status);
+
 NTSTATUS nt_status_squash(NTSTATUS nt_status);
 
 /*****************************************************************************
diff --git a/librpc/idl/witness.idl b/librpc/idl/witness.idl
index e230a5ea709..652c0e9cb65 100644
--- a/librpc/idl/witness.idl
+++ b/librpc/idl/witness.idl
@@ -98,14 +98,14 @@ interface witness
 		WITNESS_IPADDR_OFFLINE = 0x10
 	} witness_IPaddrInfo_flags;
 
-	typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct {
+	typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
 		witness_IPaddrInfo_flags flags;
 		[flag(NDR_BIG_ENDIAN)] ipv4address ipv4;
 		[flag(NDR_BIG_ENDIAN)] ipv6address ipv6;
 	} witness_IPaddrInfo;
 
-	typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
-		[value(12+(r->num*ndr_size_witness_IPaddrInfo(r->addr, ndr->flags)))] uint32 length;
+	typedef [public,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN),gensize] struct {
+		[value(ndr_size_witness_IPaddrInfoList(r, ndr->flags))] uint32 length;
 		[value(0)] uint32 reserved;
 		uint32 num;
 		witness_IPaddrInfo addr[num];
diff --git a/source3/include/proto.h b/source3/include/proto.h
index d33cccd8390..4485cb43419 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -73,7 +73,6 @@ void display_set_stderr(void);
 /* The following definitions come from lib/errmap_unix.c  */
 
 NTSTATUS map_nt_error_from_unix(int unix_error);
-int map_errno_from_nt_status(NTSTATUS status);
 
 /* The following definitions come from lib/file_id.c  */
 
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 33b48cadcb5..73b2f532a06 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -150,138 +150,3 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
 	/* Default return */
 	return NT_STATUS_ACCESS_DENIED;
 }
-
-/* Return a UNIX errno from a NT status code */
-static const struct {
-	NTSTATUS status;
-	int error;
-} nt_errno_map[] = {
-        {NT_STATUS_ACCESS_VIOLATION, EACCES},
-        {NT_STATUS_INVALID_HANDLE, EBADF},
-        {NT_STATUS_ACCESS_DENIED, EACCES},
-        {NT_STATUS_OBJECT_NAME_NOT_FOUND, ENOENT},
-        {NT_STATUS_OBJECT_PATH_NOT_FOUND, ENOENT},
-        {NT_STATUS_SHARING_VIOLATION, EBUSY},
-        {NT_STATUS_OBJECT_PATH_INVALID, ENOTDIR},
-        {NT_STATUS_OBJECT_NAME_COLLISION, EEXIST},
-        {NT_STATUS_PATH_NOT_COVERED, ENOENT},
-	{NT_STATUS_UNSUCCESSFUL, EINVAL},
-	{NT_STATUS_NOT_IMPLEMENTED, ENOSYS},
-	{NT_STATUS_IN_PAGE_ERROR, EFAULT}, 
-	{NT_STATUS_BAD_NETWORK_NAME, ENOENT},
-#ifdef EDQUOT
-	{NT_STATUS_PAGEFILE_QUOTA, EDQUOT},
-	{NT_STATUS_QUOTA_EXCEEDED, EDQUOT},
-	{NT_STATUS_REGISTRY_QUOTA_LIMIT, EDQUOT},
-	{NT_STATUS_LICENSE_QUOTA_EXCEEDED, EDQUOT},
-#endif
-#ifdef ETIME
-	{NT_STATUS_TIMER_NOT_CANCELED, ETIME},
-#endif
-	{NT_STATUS_INVALID_PARAMETER, EINVAL},
-	{NT_STATUS_NO_SUCH_DEVICE, ENODEV},
-	{NT_STATUS_NO_SUCH_FILE, ENOENT},
-#ifdef ENODATA
-	{NT_STATUS_END_OF_FILE, ENODATA}, 
-#endif
-#ifdef ENOMEDIUM
-	{NT_STATUS_NO_MEDIA_IN_DEVICE, ENOMEDIUM}, 
-	{NT_STATUS_NO_MEDIA, ENOMEDIUM},
-#endif
-	{NT_STATUS_NONEXISTENT_SECTOR, ESPIPE}, 
-        {NT_STATUS_NO_MEMORY, ENOMEM},
-	{NT_STATUS_CONFLICTING_ADDRESSES, EADDRINUSE},
-	{NT_STATUS_NOT_MAPPED_VIEW, EINVAL},
-	{NT_STATUS_UNABLE_TO_FREE_VM, EADDRINUSE},
-	{NT_STATUS_ACCESS_DENIED, EACCES}, 
-	{NT_STATUS_BUFFER_TOO_SMALL, ENOBUFS},
-	{NT_STATUS_WRONG_PASSWORD, EACCES},
-	{NT_STATUS_LOGON_FAILURE, EACCES},
-	{NT_STATUS_INVALID_WORKSTATION, EACCES},
-	{NT_STATUS_INVALID_LOGON_HOURS, EACCES},
-	{NT_STATUS_PASSWORD_EXPIRED, EACCES},
-	{NT_STATUS_ACCOUNT_DISABLED, EACCES},
-	{NT_STATUS_DISK_FULL, ENOSPC},
-	{NT_STATUS_INVALID_PIPE_STATE, EPIPE},
-	{NT_STATUS_PIPE_BUSY, EPIPE},
-	{NT_STATUS_PIPE_DISCONNECTED, EPIPE},
-	{NT_STATUS_PIPE_NOT_AVAILABLE, ENOSYS},
-	{NT_STATUS_FILE_IS_A_DIRECTORY, EISDIR},
-	{NT_STATUS_NOT_SUPPORTED, ENOSYS},
-	{NT_STATUS_NOT_A_DIRECTORY, ENOTDIR},
-	{NT_STATUS_DIRECTORY_NOT_EMPTY, ENOTEMPTY},
-	{NT_STATUS_NETWORK_UNREACHABLE, ENETUNREACH},
-	{NT_STATUS_HOST_UNREACHABLE, EHOSTUNREACH},
-	{NT_STATUS_CONNECTION_ABORTED, ECONNABORTED},
-	{NT_STATUS_CONNECTION_REFUSED, ECONNREFUSED},
-	{NT_STATUS_TOO_MANY_LINKS, EMLINK},
-	{NT_STATUS_NETWORK_BUSY, EBUSY},
-	{NT_STATUS_DEVICE_DOES_NOT_EXIST, ENODEV},
-#ifdef ELIBACC
-	{NT_STATUS_DLL_NOT_FOUND, ELIBACC},
-#endif
-	{NT_STATUS_PIPE_BROKEN, EPIPE},
-	{NT_STATUS_REMOTE_NOT_LISTENING, ECONNREFUSED},
-	{NT_STATUS_NETWORK_ACCESS_DENIED, EACCES},
-	{NT_STATUS_TOO_MANY_OPENED_FILES, EMFILE},
-#ifdef EPROTO
-	{NT_STATUS_DEVICE_PROTOCOL_ERROR, EPROTO},
-#endif
-	{NT_STATUS_FLOAT_OVERFLOW, ERANGE},
-	{NT_STATUS_FLOAT_UNDERFLOW, ERANGE},
-	{NT_STATUS_INTEGER_OVERFLOW, ERANGE},
-	{NT_STATUS_MEDIA_WRITE_PROTECTED, EROFS},
-	{NT_STATUS_PIPE_CONNECTED, EISCONN},
-	{NT_STATUS_MEMORY_NOT_ALLOCATED, EFAULT},
-	{NT_STATUS_FLOAT_INEXACT_RESULT, ERANGE},
-	{NT_STATUS_ILL_FORMED_PASSWORD, EACCES},
-	{NT_STATUS_PASSWORD_RESTRICTION, EACCES},
-	{NT_STATUS_ACCOUNT_RESTRICTION, EACCES},
-	{NT_STATUS_PORT_CONNECTION_REFUSED, ECONNREFUSED},
-	{NT_STATUS_NAME_TOO_LONG, ENAMETOOLONG},
-	{NT_STATUS_REMOTE_DISCONNECT, ESHUTDOWN},
-	{NT_STATUS_CONNECTION_DISCONNECTED, ECONNABORTED},
-	{NT_STATUS_CONNECTION_RESET, ENETRESET},
-#ifdef ENOTUNIQ
-	{NT_STATUS_IP_ADDRESS_CONFLICT1, ENOTUNIQ},
-	{NT_STATUS_IP_ADDRESS_CONFLICT2, ENOTUNIQ},
-#endif


-- 
Samba Shared Repository



More information about the samba-cvs mailing list