[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Mon Feb 13 07:07:02 MST 2012


The branch, master has been updated
       via  e34e95f libndr: Add ndr_map_error2errno
      from  0f22e35 s3-auth: On successful user mapping set mapped_to_guest to false.

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


- Log -----------------------------------------------------------------
commit e34e95feae401985045c2816d40c2d2ccf8d4a86
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Feb 13 13:27:22 2012 +0100

    libndr: Add ndr_map_error2errno
    
    Autobuild-User: Volker Lendecke <vl at samba.org>
    Autobuild-Date: Mon Feb 13 15:06:29 CET 2012 on sn-devel-104

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

Summary of changes:
 librpc/ndr/libndr.h    |    1 +
 librpc/ndr/ndr_basic.c |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index 162c109..36adae9 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -407,6 +407,7 @@ struct sockaddr_storage;
  Map an NT error code from a NDR error code.
 *********************************************************************/
 NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err);
+int ndr_map_error2errno(enum ndr_err_code ndr_err);
 const char *ndr_map_error2string(enum ndr_err_code ndr_err);
 #define ndr_errstr ndr_map_error2string
 
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 7b16438..7a4e22a 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -1339,6 +1339,31 @@ _PUBLIC_ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
 	return NT_STATUS_INVALID_PARAMETER;
 }
 
+_PUBLIC_ int ndr_map_error2errno(enum ndr_err_code ndr_err)
+{
+	switch (ndr_err) {
+	case NDR_ERR_SUCCESS:
+		return 0;
+	case NDR_ERR_BUFSIZE:
+		return ENOSPC;
+	case NDR_ERR_TOKEN:
+		return EINVAL;
+	case NDR_ERR_ALLOC:
+		return ENOMEM;
+	case NDR_ERR_ARRAY_SIZE:
+		return EMSGSIZE;
+	case NDR_ERR_INVALID_POINTER:
+		return EINVAL;
+	case NDR_ERR_UNREAD_BYTES:
+		return EOVERFLOW;
+	default:
+		break;
+	}
+
+	/* we should map all error codes to different status codes */
+	return EINVAL;
+}
+
 _PUBLIC_ enum ndr_err_code ndr_push_timespec(struct ndr_push *ndr,
 					     int ndr_flags,
 					     const struct timespec *t)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list