diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-08-12 17:10:17 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-08-13 12:31:09 +1000 |
commit | 1c1f7df956de9658a0bc4594af3202badbdaeeeb (patch) | |
tree | 7eeb74d0316573a12ed68f8fd929f48b099fc488 | |
parent | e580f33b131471b9fa70764d3fc395db592accd2 (diff) | |
download | samba-1c1f7df956de9658a0bc4594af3202badbdaeeeb.tar.gz samba-1c1f7df956de9658a0bc4594af3202badbdaeeeb.tar.bz2 samba-1c1f7df956de9658a0bc4594af3202badbdaeeeb.zip |
s3-passdb: Added python method to get_global_sam_sid
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source3/passdb/py_passdb.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index 3fac27c8b9..17d4415f8a 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -1534,6 +1534,34 @@ static PyObject *py_set_secrets_dir(PyObject *self, PyObject *args) Py_RETURN_NONE; } +static PyObject *py_get_global_sam_sid(PyObject *self) +{ + struct dom_sid *domain_sid, *domain_sid_copy; + TALLOC_CTX *tframe; + PyObject *py_dom_sid; + + tframe = talloc_stackframe(); + if (tframe == NULL) { + PyErr_NoMemory(); + return NULL; + } + + domain_sid = get_global_sam_sid(); + + domain_sid_copy = dom_sid_dup(tframe, domain_sid); + if (domain_sid_copy == NULL) { + PyErr_NoMemory(); + talloc_free(tframe); + return NULL; + } + + py_dom_sid = pytalloc_steal(dom_sid_Type, domain_sid_copy); + + talloc_free(tframe); + + return py_dom_sid; +} + static PyMethodDef py_passdb_methods[] = { { "get_backends", (PyCFunction)py_passdb_backends, METH_NOARGS, @@ -1545,6 +1573,9 @@ static PyMethodDef py_passdb_methods[] = { { "set_secrets_dir", (PyCFunction)py_set_secrets_dir, METH_VARARGS, "set_secrets_dir(private_dir) -> None\n\n \ Set path to private directory to load secrets database from non-default location." }, + { "get_global_sam_sid", (PyCFunction)py_get_global_sam_sid, METH_NOARGS, + "get_global_sam_sid() -> dom_sid\n\n \ + Return domain SID." }, { NULL }, }; |