[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Sun May 2 08:00:10 MDT 2010


The branch, master has been updated
       via  df6d0db... s4: Fix python binding for drsblobs
       via  f534080... s4 python: fix glues functions manipulating NTTIME
       via  8313362... pidl: Fix the generation of py helper for 64 bit integer
      from  668e28b... s3: Unify DEBUG_KRB5_TKT_REGAIN and DEBUG_KRB5_TKT_RENEWAL

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit df6d0db21d31dee1bc51c3a0703e1ad9ab5f028b
Author: Matthieu Patou <mat at matws.net>
Date:   Tue Apr 13 00:58:50 2010 +0400

    s4: Fix python binding for drsblobs
    
    This binding needs symbols in drsblobs_c.c otherwise we have unresolved symbols

commit f534080367ac886391efe1a5570a48400a1a66b0
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Apr 15 00:18:14 2010 +0400

    s4 python: fix glues functions manipulating NTTIME
    
    The fix include reverse function (from NTTIME to timestamp) + fix
    on the transformation of a NTTIME to a PyLong object

commit 831336293dfd9ab3771c2eb0f155b7423e71ec94
Author: Matthieu Patou <mat at matws.net>
Date:   Thu Apr 15 00:18:46 2010 +0400

    pidl: Fix the generation of py helper for 64 bit integer
    
    Up to now the generation of code for python helpers dealing with 64 bits (NTTIME,hyper, ...)
    was broken because they were assumed to be Int (PyInt_From ...) as Integer is always 32 bits
    in python.
    This fix use PyLong and states that the incomming data is a long long as it should be 64 bit at least.
    
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 pidl/lib/Parse/Pidl/Samba4/Python.pm |    6 ++++-
 source4/librpc/config.mk             |    2 +-
 source4/scripting/python/pyglue.c    |   36 +++++++++++++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 789a7dd..226db07 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -961,7 +961,11 @@ sub ConvertScalarToPython($$$)
 
 	$ctypename = expandAlias($ctypename);
 
-	if ($ctypename =~ /^(char|u?int[0-9]*|hyper|dlong|udlong|udlongr|time_t|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+	if ($ctypename =~ /^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+		return "PyLong_FromLongLong($cvar)";
+	}
+
+	if ($ctypename =~ /^(char|u?int[0-9]*|time_t)$/) {
 		return "PyInt_FromLong($cvar)";
 	}
 
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 282053a..aa065a0 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -726,7 +726,7 @@ python_drsuapi_OBJ_FILES = ../librpc/gen_ndr/py_drsuapi.o
 LIBRARY_REALNAME = samba/dcerpc/drsblobs.$(SHLIBEXT)
 PRIVATE_DEPENDENCIES = RPC_NDR_DRSBLOBS PYTALLOC pyparam_util pycredentials python_dcerpc
 
-python_drsblobs_OBJ_FILES  = ../librpc/gen_ndr/py_drsblobs.o
+python_drsblobs_OBJ_FILES = ../librpc/gen_ndr/py_drsblobs.o ../librpc/gen_ndr/ndr_drsblobs.o
 
 [PYTHON::python_dcerpc_security]
 LIBRARY_REALNAME = samba/dcerpc/security.$(SHLIBEXT)
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c
index f085714..b2a9d2c 100644
--- a/source4/scripting/python/pyglue.c
+++ b/source4/scripting/python/pyglue.c
@@ -105,7 +105,37 @@ static PyObject *py_unix2nttime(PyObject *self, PyObject *args)
 
 	unix_to_nt_time(&nt, t);
 
-	return PyInt_FromLong((uint64_t)nt);
+	return PyLong_FromLongLong((uint64_t)nt);
+}
+
+static PyObject *py_nttime2unix(PyObject *self, PyObject *args)
+{
+	time_t t;
+	NTTIME nt;
+	if (!PyArg_ParseTuple(args, "K", &nt))
+		return NULL;
+
+	t = nt_time_to_unix(nt);
+
+	return PyInt_FromLong((uint64_t)t);
+}
+
+static PyObject *py_nttime2string(PyObject *self, PyObject *args)
+{
+	PyObject *ret;
+	NTTIME nt, nt2;
+	TALLOC_CTX *tmp_ctx;
+	const char *string;
+
+	if (!PyArg_ParseTuple(args, "K", &nt))
+		return NULL;
+	tmp_ctx = talloc_new(NULL);
+
+	string = nt_time_string(tmp_ctx, nt);
+	ret =  PyString_FromString(string);
+
+	talloc_free(tmp_ctx);
+	return ret;
 }
 
 static PyObject *py_set_debug_level(PyObject *self, PyObject *args)
@@ -249,6 +279,10 @@ static PyMethodDef py_misc_methods[] = {
 		"Generate random password with a length >= min and <= max." },
 	{ "unix2nttime", (PyCFunction)py_unix2nttime, METH_VARARGS,
 		"unix2nttime(timestamp) -> nttime" },
+	{ "nttime2unix", (PyCFunction)py_nttime2unix, METH_VARARGS,
+		"nttime2unix(nttime) -> timestamp" },
+	{ "nttime2string", (PyCFunction)py_nttime2string, METH_VARARGS,
+		"nttime2string(nttime) -> string" },
 	{ "dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
 		NULL },
 	{ "dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list