Make domain sid argument to as_sddl() optional.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 20 Apr 2009 13:03:21 +0000 (15:03 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 20 Apr 2009 13:10:29 +0000 (15:10 +0200)
source4/librpc/ndr/py_security.c

index f89263bba340c11a080977e9b14a5d731cf492c4..43c1d50d666ac764db66cbf1b31123fb2f8841fd 100644 (file)
@@ -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 }
 };