summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/py_security.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c
index f89263bba3..43c1d50d66 100644
--- a/source4/librpc/ndr/py_security.c
+++ b/source4/librpc/ndr/py_security.c
@@ -187,13 +187,22 @@ static PyObject *py_descriptor_from_sddl(PyObject *self, PyObject *args)
return py_talloc_import((PyTypeObject *)self, secdesc);
}
-static PyObject *py_descriptor_as_sddl(PyObject *self, PyObject *py_sid)
+static PyObject *py_descriptor_as_sddl(PyObject *self, PyObject *args)
{
- struct dom_sid *sid = py_talloc_get_ptr(py_sid);
+ struct dom_sid *sid;
+ PyObject *py_sid = Py_None;
struct security_descriptor *desc = py_talloc_get_ptr(self);
char *text;
PyObject *ret;
+ if (!PyArg_ParseTuple(args, "|O", &py_sid))
+ return NULL;
+
+ if (py_sid == Py_None)
+ sid = py_talloc_get_ptr(py_sid);
+ else
+ sid = NULL;
+
text = sddl_encode(NULL, desc, sid);
ret = PyString_FromString(text);
@@ -215,7 +224,7 @@ static PyMethodDef py_descriptor_extra_methods[] = {
NULL },
{ "from_sddl", (PyCFunction)py_descriptor_from_sddl, METH_VARARGS|METH_CLASS,
NULL },
- { "as_sddl", (PyCFunction)py_descriptor_as_sddl, METH_O,
+ { "as_sddl", (PyCFunction)py_descriptor_as_sddl, METH_VARARGS,
NULL },
{ NULL }
};