From fa8c1abcc833953d69f732d3577d6492148121a7 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 19 Sep 2004 22:22:51 +0000 Subject: r2421: Fix test for lookupdomain for a non-existent domain. Export NTSTATUS exception from wrapper module so it can be used by scripts. (This used to be commit 57edfd605bffcf8a0feb5ccc5ec69cf5f35b677b) --- source4/scripting/swig/dcerpc.i | 9 ++++++++- source4/scripting/swig/torture/samr.py | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'source4/scripting') diff --git a/source4/scripting/swig/dcerpc.i b/source4/scripting/swig/dcerpc.i index a90ac90b5a..bded875b10 100644 --- a/source4/scripting/swig/dcerpc.i +++ b/source4/scripting/swig/dcerpc.i @@ -1,3 +1,5 @@ +/* Tastes like -*- C -*- */ + /* Unix SMB/CIFS implementation. @@ -227,11 +229,16 @@ PyObject *string_ptr_to_python(TALLOC_CTX *mem_ctx, char *obj) %include "samba.i" +%pythoncode %{ + NTSTATUS = _dcerpc.NTSTATUS +%} + %init %{ setup_logging("python", DEBUG_STDOUT); lp_load(dyn_CONFIGFILE, True, False, False); load_interfaces(); - ntstatus_exception = PyErr_NewException("dcerpc.NTSTATUS", NULL, NULL); + ntstatus_exception = PyErr_NewException("_dcerpc.NTSTATUS", NULL, NULL); + PyDict_SetItemString(d, "NTSTATUS", ntstatus_exception); %} %typemap(in, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) { diff --git a/source4/scripting/swig/torture/samr.py b/source4/scripting/swig/torture/samr.py index 00e4db1958..1f3b60eed4 100755 --- a/source4/scripting/swig/torture/samr.py +++ b/source4/scripting/swig/torture/samr.py @@ -90,7 +90,13 @@ def test_LookupDomain(pipe, handle, domain): result = dcerpc.samr_LookupDomain(pipe, r) - print result + r['domain']['name'] = 'xxNODOMAINxx' + + try: + result = dcerpc.samr_LookupDomain(pipe, r) + except dcerpc.NTSTATUS, arg: + if arg[0] != 0xc00000df: + raise dcerpc.NTSTATUS(arg) def test_EnumDomains(pipe, handle): -- cgit