summaryrefslogtreecommitdiff
path: root/source3/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@sernet.de>2007-11-10 21:37:24 +0100
committerStefan Metzmacher <metze@samba.org>2007-11-11 09:12:30 +0100
commitc046a2f527939a09750e31f37db8e3c3e2b5b12e (patch)
tree3a0dcf98b69e1745e8df5dba23e8ebaeda8bd92e /source3/librpc
parent2b3c44e4fb980335c22abcc07a88f32b13e5918f (diff)
downloadsamba-c046a2f527939a09750e31f37db8e3c3e2b5b12e.tar.gz
samba-c046a2f527939a09750e31f37db8e3c3e2b5b12e.tar.bz2
samba-c046a2f527939a09750e31f37db8e3c3e2b5b12e.zip
Add ndr_errstr
(This used to be commit e3b36073f1fc994b102a5bdf321b9dd519288420)
Diffstat (limited to 'source3/librpc')
-rw-r--r--source3/librpc/ndr/ndr.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c
index a1295c7db5..62a88a8856 100644
--- a/source3/librpc/ndr/ndr.c
+++ b/source3/librpc/ndr/ndr.c
@@ -376,6 +376,72 @@ NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
}
/*
+ * Convert an ndr error to string
+ */
+
+const char *ndr_errstr(enum ndr_err_code err)
+{
+ switch (err) {
+ case NDR_ERR_SUCCESS:
+ return "NDR_ERR_SUCCESS";
+ break;
+ case NDR_ERR_ARRAY_SIZE:
+ return "NDR_ERR_ARRAY_SIZE";
+ break;
+ case NDR_ERR_BAD_SWITCH:
+ return "NDR_ERR_BAD_SWITCH";
+ break;
+ case NDR_ERR_OFFSET:
+ return "NDR_ERR_OFFSET";
+ break;
+ case NDR_ERR_RELATIVE:
+ return "NDR_ERR_RELATIVE";
+ break;
+ case NDR_ERR_CHARCNV:
+ return "NDR_ERR_CHARCNV";
+ break;
+ case NDR_ERR_LENGTH:
+ return "NDR_ERR_LENGTH";
+ break;
+ case NDR_ERR_SUBCONTEXT:
+ return "NDR_ERR_SUBCONTEXT";
+ break;
+ case NDR_ERR_COMPRESSION:
+ return "NDR_ERR_COMPRESSION";
+ break;
+ case NDR_ERR_STRING:
+ return "NDR_ERR_STRING";
+ break;
+ case NDR_ERR_VALIDATE:
+ return "NDR_ERR_VALIDATE";
+ break;
+ case NDR_ERR_BUFSIZE:
+ return "NDR_ERR_BUFSIZE";
+ break;
+ case NDR_ERR_ALLOC:
+ return "NDR_ERR_ALLOC";
+ break;
+ case NDR_ERR_RANGE:
+ return "NDR_ERR_RANGE";
+ break;
+ case NDR_ERR_TOKEN:
+ return "NDR_ERR_TOKEN";
+ break;
+ case NDR_ERR_IPV4ADDRESS:
+ return "NDR_ERR_IPV4ADDRESS";
+ break;
+ case NDR_ERR_INVALID_POINTER:
+ return "NDR_ERR_INVALID_POINTER";
+ break;
+ case NDR_ERR_UNREAD_BYTES:
+ return "NDR_ERR_UNREAD_BYTES";
+ break;
+ }
+
+ return talloc_asprintf(talloc_tos(), "Unknown NDR error: %d", err);
+}
+
+/*
return and possibly log an NDR error
*/
_PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr,