summaryrefslogtreecommitdiff
path: root/source4/auth/pyauth.c
diff options
context:
space:
mode:
authorNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-09-03 14:39:40 +0300
committerAndrew Bartlett <abartlet@samba.org>2009-09-09 18:57:50 +1000
commit269fe99a62371fb9540d886f7cc619450c5b5c8d (patch)
treecca34fdf18826ed84e13088f1448fde1ec3f1307 /source4/auth/pyauth.c
parent8640293fabb0fd0fe92b814411577dcdb449100d (diff)
downloadsamba-269fe99a62371fb9540d886f7cc619450c5b5c8d.tar.gz
samba-269fe99a62371fb9540d886f7cc619450c5b5c8d.tar.bz2
samba-269fe99a62371fb9540d886f7cc619450c5b5c8d.zip
Added "admin_session" method.
The purpose of admin_session is to be able to execute parts of provisioning as the user Administrator in order to have the correct group and owner in the security descriptors. To be used for provisioning and tests only.
Diffstat (limited to 'source4/auth/pyauth.c')
-rw-r--r--source4/auth/pyauth.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c
index 04880b71c9..5bb775aa95 100644
--- a/source4/auth/pyauth.c
+++ b/source4/auth/pyauth.c
@@ -21,6 +21,8 @@
#include "pyauth.h"
#include "auth/system_session_proto.h"
#include "param/pyparam.h"
+#include "libcli/security/security.h"
+
PyTypeObject PyAuthSession = {
.tp_name = "AuthSession",
@@ -70,9 +72,30 @@ static PyObject *py_system_session_anon(PyObject *module, PyObject *args)
return PyAuthSession_FromSession(session);
}
+static PyObject *py_admin_session(PyObject *module, PyObject *args)
+{
+ PyObject *py_lp_ctx;
+ PyObject *py_sid;
+ struct loadparm_context *lp_ctx = NULL;
+ struct auth_session_info *session;
+ struct dom_sid *domain_sid = NULL;
+ if (!PyArg_ParseTuple(args, "OO", &py_lp_ctx, &py_sid))
+ return NULL;
+
+ lp_ctx = lp_from_py_object(py_lp_ctx);
+ if (lp_ctx == NULL)
+ return NULL;
+
+ domain_sid = dom_sid_parse_talloc(NULL, PyString_AsString(py_sid));
+ session = admin_session(NULL, lp_ctx, domain_sid);
+
+ return PyAuthSession_FromSession(session);
+}
+
static PyMethodDef py_auth_methods[] = {
{ "system_session", (PyCFunction)py_system_session, METH_VARARGS, NULL },
{ "system_session_anonymous", (PyCFunction)py_system_session_anon, METH_VARARGS, NULL },
+ { "admin_session", (PyCFunction)py_admin_session, METH_VARARGS, NULL },
{ NULL },
};