[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1215-g7a9be21

Kai Blin kai at samba.org
Tue Apr 21 22:15:25 GMT 2009


The branch, master has been updated
       via  7a9be21916589f2c2956e8b264648b66d074bfcb (commit)
       via  57267a300f35e8555ece9015c46353aa73e8eb2e (commit)
       via  2ee437e122c942a560b03bb99d6dacefd54f865b (commit)
      from  1563796b44f43be33fecf9907c967d0fdd14f0ff (commit)

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


- Log -----------------------------------------------------------------
commit 7a9be21916589f2c2956e8b264648b66d074bfcb
Author: Kai Blin <kai at samba.org>
Date:   Thu Apr 16 11:49:25 2009 +0200

    errormap: Add wbcErr to NTSTATUS mappings

commit 57267a300f35e8555ece9015c46353aa73e8eb2e
Author: Kai Blin <kai at samba.org>
Date:   Sun Apr 5 15:38:09 2009 +0200

    s4-build: Also search ../nsswitch for make (c|e)tags

commit 2ee437e122c942a560b03bb99d6dacefd54f865b
Author: Kai Blin <kai at samba.org>
Date:   Fri Apr 17 09:59:39 2009 +0200

    s4 selftest: Export the WINBINDD_SOCKET_DIR env var

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

Summary of changes:
 libcli/util/error.h            |    6 +++++
 selftest/target/Samba4.pm      |    1 +
 source3/libsmb/errormap.c      |   41 ++++++++++++++++++++++++++++++++++++++++
 source4/build/make/rules.mk    |    2 +-
 source4/libcli/util/errormap.c |   37 ++++++++++++++++++++++++++++++++++++
 5 files changed, 86 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/libcli/util/error.h b/libcli/util/error.h
index 5a7cc1b..03e76a2 100644
--- a/libcli/util/error.h
+++ b/libcli/util/error.h
@@ -22,6 +22,7 @@
 #include "libcli/util/werror.h"
 #include "libcli/util/doserr.h"
 #include "libcli/util/ntstatus.h"
+#include "nsswitch/libwbclient/wbclient.h"
 
 /** NT error on DOS connection! (NT_STATUS_OK) */
 bool ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2);
@@ -46,4 +47,9 @@ WERROR ntstatus_to_werror(NTSTATUS error);
 *********************************************************************/
 NTSTATUS map_nt_error_from_unix(int unix_error);
 
+/*******************************************************************************
+ Map between wbcErr and NT status.
+*******************************************************************************/
+NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err);
+
 #endif /* _SAMBA_ERROR_H */
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 1058ac6..781c9f3 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -108,6 +108,7 @@ sub check_or_start($$$)
 		} 
 
 		$ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG}; 
+		$ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR};
 
 		$ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD};
 		$ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP};
diff --git a/source3/libsmb/errormap.c b/source3/libsmb/errormap.c
index 4ec30f7..aea5718 100644
--- a/source3/libsmb/errormap.c
+++ b/source3/libsmb/errormap.c
@@ -20,6 +20,7 @@
  */
 
 #include "includes.h"
+#include "nsswitch/libwbclient/wbclient.h"
 
 /* This map was extracted by the ERRMAPEXTRACT smbtorture command. 
    The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member 
@@ -1503,6 +1504,46 @@ WERROR ntstatus_to_werror(NTSTATUS error)
 	return W_ERROR(NT_STATUS_V(error) & 0xffff);
 }
 
+/*******************************************************************************
+ Map between wbcErr and NT status.
+*******************************************************************************/
+
+static const struct {
+	wbcErr wbc_err;
+	NTSTATUS nt_status;
+} wbcErr_ntstatus_map[] = {
+	{ WBC_ERR_SUCCESS,		 NT_STATUS_OK },
+	{ WBC_ERR_NOT_IMPLEMENTED,	 NT_STATUS_NOT_IMPLEMENTED },
+	{ WBC_ERR_UNKNOWN_FAILURE,	 NT_STATUS_INTERNAL_ERROR },
+	{ WBC_ERR_NO_MEMORY,		 NT_STATUS_NO_MEMORY },
+	{ WBC_ERR_INVALID_SID,		 NT_STATUS_INVALID_SID },
+	{ WBC_ERR_INVALID_PARAM,	 NT_STATUS_INVALID_PARAMETER },
+	{ WBC_ERR_WINBIND_NOT_AVAILABLE, NT_STATUS_SERVER_DISABLED },
+	{ WBC_ERR_DOMAIN_NOT_FOUND,	 NT_STATUS_NO_SUCH_DOMAIN },
+	{ WBC_ERR_INVALID_RESPONSE,	 NT_STATUS_INVALID_NETWORK_RESPONSE },
+	{ WBC_ERR_NSS_ERROR,		 NT_STATUS_INTERNAL_ERROR },
+	{ WBC_ERR_AUTH_ERROR,		 NT_STATUS_LOGON_FAILURE },
+	{ WBC_ERR_UNKNOWN_USER,		 NT_STATUS_NO_SUCH_USER },
+	{ WBC_ERR_UNKNOWN_GROUP,	 NT_STATUS_NO_SUCH_GROUP },
+	{ WBC_ERR_PWD_CHANGE_FAILED,	 NT_STATUS_PASSWORD_RESTRICTION }
+};
+
+NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err)
+{
+	int i;
+
+	/* Look through list */
+	for (i=0;i<ARRAY_SIZE(wbcErr_ntstatus_map);i++) {
+		if (wbcErr_ntstatus_map[i].wbc_err == wbc_err) {
+			return wbcErr_ntstatus_map[i].nt_status;
+		}
+	}
+
+	/* Default return */
+	return NT_STATUS_UNSUCCESSFUL;
+}
+
+
 #if defined(HAVE_GSSAPI)
 /*******************************************************************************
  Map between gssapi errors and NT status. I made these up :-(. JRA.
diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk
index e38496f..96b2a1f 100644
--- a/source4/build/make/rules.mk
+++ b/source4/build/make/rules.mk
@@ -182,7 +182,7 @@ showflags::
 	@echo '  MDLD_FLAGS = $(MDLD_FLAGS)'
 	@echo '  SHLIBEXT   = $(SHLIBEXT)'
 
-base_srcdirs = $(srcdir) ../librpc/ ../lib/ ../libcli ../libgpo
+base_srcdirs = $(srcdir) ../librpc/ ../lib/ ../libcli ../libgpo ../nsswitch
 
 etags:
 	etags $(ETAGS_OPTIONS) `find $(base_srcdirs) -name "*.[ch]"`
diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c
index 930e45b..3ffadce 100644
--- a/source4/libcli/util/errormap.c
+++ b/source4/libcli/util/errormap.c
@@ -21,6 +21,7 @@
 
 #include "includes.h"
 #include "librpc/ndr/libndr.h"
+#include "nsswitch/libwbclient/wbclient.h"
 
 /* This map was extracted by the ERRMAPEXTRACT smbtorture command. 
    The setup was a Samba HEAD (2002-01-03) PDC and an Win2k member 
@@ -1406,3 +1407,39 @@ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
 	/* we should map all error codes to different status codes */
 	return NT_STATUS_INVALID_PARAMETER;
 }
+
+static const struct {
+	wbcErr wbc_err;
+	NTSTATUS nt_status;
+} wbcErr_ntstatus_map[] = {
+	{ WBC_ERR_SUCCESS,		 NT_STATUS_OK },
+	{ WBC_ERR_NOT_IMPLEMENTED,	 NT_STATUS_NOT_IMPLEMENTED },
+	{ WBC_ERR_UNKNOWN_FAILURE,	 NT_STATUS_INTERNAL_ERROR },
+	{ WBC_ERR_NO_MEMORY,		 NT_STATUS_NO_MEMORY },
+	{ WBC_ERR_INVALID_SID,		 NT_STATUS_INVALID_SID },
+	{ WBC_ERR_INVALID_PARAM,	 NT_STATUS_INVALID_PARAMETER },
+	{ WBC_ERR_WINBIND_NOT_AVAILABLE, NT_STATUS_SERVER_DISABLED },
+	{ WBC_ERR_DOMAIN_NOT_FOUND,	 NT_STATUS_NO_SUCH_DOMAIN },
+	{ WBC_ERR_INVALID_RESPONSE,	 NT_STATUS_INVALID_NETWORK_RESPONSE },
+	{ WBC_ERR_NSS_ERROR,		 NT_STATUS_INTERNAL_ERROR },
+	{ WBC_ERR_AUTH_ERROR,		 NT_STATUS_LOGON_FAILURE },
+	{ WBC_ERR_UNKNOWN_USER,		 NT_STATUS_NO_SUCH_USER },
+	{ WBC_ERR_UNKNOWN_GROUP,	 NT_STATUS_NO_SUCH_GROUP },
+	{ WBC_ERR_PWD_CHANGE_FAILED,	 NT_STATUS_PASSWORD_RESTRICTION }
+};
+
+NTSTATUS map_nt_error_from_wbcErr(wbcErr wbc_err)
+{
+	int i;
+
+	/* Look through list */
+	for (i=0;i<ARRAY_SIZE(wbcErr_ntstatus_map);i++) {
+		if (wbcErr_ntstatus_map[i].wbc_err == wbc_err) {
+			return wbcErr_ntstatus_map[i].nt_status;
+		}
+	}
+
+	/* Default return */
+	return NT_STATUS_UNSUCCESSFUL;
+}
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list