diff options
Diffstat (limited to 'source4/scripting/swig')
-rw-r--r-- | source4/scripting/swig/samba.i | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/scripting/swig/samba.i b/source4/scripting/swig/samba.i index db48b3c4ba..c7b8b46e66 100644 --- a/source4/scripting/swig/samba.i +++ b/source4/scripting/swig/samba.i @@ -46,6 +46,17 @@ $result = PyLong_FromUnsignedLong($1); } +%typemap(in) NTSTATUS { + if (PyLong_Check($input)) + $1 = NT_STATUS(PyLong_AsUnsignedLong($input)); + else if (PyInt_Check($input)) + $1 = NT_STATUS(PyInt_AsLong($input)); + else { + PyErr_SetString(PyExc_TypeError, "Expected a long or an int"); + return NULL; + } +} + %typemap(out) NTSTATUS { $result = PyLong_FromUnsignedLong(NT_STATUS_V($1)); } |