[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-150-gcce04c6
Jelmer Vernooij
jelmer at samba.org
Mon Jan 26 17:15:27 GMT 2009
The branch, master has been updated
via cce04c606e7a91fcaf75c8efd7ca0cd4aa15ece9 (commit)
via d30b6af9532c0ea4e9610b30d13e7a4d9b763834 (commit)
via 79255cec6a75cd96b05a42845ff39040d1a1dfbf (commit)
from d8f15e4efc00b9d509ff5761e9ca8ff5c6f443f7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cce04c606e7a91fcaf75c8efd7ca0cd4aa15ece9
Merge: d30b6af9532c0ea4e9610b30d13e7a4d9b763834 d8f15e4efc00b9d509ff5761e9ca8ff5c6f443f7
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Jan 26 18:14:41 2009 +0100
Merge branch 'master' of ssh://git.samba.org/data/git/samba
commit d30b6af9532c0ea4e9610b30d13e7a4d9b763834
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Jan 26 17:31:50 2009 +0100
pyrpc: Raise proper NDR error codes with matching strings rather than mapping
to NTSTATUS first.
commit 79255cec6a75cd96b05a42845ff39040d1a1dfbf
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Jan 26 17:31:22 2009 +0100
Add function for mapping NDR error codes to strings.
-----------------------------------------------------------------------
Summary of changes:
librpc/ndr/libndr.h | 1 +
librpc/ndr/ndr.c | 35 +++++++++++++++++++++++++++++++++++
source4/librpc/rpc/pyrpc.h | 2 +-
3 files changed, 37 insertions(+), 1 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index fdecddc..4ab0bf5 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -342,6 +342,7 @@ struct ndr_interface_list {
Map an NT error code from a NDR error code.
*********************************************************************/
NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err);
+const char *ndr_map_error2string(enum ndr_err_code ndr_err);
/* FIXME: Use represent_as instead */
struct dom_sid;
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index 22b9fcc..2341f51 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -1122,3 +1122,38 @@ _PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const vo
NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &rel_offset));
return ndr_pull_set_offset(ndr, rel_offset);
}
+
+const static struct {
+ enum ndr_err_code err;
+ const char *string;
+} ndr_err_code_strings[] = {
+ { NDR_ERR_SUCCESS, "Success" },
+ { NDR_ERR_ARRAY_SIZE, "Bad Array Size" },
+ { NDR_ERR_BAD_SWITCH, "Bad Switch" },
+ { NDR_ERR_OFFSET, "Offset Error" },
+ { NDR_ERR_RELATIVE, "Relative Pointer Error" },
+ { NDR_ERR_CHARCNV, "Character Conversion Error" },
+ { NDR_ERR_LENGTH, "Length Error" },
+ { NDR_ERR_SUBCONTEXT, "Subcontext Error" },
+ { NDR_ERR_COMPRESSION, "Compression Error" },
+ { NDR_ERR_STRING, "String Error" },
+ { NDR_ERR_VALIDATE, "Validate Error" },
+ { NDR_ERR_BUFSIZE, "Buffer Size Error" },
+ { NDR_ERR_ALLOC, "Allocation Error" },
+ { NDR_ERR_RANGE, "Range Error" },
+ { NDR_ERR_TOKEN, "Token Error" },
+ { NDR_ERR_IPV4ADDRESS, "IPv4 Address Error" },
+ { NDR_ERR_INVALID_POINTER, "Invalid Pointer" },
+ { NDR_ERR_UNREAD_BYTES, "Unread Bytes" },
+ { 0, NULL }
+};
+
+_PUBLIC_ const char *ndr_map_error2string(enum ndr_err_code ndr_err)
+{
+ int i;
+ for (i = 0; ndr_err_code_strings[i].string != NULL; i++) {
+ if (ndr_err_code_strings[i].err == ndr_err)
+ return ndr_err_code_strings[i].string;
+ }
+ return "Unknown error";
+}
diff --git a/source4/librpc/rpc/pyrpc.h b/source4/librpc/rpc/pyrpc.h
index 6d5193f..ae622b5 100644
--- a/source4/librpc/rpc/pyrpc.h
+++ b/source4/librpc/rpc/pyrpc.h
@@ -48,7 +48,7 @@ typedef struct {
PyAPI_DATA(PyTypeObject) dcerpc_InterfaceType;
-#define PyErr_FromNdrError(err) PyErr_FromNTSTATUS(ndr_map_error2ntstatus(err))
+#define PyErr_FromNdrError(err) Py_BuildValue("(is)", err, ndr_map_error2string(err))
#define PyErr_SetNdrError(err) \
PyErr_SetObject(PyExc_RuntimeError, PyErr_FromNdrError(err))
--
Samba Shared Repository
More information about the samba-cvs
mailing list