summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-25 00:04:11 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-25 00:04:11 +0200
commit4c1f0641d395e095d46cd0eb9a09055dd07f850b (patch)
treed09276dd7eecb69c7ce09ce36396a9dd1c7aa12a /source4/librpc/rpc
parent63c2a19e6e9d0e5e9b662fafe9fd531c2c073174 (diff)
downloadsamba-4c1f0641d395e095d46cd0eb9a09055dd07f850b.tar.gz
samba-4c1f0641d395e095d46cd0eb9a09055dd07f850b.tar.bz2
samba-4c1f0641d395e095d46cd0eb9a09055dd07f850b.zip
Check for fault codes when connecting.
(This used to be commit 42537b1d5282784550120358f3641f299351fba7)
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/pyrpc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source4/librpc/rpc/pyrpc.c b/source4/librpc/rpc/pyrpc.c
index 70875168c5..1fc6e4e3c7 100644
--- a/source4/librpc/rpc/pyrpc.c
+++ b/source4/librpc/rpc/pyrpc.c
@@ -54,7 +54,7 @@ static PyGetSetDef dcerpc_interface_getsetters[] = {
void PyErr_SetDCERPCStatus(struct dcerpc_pipe *p, NTSTATUS status)
{
- if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
+ if (p != NULL && NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
const char *errstr = dcerpc_errstr(NULL, p->last_fault_code);
PyErr_SetObject(PyExc_RuntimeError,
Py_BuildValue("(i,s)", p->last_fault_code,
@@ -206,10 +206,12 @@ static PyObject *dcerpc_interface_new(PyTypeObject *self, PyObject *args, PyObje
return NULL;
}
+ ret->pipe = NULL;
+
status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string,
table, credentials, event_ctx, lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
- PyErr_SetString(PyExc_RuntimeError, nt_errstr(status));
+ PyErr_SetDCERPCStatus(ret->pipe, status);
talloc_free(mem_ctx);
return NULL;
}