summaryrefslogtreecommitdiff
path: root/librpc/ndr/ndr_basic.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-02-13 13:27:22 +0100
committerVolker Lendecke <vl@samba.org>2012-02-13 15:06:28 +0100
commite34e95feae401985045c2816d40c2d2ccf8d4a86 (patch)
treeb262a92f6dad387db2ffbb76a08f036052514241 /librpc/ndr/ndr_basic.c
parent0f22e35028884187d04343055b6c7d3aa7b2ece8 (diff)
downloadsamba-e34e95feae401985045c2816d40c2d2ccf8d4a86.tar.gz
samba-e34e95feae401985045c2816d40c2d2ccf8d4a86.tar.bz2
samba-e34e95feae401985045c2816d40c2d2ccf8d4a86.zip
libndr: Add ndr_map_error2errno
Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Mon Feb 13 15:06:29 CET 2012 on sn-devel-104
Diffstat (limited to 'librpc/ndr/ndr_basic.c')
-rw-r--r--librpc/ndr/ndr_basic.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 7b164385d4..7a4e22ad70 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)