summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-08-27 02:17:26 +0200
committerAndrew Tridgell <tridge@samba.org>2010-08-27 04:41:40 +0200
commit64552e11dd4435ebd85a0c291987457a99d7fe50 (patch)
treee8abc260ea3fcfd26934ecf2f0831e6aebb3a37f /source4/libnet
parent5115f789c007a155e34505852d847b99b7f4c886 (diff)
downloadsamba-64552e11dd4435ebd85a0c291987457a99d7fe50.tar.gz
samba-64552e11dd4435ebd85a0c291987457a99d7fe50.tar.bz2
samba-64552e11dd4435ebd85a0c291987457a99d7fe50.zip
pyrpc: Add py_check_dcerpc_type().
This function checks whether the type of a PyObject matches a DCE/RPC Python type. Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/py_net.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index 79abcd27ed..4f3e5db114 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -29,6 +29,7 @@
#include "lib/ldb/pyldb.h"
#include "auth/gensec/gensec.h"
#include "librpc/rpc/pyrpc.h"
+#include "librpc/rpc/pyrpc_util.h"
typedef struct {
PyObject_HEAD
@@ -407,12 +408,9 @@ static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyO
switch (level) {
case 1:
-#ifdef Py_TYPE
- if (strcmp("drsuapi.DsGetNCChangesCtr1", Py_TYPE(py_ctr)->tp_name) != 0) {
- PyErr_SetString(PyExc_TypeError, "Expected DsGetNCChangesCtr1 type for ctr");
+ if (!py_check_dcerpc_type(py_ctr, "samba.dcerpc.drsuapi", "DsGetNCChangesCtr1")) {
return NULL;
}
-#endif
s->chunk.ctr1 = py_talloc_get_ptr(py_ctr);
s->partition.nc = *s->chunk.ctr1->naming_context;
s->partition.more_data = s->chunk.ctr1->more_data;
@@ -421,12 +419,9 @@ static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyO
s->partition.highwatermark = s->chunk.ctr1->new_highwatermark;
break;
case 6:
-#ifdef Py_TYPE
- if (strcmp("drsuapi.DsGetNCChangesCtr6", Py_TYPE(py_ctr)->tp_name) != 0) {
- PyErr_SetString(PyExc_TypeError, "Expected DsGetNCChangesCtr6 type for ctr");
+ if (!py_check_dcerpc_type(py_ctr, "samba.dcerpc.drsuapi", "DsGetNCChangesCtr6")) {
return NULL;
}
-#endif
s->chunk.ctr6 = py_talloc_get_ptr(py_ctr);
s->partition.nc = *s->chunk.ctr6->naming_context;
s->partition.more_data = s->chunk.ctr6->more_data;