Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
authorAndrew Tridgell <tridge@samba.org>
Thu, 4 Sep 2008 02:49:29 +0000 (12:49 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 4 Sep 2008 02:49:29 +0000 (12:49 +1000)
1  2 
source/scripting/python/misc.i
source/scripting/python/misc_wrap.c

index f0bc156abde4884af95686a63be5213c394f8251,19318cdb17b7a56a7bf705db4e1a6397a7297f76..81be7d5c16152799ee54d2ac485558fcbd3f32df
@@@ -26,6 -26,7 +26,7 @@@
  #include "dsdb/samdb/samdb.h"
  #include "lib/ldb-samba/ldif_handlers.h"
  #include "librpc/ndr/libndr.h"
+ #include "version.h"
  %}
  
  %import "stdint.i"
@@@ -77,10 -78,15 +78,15 @@@ bool samdb_set_domain_sid(struct ldb_co
  
  WERROR dsdb_attach_schema_from_ldif_file(struct ldb_context *ldb, const char *pf, const char *df);
  
- %feature("docstring") samba_version_string "version()\n"
-                                           "Obtain the Samba version.";
- %rename(version) samba_version_string;
- const char *samba_version_string(void);
+ %feature("docstring") version "version()\n"
+                               "Obtain the Samba version.";
+ %inline {
+ const char *version(void) 
+ { 
+     return SAMBA_VERSION_STRING; 
+ }
+ }
  int dsdb_set_global_schema(struct ldb_context *ldb);
  %feature("docstring") ldb_register_samba_handlers "register_samba_handlers()\n"
                                            "Register Samba-specific LDB modules and schemas.";
@@@ -100,16 -106,3 +106,16 @@@ bool dsdb_set_ntds_invocation_id(struc
  char *private_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
                 const char *name);
  
 +typedef unsigned long time_t;
 +
 +/*
 +  convert from unix time to NT time
 +*/
 +%inline %{
 +uint64_t unix2nttime(time_t t)
 +{
 +      NTTIME nt;
 +      unix_to_nt_time(&nt, t);
 +      return (uint64_t)nt;
 +}
 +%}
index 4b5bfb01740d33b26b7f35339e718e2a4c27c355,c7cdb86c354e40e69b8ab5f75f786492aced3800..3aee83f72c56af907ac1a28e8b7a8e64d32298e4
@@@ -2558,6 -2558,7 +2558,7 @@@ static swig_module_info swig_module = {
  #include "dsdb/samdb/samdb.h"
  #include "lib/ldb-samba/ldif_handlers.h"
  #include "librpc/ndr/libndr.h"
+ #include "version.h"
  
  
  #include "libcli/util/pyerrors.h"
@@@ -2813,6 -2814,12 +2814,12 @@@ SWIG_AsCharPtrAndSize(PyObject *obj, ch
  
  
  
+ const char *version(void) 
+ { 
+     return SAMBA_VERSION_STRING; 
+ }
    #define SWIG_From_long   PyInt_FromLong 
  
  
@@@ -2832,40 -2839,6 +2839,40 @@@ bool dsdb_set_ntds_invocation_id(struc
      return samdb_set_ntds_invocation_id(ldb, &invocation_id_in);
  }
  
 +
 +uint64_t unix2nttime(time_t t)
 +{
 +      NTTIME nt;
 +      unix_to_nt_time(&nt, t);
 +      return (uint64_t)nt;
 +}
 +
 +
 +#include <limits.h>
 +#if !defined(SWIG_NO_LLONG_MAX)
 +# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
 +#   define LLONG_MAX __LONG_LONG_MAX__
 +#   define LLONG_MIN (-LLONG_MAX - 1LL)
 +#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
 +# endif
 +#endif
 +
 +
 +SWIGINTERNINLINE PyObject* 
 +SWIG_From_long_SS_long  (long long value)
 +{
 +  return ((value < LONG_MIN) || (value > LONG_MAX)) ?
 +    PyLong_FromLongLong(value) : PyInt_FromLong((long)(value)); 
 +}
 +
 +
 +SWIGINTERNINLINE PyObject* 
 +SWIG_From_unsigned_SS_long_SS_long  (unsigned long long value)
 +{
 +  return (value > LONG_MAX) ?
 +    PyLong_FromUnsignedLongLong(value) : PyInt_FromLong((long)(value)); 
 +}
 +
  #ifdef __cplusplus
  extern "C" {
  #endif
@@@ -3109,7 -3082,7 +3116,7 @@@ SWIGINTERN PyObject *_wrap_version(PyOb
    char *result = 0 ;
    
    if (!SWIG_Python_UnpackTuple(args,"version",0,0,0)) SWIG_fail;
-   result = (char *)samba_version_string();
+   result = (char *)version();
    resultobj = SWIG_FromCharPtr((const char *)result);
    return resultobj;
  fail:
@@@ -3257,31 -3230,6 +3264,31 @@@ fail
  }
  
  
 +SWIGINTERN PyObject *_wrap_unix2nttime(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
 +  PyObject *resultobj = 0;
 +  time_t arg1 ;
 +  unsigned long val1 ;
 +  int ecode1 = 0 ;
 +  PyObject * obj0 = 0 ;
 +  char *  kwnames[] = {
 +    (char *) "t", NULL 
 +  };
 +  uint64_t result;
 +  
 +  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:unix2nttime",kwnames,&obj0)) SWIG_fail;
 +  ecode1 = SWIG_AsVal_unsigned_SS_long(obj0, &val1);
 +  if (!SWIG_IsOK(ecode1)) {
 +    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "unix2nttime" "', argument " "1"" of type '" "time_t""'");
 +  } 
 +  arg1 = (time_t)(val1);
 +  result = (uint64_t)unix2nttime(arg1);
 +  resultobj = SWIG_From_unsigned_SS_long_SS_long((unsigned long long)(result));
 +  return resultobj;
 +fail:
 +  return NULL;
 +}
 +
 +
  static PyMethodDef SwigMethods[] = {
         { (char *)"random_password", (PyCFunction) _wrap_random_password, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
                "S.random_password(len) -> string\n"
                ""},
         { (char *)"dsdb_set_ntds_invocation_id", (PyCFunction) _wrap_dsdb_set_ntds_invocation_id, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"private_path", (PyCFunction) _wrap_private_path, METH_VARARGS | METH_KEYWORDS, NULL},
 +       { (char *)"unix2nttime", (PyCFunction) _wrap_unix2nttime, METH_VARARGS | METH_KEYWORDS, NULL},
         { NULL, NULL, 0, NULL }
  };