diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-01-22 14:49:51 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-01-22 14:49:51 +0100 |
commit | a4afed1e9a28498885382daf96ab7b8997821dca (patch) | |
tree | 072b663d6975e697d7b5c7a1e80883db00bbb90b /source4/librpc | |
parent | fc50f7ecbab4bf273697f2114a723eae917251bb (diff) | |
download | samba-a4afed1e9a28498885382daf96ab7b8997821dca.tar.gz samba-a4afed1e9a28498885382daf96ab7b8997821dca.tar.bz2 samba-a4afed1e9a28498885382daf96ab7b8997821dca.zip |
Implement as_sddl.
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/ndr/py_security.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c index e1b50def1d..93e4a093f3 100644 --- a/source4/librpc/ndr/py_security.c +++ b/source4/librpc/ndr/py_security.c @@ -33,7 +33,7 @@ static void PyType_AddMethods(PyTypeObject *type, PyMethodDef *methods) for (i = 0; methods[i].ml_name; i++) { PyObject *descr; if (methods[i].ml_flags & METH_CLASS) - descr = PyCFunction_New(&methods[i], type); + descr = PyCFunction_New(&methods[i], (PyObject *)type); else descr = PyDescr_NewMethod(type, &methods[i]); PyDict_SetItemString(dict, methods[i].ml_name, @@ -187,6 +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) +{ + struct dom_sid *sid = py_talloc_get_ptr(py_sid); + struct security_descriptor *desc = py_talloc_get_ptr(self); + char *text; + PyObject *ret; + + text = sddl_encode(NULL, desc, sid); + + ret = PyString_FromString(text); + + talloc_free(text); + + return ret; +} + static PyMethodDef py_descriptor_extra_methods[] = { { "sacl_add", (PyCFunction)py_descriptor_sacl_add, METH_VARARGS, "S.sacl_add(ace) -> None\n" @@ -199,6 +215,8 @@ 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, + NULL }, { NULL } }; |