[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-513-gbd293cd

Jelmer Vernooij jelmer at samba.org
Tue Jan 22 15:22:19 GMT 2008


The branch, v4-0-test has been updated
       via  bd293cde1b1deadcfb0f74c82aae6ba4de39925b (commit)
      from  d2ac8be28d3aff59eddbdc6189a255a34c10d502 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit bd293cde1b1deadcfb0f74c82aae6ba4de39925b
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Jan 22 16:21:54 2008 +0100

    python: Avoid duplicate copies of some objects in different packages.

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

Summary of changes:
 source/libnet/net_wrap.c        |    2 +-
 source/librpc/rpc/dcerpc.i      |    5 +-
 source/librpc/rpc/dcerpc.py     |   28 +--
 source/librpc/rpc/dcerpc_wrap.c |  953 +--------------------------------------
 4 files changed, 20 insertions(+), 968 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/libnet/net_wrap.c b/source/libnet/net_wrap.c
index b1d2a8f..a4e27c1 100644
--- a/source/libnet/net_wrap.c
+++ b/source/libnet/net_wrap.c
@@ -3996,7 +3996,7 @@ static PyMethodDef SwigMethods[] = {
 static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event_context *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_libnet_AddShare = {"_p_libnet_AddShare", "struct libnet_AddShare *", 0, 0, (void*)0, 0};
diff --git a/source/librpc/rpc/dcerpc.i b/source/librpc/rpc/dcerpc.i
index 4128092..f958d82 100644
--- a/source/librpc/rpc/dcerpc.i
+++ b/source/librpc/rpc/dcerpc.i
@@ -36,13 +36,14 @@
 #include "includes.h"
 #include "dynconfig.h"
 #include "librpc/rpc/dcerpc.h"
+#include "param/param.h"
 
 #undef strcpy
 
 %}
 
-%include "../../lib/talloc/talloc.i"
-%include "../../auth/credentials/credentials.i"
+%import "../../lib/talloc/talloc.i"
+%import "../../auth/credentials/credentials.i"
 
 %typemap(in,noblock=1, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
         $1 = &temp_dcerpc_pipe;
diff --git a/source/librpc/rpc/dcerpc.py b/source/librpc/rpc/dcerpc.py
index 71661ef..7e4d82d 100644
--- a/source/librpc/rpc/dcerpc.py
+++ b/source/librpc/rpc/dcerpc.py
@@ -57,34 +57,8 @@ def _swig_setattr_nondynamic_method(set):
     return set_attr
 
 
+import credentials
 import param
-class Credentials(object):
-    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    __repr__ = _swig_repr
-    def __init__(self, *args, **kwargs): 
-        _dcerpc.Credentials_swiginit(self,_dcerpc.new_Credentials(*args, **kwargs))
-    __swig_destroy__ = _dcerpc.delete_Credentials
-Credentials.get_username = new_instancemethod(_dcerpc.Credentials_get_username,None,Credentials)
-Credentials.set_username = new_instancemethod(_dcerpc.Credentials_set_username,None,Credentials)
-Credentials.get_password = new_instancemethod(_dcerpc.Credentials_get_password,None,Credentials)
-Credentials.set_password = new_instancemethod(_dcerpc.Credentials_set_password,None,Credentials)
-Credentials.get_domain = new_instancemethod(_dcerpc.Credentials_get_domain,None,Credentials)
-Credentials.set_domain = new_instancemethod(_dcerpc.Credentials_set_domain,None,Credentials)
-Credentials.get_realm = new_instancemethod(_dcerpc.Credentials_get_realm,None,Credentials)
-Credentials.set_realm = new_instancemethod(_dcerpc.Credentials_set_realm,None,Credentials)
-Credentials.parse_string = new_instancemethod(_dcerpc.Credentials_parse_string,None,Credentials)
-Credentials.get_bind_dn = new_instancemethod(_dcerpc.Credentials_get_bind_dn,None,Credentials)
-Credentials.set_bind_dn = new_instancemethod(_dcerpc.Credentials_set_bind_dn,None,Credentials)
-Credentials.get_workstation = new_instancemethod(_dcerpc.Credentials_get_workstation,None,Credentials)
-Credentials.set_workstation = new_instancemethod(_dcerpc.Credentials_set_workstation,None,Credentials)
-Credentials.guess = new_instancemethod(_dcerpc.Credentials_guess,None,Credentials)
-Credentials.is_anonymous = new_instancemethod(_dcerpc.Credentials_is_anonymous,None,Credentials)
-Credentials.get_nt_hash = new_instancemethod(_dcerpc.Credentials_get_nt_hash,None,Credentials)
-Credentials.authentication_requested = new_instancemethod(_dcerpc.Credentials_authentication_requested,None,Credentials)
-Credentials.wrong_password = new_instancemethod(_dcerpc.Credentials_wrong_password,None,Credentials)
-Credentials_swigregister = _dcerpc.Credentials_swigregister
-Credentials_swigregister(Credentials)
-
 pipe_connect = _dcerpc.pipe_connect
 dcerpc_server_name = _dcerpc.dcerpc_server_name
 
diff --git a/source/librpc/rpc/dcerpc_wrap.c b/source/librpc/rpc/dcerpc_wrap.c
index 5be702b..bae41c2 100644
--- a/source/librpc/rpc/dcerpc_wrap.c
+++ b/source/librpc/rpc/dcerpc_wrap.c
@@ -2529,27 +2529,11 @@ static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0};
 #include "includes.h"
 #include "dynconfig.h"
 #include "librpc/rpc/dcerpc.h"
-
-#undef strcpy
-
-
-
-
-/* Include headers */
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "includes.h"
-#include "auth/credentials/credentials.h"
 #include "param/param.h"
-typedef struct cli_credentials cli_credentials;
 
+#undef strcpy
 
-#include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
 
-SWIGINTERN cli_credentials *new_cli_credentials(){
-            return cli_credentials_init(NULL);
-        }
 
 SWIGINTERN swig_type_info*
 SWIG_pchar_descriptor(void)
@@ -2564,30 +2548,6 @@ SWIG_pchar_descriptor(void)
 }
 
 
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
-{
-  if (carray) {
-    if (size > INT_MAX) {
-      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-      return pchar_descriptor ? 
-	SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
-    } else {
-      return PyString_FromStringAndSize(carray, (int)(size));
-    }
-  } else {
-    return SWIG_Py_Void();
-  }
-}
-
-
-SWIGINTERNINLINE PyObject * 
-SWIG_FromCharPtr(const char *cptr)
-{ 
-  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
-}
-
-
 SWIGINTERN int
 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 {
@@ -2643,893 +2603,32 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 
 
 
-#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
-
-
-SWIGINTERN int
-SWIG_AsVal_double (PyObject *obj, double *val)
-{
-  int res = SWIG_TypeError;
-  if (PyFloat_Check(obj)) {
-    if (val) *val = PyFloat_AsDouble(obj);
-    return SWIG_OK;
-  } else if (PyInt_Check(obj)) {
-    if (val) *val = PyInt_AsLong(obj);
-    return SWIG_OK;
-  } else if (PyLong_Check(obj)) {
-    double v = PyLong_AsDouble(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-    }
-  }
-#ifdef SWIG_PYTHON_CAST_MODE
-  {
-    int dispatch = 0;
-    double d = PyFloat_AsDouble(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = d;
-      return SWIG_AddCast(SWIG_OK);
-    } else {
-      PyErr_Clear();
-    }
-    if (!dispatch) {
-      long v = PyLong_AsLong(obj);
-      if (!PyErr_Occurred()) {
-	if (val) *val = v;
-	return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
-      } else {
-	PyErr_Clear();
-      }
-    }
-  }
-#endif
-  return res;
-}
-
-
-#include <float.h>
-
-
-#include <math.h>
-
-
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
-  double x = *d;
-  if ((min <= x && x <= max)) {
-   double fx = floor(x);
-   double cx = ceil(x);
-   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
-   if ((errno == EDOM) || (errno == ERANGE)) {
-     errno = 0;
-   } else {
-     double summ, reps, diff;
-     if (rd < x) {
-       diff = x - rd;
-     } else if (rd > x) {
-       diff = rd - x;
-     } else {
-       return 1;
-     }
-     summ = rd + x;
-     reps = diff/summ;
-     if (reps < 8*DBL_EPSILON) {
-       *d = rd;
-       return 1;
-     }
-   }
-  }
-  return 0;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_long (PyObject *obj, long* val)
+SWIGINTERNINLINE PyObject *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 {
-  if (PyInt_Check(obj)) {
-    if (val) *val = PyInt_AsLong(obj);
-    return SWIG_OK;
-  } else if (PyLong_Check(obj)) {
-    long v = PyLong_AsLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_OK;
-    } else {
-      PyErr_Clear();
-    }
-  }
-#ifdef SWIG_PYTHON_CAST_MODE
-  {
-    int dispatch = 0;
-    long v = PyInt_AsLong(obj);
-    if (!PyErr_Occurred()) {
-      if (val) *val = v;
-      return SWIG_AddCast(SWIG_OK);
+  if (carray) {
+    if (size > INT_MAX) {
+      swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+      return pchar_descriptor ? 
+	SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
     } else {
-      PyErr_Clear();
-    }
-    if (!dispatch) {
-      double d;
-      int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
-	if (val) *val = (long)(d);
-	return res;
-      }
+      return PyString_FromStringAndSize(carray, (int)(size));
     }
+  } else {
+    return SWIG_Py_Void();
   }
-#endif
-  return SWIG_TypeError;
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_int (PyObject * obj, int *val)
-{
-  long v;
-  int res = SWIG_AsVal_long (obj, &v);
-  if (SWIG_IsOK(res)) {
-    if ((v < INT_MIN || v > INT_MAX)) {
-      return SWIG_OverflowError;
-    } else {
-      if (val) *val = (int)(v);
-    }
-  }  
-  return res;
-}
-
-
-SWIGINTERNINLINE PyObject*
-  SWIG_From_bool  (bool value)
-{
-  return PyBool_FromLong(value ? 1 : 0);
+SWIGINTERNINLINE PyObject * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
-SWIGINTERN void delete_cli_credentials(cli_credentials *self){ talloc_free(self); }
 #ifdef __cplusplus
 extern "C" {
 #endif
-SWIGINTERN PyObject *_wrap_new_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  cli_credentials *result = 0 ;
-  
-  if (!SWIG_Python_UnpackTuple(args,"new_Credentials",0,0,0)) SWIG_fail;
-  result = (cli_credentials *)new_cli_credentials();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cli_credentials, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_username(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  cli_credentials *arg1 = (cli_credentials *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self", NULL 
-  };
-  
-  arg1 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_username",kwnames,&obj0)) SWIG_fail;
-  if (obj0) {
-    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_username" "', argument " "1"" of type '" "cli_credentials *""'"); 
-    }
-    arg1 = (cli_credentials *)(argp1);
-  }
-  result = (char *)cli_credentials_get_username(arg1);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_username(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  cli_credentials *arg1 = (cli_credentials *) 0 ;
-  char *arg2 = (char *) 0 ;
-  enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "value",(char *)"arg3", NULL 
-  };
-  
-  arg1 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_username",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
-  if (obj0) {
-    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_username" "', argument " "1"" of type '" "cli_credentials *""'"); 
-    }
-    arg1 = (cli_credentials *)(argp1);
-  }
-  if (obj1) {
-    res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_username" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = (char *)(buf2);
-  }
-  if (obj2) {
-    ecode3 = SWIG_AsVal_int(obj2, &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_username" "', argument " "3"" of type '" "enum credentials_obtained""'");
-    } 
-    arg3 = (enum credentials_obtained)(val3);
-  }
-  result = (bool)cli_credentials_set_username(arg1,(char const *)arg2,arg3);
-  resultobj = SWIG_From_bool((bool)(result));
-  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_password(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  cli_credentials *arg1 = (cli_credentials *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self", NULL 
-  };
-  
-  arg1 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_password",kwnames,&obj0)) SWIG_fail;
-  if (obj0) {
-    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_get_password" "', argument " "1"" of type '" "cli_credentials *""'"); 
-    }
-    arg1 = (cli_credentials *)(argp1);
-  }
-  result = (char *)cli_credentials_get_password(arg1);
-  resultobj = SWIG_FromCharPtr((const char *)result);
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_set_password(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  cli_credentials *arg1 = (cli_credentials *) 0 ;
-  char *arg2 = (char *) 0 ;
-  enum credentials_obtained arg3 = (enum credentials_obtained) CRED_SPECIFIED ;
-  bool result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  int res2 ;
-  char *buf2 = 0 ;
-  int alloc2 = 0 ;
-  int val3 ;
-  int ecode3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "val",(char *)"arg3", NULL 
-  };
-  
-  arg1 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_password",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
-  if (obj0) {
-    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_password" "', argument " "1"" of type '" "cli_credentials *""'"); 
-    }
-    arg1 = (cli_credentials *)(argp1);
-  }
-  if (obj1) {
-    res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_password" "', argument " "2"" of type '" "char const *""'");
-    }
-    arg2 = (char *)(buf2);
-  }
-  if (obj2) {
-    ecode3 = SWIG_AsVal_int(obj2, &val3);
-    if (!SWIG_IsOK(ecode3)) {
-      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Credentials_set_password" "', argument " "3"" of type '" "enum credentials_obtained""'");
-    } 
-    arg3 = (enum credentials_obtained)(val3);
-  }
-  result = (bool)cli_credentials_set_password(arg1,(char const *)arg2,arg3);
-  resultobj = SWIG_From_bool((bool)(result));
-  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
-  return resultobj;
-fail:
-  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Credentials_get_domain(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  cli_credentials *arg1 = (cli_credentials *) 0 ;
-  char *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject * obj0 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self", NULL 
-  };
-  
-  arg1 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_domain",kwnames,&obj0)) SWIG_fail;
-  if (obj0) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list