summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-04-20 15:03:21 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-04-20 15:10:29 +0200
commit294359b7bcb84b2284c5a76e1a453c3483dd3bb2 (patch)
treee54dfe277013eccc63afaa88629e9e859ad901b3
parentb5b6ecb58aeba196c28370cde21a0826f81d8da6 (diff)
downloadsamba-294359b7bcb84b2284c5a76e1a453c3483dd3bb2.tar.gz
samba-294359b7bcb84b2284c5a76e1a453c3483dd3bb2.tar.bz2
samba-294359b7bcb84b2284c5a76e1a453c3483dd3bb2.zip
Make domain sid argument to as_sddl() optional.
-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 }
};