diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-08-11 12:25:13 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-08-11 12:59:17 +0200 |
commit | 159a33a7d4cb69b5487acb183cbf56a584048734 (patch) | |
tree | 4b43466276c6bd2b77b654f5f8a8a625016f7efc /source4/scripting/python | |
parent | 9126b75aaed91d79c5b5388613a9cdbb6d898894 (diff) | |
download | samba-159a33a7d4cb69b5487acb183cbf56a584048734.tar.gz samba-159a33a7d4cb69b5487acb183cbf56a584048734.tar.bz2 samba-159a33a7d4cb69b5487acb183cbf56a584048734.zip |
s4:test for "primaryGroupToken"
Tests for the right behaviour of this introduced constructed attribute.
Since we don't support the read-only-ness of those attributes yet, I commented
some lines out.
Also I had to add a function for python which converts domain SIDs in RIDs.
And a small fix for the "groupType" test.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/pyglue.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index 0869d2feac..95255dc1f6 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -327,6 +327,27 @@ static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self, PyObject *ar return ret; } +static PyObject *py_dom_sid_to_rid(PyLdbObject *self, PyObject *args) +{ + PyObject *py_sid; + struct dom_sid *sid; + uint32_t rid; + NTSTATUS status; + + if(!PyArg_ParseTuple(args, "O", &py_sid)) + return NULL; + + sid = dom_sid_parse_talloc(NULL, PyString_AsString(py_sid)); + + status = dom_sid_split_rid(NULL, sid, NULL, &rid); + if (!NT_STATUS_IS_OK(status)) { + PyErr_SetString(PyExc_RuntimeError, "dom_sid_split_rid failed"); + return NULL; + } + + return PyInt_FromLong(rid); +} + static PyMethodDef py_misc_methods[] = { { "generate_random_str", (PyCFunction)py_generate_random_str, METH_VARARGS, "random_password(len) -> string\n" @@ -358,6 +379,8 @@ static PyMethodDef py_misc_methods[] = { NULL }, { "dsdb_convert_schema_to_openldap", (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS, NULL }, + { "dom_sid_to_rid", (PyCFunction)py_dom_sid_to_rid, METH_VARARGS, + NULL }, { NULL } }; |