summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-14 12:26:09 +0000
committerTim Potter <tpot@samba.org>2002-04-14 12:26:09 +0000
commit8d680f879605b8e40fe2b4a16db5d860226e17a5 (patch)
tree70209cfb595f2e261c0beeeedf3cb9b20fbf4d76 /source3
parent26152050bb9f327d67360fa2997344787d9073c7 (diff)
downloadsamba-8d680f879605b8e40fe2b4a16db5d860226e17a5.tar.gz
samba-8d680f879605b8e40fe2b4a16db5d860226e17a5.tar.bz2
samba-8d680f879605b8e40fe2b4a16db5d860226e17a5.zip
Added enumerate trusted domains.
(This used to be commit 3a11ce31ca3eed23f3bf82c46b2ebd2423be737d)
Diffstat (limited to 'source3')
-rw-r--r--source3/python/py_lsa.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c
index 1c84af5ea0..fecbf535aa 100644
--- a/source3/python/py_lsa.c
+++ b/source3/python/py_lsa.c
@@ -210,7 +210,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
result = PyList_New(num_sids);
for (i = 0; i < num_sids; i++) {
- PyObject *name_obj, *obj;
+ PyObject *obj;
obj = Py_BuildValue("{sssssi}", "username", names[i],
"domain", domains[i], "name_type",
@@ -222,18 +222,61 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
return result;
}
+static PyObject *lsa_enum_trust_dom(PyObject *self, PyObject *args)
+{
+ lsa_policy_hnd_object *hnd = (lsa_policy_hnd_object *)self;
+ NTSTATUS ntstatus;
+ uint32 enum_ctx = 0, num_domains, i;
+ char **domain_names;
+ DOM_SID *domain_sids;
+ PyObject *result;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ ntstatus = cli_lsa_enum_trust_dom(hnd->cli, hnd->mem_ctx,
+ &hnd->pol, &enum_ctx,
+ &num_domains, &domain_names,
+ &domain_sids);
+
+ if (!NT_STATUS_IS_OK(ntstatus)) {
+ PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus));
+ return NULL;
+ }
+
+ result = PyList_New(num_domains);
+
+ for (i = 0; i < num_domains; i++) {
+ fstring sid_str;
+
+ sid_to_string(sid_str, &domain_sids[i]);
+ PyList_SetItem(
+ result, i,
+ Py_BuildValue("(ss)", domain_names[i], sid_str));
+ }
+
+ return result;
+}
+
/*
* Method dispatch tables
*/
static PyMethodDef lsa_hnd_methods[] = {
+ /* SIDs<->names */
+
{ "lookup_sids", lsa_lookup_sids, METH_VARARGS | METH_KEYWORDS,
"Convert sids to names." },
{ "lookup_names", lsa_lookup_names, METH_VARARGS | METH_KEYWORDS,
"Convert names to sids." },
+ /* Trusted domains */
+
+ { "enum_trusted_domains", lsa_enum_trust_dom, METH_VARARGS,
+ "Enumerate trusted domains." },
+
{ NULL }
};