[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Thu Nov 5 03:56:35 MST 2009
The branch, master has been updated
via 49397a8... s4:samdb python bindings - add a wrapper for "dsdb_make_schema_global"
via 992d35d... s4:samdb python bindings - make the python wrap connect more like the C one
via b2e91d4... s4:samdb python bindings - Reorder some function bodies to match the order in "ldb_wrap_connect"
from a10b522... s4:kdc: remove unused struct kpasswd_socket
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 49397a8b3e30b23a4723125986f306fff502a144
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Tue Oct 27 23:24:46 2009 +0100
s4:samdb python bindings - add a wrapper for "dsdb_make_schema_global"
commit 992d35d38a95280dfa18f0ad5f518d2b8342c7dc
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Tue Oct 27 19:52:21 2009 +0100
s4:samdb python bindings - make the python wrap connect more like the C one
Add call for setting the create permissions.
commit b2e91d41194abcc7abc803fc3dc66eb635fcbd25
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Tue Oct 27 19:50:33 2009 +0100
s4:samdb python bindings - Reorder some function bodies to match the order in "ldb_wrap_connect"
-----------------------------------------------------------------------
Summary of changes:
source4/scripting/python/pyglue.c | 66 +++++++++++++++++----------
source4/scripting/python/samba/__init__.py | 13 ++++-
2 files changed, 51 insertions(+), 28 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c
index 2f7023e..b138e3e 100644
--- a/source4/scripting/python/pyglue.c
+++ b/source4/scripting/python/pyglue.c
@@ -102,6 +102,27 @@ static PyObject *py_set_debug_level(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
+static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args)
+{
+ PyObject *py_session_info, *py_ldb;
+ struct auth_session_info *info;
+ struct ldb_context *ldb;
+ if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_session_info))
+ return NULL;
+
+ PyErr_LDB_OR_RAISE(py_ldb, ldb);
+ /*if (!PyAuthSession_Check(py_session_info)) {
+ PyErr_SetString(PyExc_TypeError, "Expected session info object");
+ return NULL;
+ }*/
+
+ info = PyAuthSession_AsSession(py_session_info);
+
+ ldb_set_opaque(ldb, "sessionInfo", info);
+
+ Py_RETURN_NONE;
+}
+
static PyObject *py_ldb_set_credentials(PyObject *self, PyObject *args)
{
PyObject *py_creds, *py_ldb;
@@ -144,28 +165,6 @@ static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-
-static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args)
-{
- PyObject *py_session_info, *py_ldb;
- struct auth_session_info *info;
- struct ldb_context *ldb;
- if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_session_info))
- return NULL;
-
- PyErr_LDB_OR_RAISE(py_ldb, ldb);
- /*if (!PyAuthSession_Check(py_session_info)) {
- PyErr_SetString(PyExc_TypeError, "Expected session info object");
- return NULL;
- }*/
-
- info = PyAuthSession_AsSession(py_session_info);
-
- ldb_set_opaque(ldb, "sessionInfo", info);
-
- Py_RETURN_NONE;
-}
-
static PyObject *py_ldb_set_utf8_casefold(PyObject *self, PyObject *args)
{
PyObject *py_ldb;
@@ -428,6 +427,21 @@ static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
+static PyObject *py_dsdb_make_schema_global(PyObject *self, PyObject *args)
+{
+ PyObject *py_ldb;
+ struct ldb_context *ldb;
+
+ if (!PyArg_ParseTuple(args, "O", &py_ldb))
+ return NULL;
+
+ PyErr_LDB_OR_RAISE(py_ldb, ldb);
+
+ dsdb_make_schema_global(ldb);
+
+ Py_RETURN_NONE;
+}
+
static PyObject *py_dom_sid_to_rid(PyLdbObject *self, PyObject *args)
{
PyObject *py_sid;
@@ -455,12 +469,12 @@ static PyMethodDef py_misc_methods[] = {
"Generate random password with specified length." },
{ "unix2nttime", (PyCFunction)py_unix2nttime, METH_VARARGS,
"unix2nttime(timestamp) -> nttime" },
- { "ldb_set_credentials", (PyCFunction)py_ldb_set_credentials, METH_VARARGS,
- "ldb_set_credentials(ldb, credentials) -> None\n"
- "Set credentials to use when connecting." },
{ "ldb_set_session_info", (PyCFunction)py_ldb_set_session_info, METH_VARARGS,
"ldb_set_session_info(ldb, session_info)\n"
"Set session info to use when connecting." },
+ { "ldb_set_credentials", (PyCFunction)py_ldb_set_credentials, METH_VARARGS,
+ "ldb_set_credentials(ldb, credentials)\n"
+ "Set credentials to use when connecting." },
{ "ldb_set_loadparm", (PyCFunction)py_ldb_set_loadparm, METH_VARARGS,
"ldb_set_loadparm(ldb, session_info)\n"
"Set loadparm context to use when connecting." },
@@ -490,6 +504,8 @@ static PyMethodDef py_misc_methods[] = {
NULL },
{ "dsdb_convert_schema_to_openldap", (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,
NULL },
+ { "dsdb_make_schema_global", (PyCFunction)py_dsdb_make_schema_global, METH_VARARGS,
+ NULL },
{ "dom_sid_to_rid", (PyCFunction)py_dom_sid_to_rid, METH_VARARGS,
NULL },
{ "set_debug_level", (PyCFunction)py_set_debug_level, METH_VARARGS,
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index 5278862..06e276c 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -103,18 +103,25 @@ class Ldb(ldb.Ldb):
if nosync_p is not None and nosync_p == true:
flags |= FLG_NOSYNC
+ self.set_create_perms()
+
if url is not None:
self.connect(url, flags, options)
- def set_credentials(self, credentials):
- glue.ldb_set_credentials(self, credentials)
-
def set_session_info(self, session_info):
glue.ldb_set_session_info(self, session_info)
+ def set_credentials(self, credentials):
+ glue.ldb_set_credentials(self, credentials)
+
def set_loadparm(self, lp_ctx):
glue.ldb_set_loadparm(self, lp_ctx)
+ def set_create_perms(self, perms=0600):
+ # we usually want Samba databases to be private. If we later find we
+ # need one public, we will have to change this here
+ super(Ldb, self).set_create_perms(perms)
+
def searchone(self, attribute, basedn=None, expression=None,
scope=ldb.SCOPE_BASE):
"""Search for one attribute as a string.
--
Samba Shared Repository
More information about the samba-cvs
mailing list