[SCM] Samba Shared Repository - branch master updated -
6efb7ff98191c5f62f66be33591f674b682986ac
Jelmer Vernooij
jelmer at samba.org
Sun Dec 21 06:36:55 GMT 2008
The branch, master has been updated
via 6efb7ff98191c5f62f66be33591f674b682986ac (commit)
via f36ff0bac29a0e26db8ac0994d046611e3704dd0 (commit)
via 263c6670fcae62c67a5284a385c674b94ef2112c (commit)
from 33ebc95591f1a193c6420df055993e4310bebd7f (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 6efb7ff98191c5f62f66be33591f674b682986ac
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Dec 21 07:34:27 2008 +0100
Fix various Python-related bugs.
commit f36ff0bac29a0e26db8ac0994d046611e3704dd0
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Dec 21 05:35:39 2008 +0100
Include errors.i verbatim in security.i, as it's the only file still using it.
commit 263c6670fcae62c67a5284a385c674b94ef2112c
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Dec 21 05:29:23 2008 +0100
Convert credentials Python module to "manual" C - no SWIG used to generate
the C code.
-----------------------------------------------------------------------
Summary of changes:
lib/tevent/pytevent.c | 1 +
source4/auth/credentials/config.mk | 10 +-
source4/auth/credentials/credentials.i | 147 -
source4/auth/credentials/credentials.py | 191 -
source4/auth/credentials/credentials_wrap.c | 4375 ---------------------
source4/auth/credentials/pycredentials.c | 314 ++
source4/auth/credentials/pycredentials.h | 30 +
source4/auth/tests/bindings.py | 2 +-
source4/dsdb/samdb/ldb_modules/tests/samba3sam.py | 340 +-
source4/lib/ldb/pyldb.c | 21 +-
source4/lib/ldb/pyldb.h | 4 +-
source4/lib/ldb/tests/python/ldap.py | 114 +-
source4/libcli/security/security.i | 34 +-
source4/libcli/util/errors.i | 54 -
source4/param/param_wrap.c | 19 +-
source4/param/pyparam.c | 495 +++
source4/scripting/python/samba/tests/upgrade.py | 2 +-
source4/setup/provision | 3 +-
18 files changed, 1135 insertions(+), 5021 deletions(-)
delete mode 100644 source4/auth/credentials/credentials.i
delete mode 100644 source4/auth/credentials/credentials.py
delete mode 100644 source4/auth/credentials/credentials_wrap.c
create mode 100644 source4/auth/credentials/pycredentials.c
create mode 100644 source4/auth/credentials/pycredentials.h
delete mode 100644 source4/libcli/util/errors.i
create mode 100644 source4/param/pyparam.c
Changeset truncated at 500 lines:
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 02e0db3..4f18c87 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -96,6 +96,7 @@ PyTypeObject PyEventContext = {
.tp_methods = py_event_ctx_methods,
.tp_basicsize = sizeof(py_talloc_Object),
.tp_dealloc = py_talloc_dealloc,
+ .tp_flags = Py_TPFLAGS_DEFAULT,
.tp_new = py_event_ctx_new,
};
diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk
index 2eeeec2..e4d14dd 100644
--- a/source4/auth/credentials/config.mk
+++ b/source4/auth/credentials/config.mk
@@ -14,11 +14,9 @@ $(eval $(call proto_header_template,$(authsrcdir)/credentials/credentials_proto.
PUBLIC_HEADERS += $(authsrcdir)/credentials/credentials.h
[PYTHON::swig_credentials]
-LIBRARY_REALNAME = samba/_credentials.$(SHLIBEXT)
-PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS
+LIBRARY_REALNAME = samba/credentials.$(SHLIBEXT)
+PUBLIC_DEPENDENCIES = CREDENTIALS LIBCMDLINE_CREDENTIALS PYTALLOC param
-$(eval $(call python_py_module_template,samba/credentials.py,$(authsrcdir)/credentials/credentials.py))
+swig_credentials_OBJ_FILES = $(authsrcdir)/credentials/pycredentials.o
-swig_credentials_OBJ_FILES = $(authsrcdir)/credentials/credentials_wrap.o
-
-$(swig_credentials_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+$(swig_credentials_OBJ_FILES): CFLAGS+=$(CFLAG_NO_CAST_QUAL)
diff --git a/source4/auth/credentials/credentials.i b/source4/auth/credentials/credentials.i
deleted file mode 100644
index bb31d6d..0000000
--- a/source4/auth/credentials/credentials.i
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-%module(docstring="Credentials management.",package="samba.credentials") credentials
-
-%{
-
-/* Include headers */
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "includes.h"
-#include "auth/credentials/credentials.h"
-#include "param/param.h"
-#include "lib/cmdline/credentials.h"
-typedef struct cli_credentials cli_credentials;
-%}
-
-%import "carrays.i"
-%import "typemaps.i"
-%import "param/param.i"
-
-%typemap(default,noblock=1) struct cli_credentials * {
- $1 = NULL;
-}
-
-%constant int AUTO_USE_KERBEROS = CRED_AUTO_USE_KERBEROS;
-%constant int DONT_USE_KERBEROS = CRED_DONT_USE_KERBEROS;
-%constant int MUST_USE_KERBEROS = CRED_MUST_USE_KERBEROS;
-
-%{
-#include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
-%}
-
-%typemap(out,noblock=1) struct samr_Password * {
- $result = PyString_FromStringAndSize((char *)$1->hash, 16);
-}
-
-%talloctype(cli_credentials);
-%rename(Credentials) cli_credentials;
-typedef struct cli_credentials {
- %extend {
- cli_credentials(void) {
- return cli_credentials_init(NULL);
- }
- /* username */
- %feature("docstring") get_username "S.get_username() -> username\nObtain username.";
- const char *get_username(void);
- %feature("docstring") set_username "S.set_username(name, obtained=CRED_SPECIFIED) -> None\nChange username.";
- bool set_username(const char *value,
- enum credentials_obtained obtained=CRED_SPECIFIED);
-
- /* password */
- %feature("docstring") get_password "S.get_password() -> password\n" \
- "Obtain password.";
- const char *get_password(void);
- %feature("docstring") set_password "S.set_password(password, obtained=CRED_SPECIFIED) -> None\n" \
- "Change password.";
- bool set_password(const char *val,
- enum credentials_obtained obtained=CRED_SPECIFIED);
-
- /* domain */
- %feature("docstring") get_password "S.get_domain() -> domain\nObtain domain name.";
- const char *get_domain(void);
- %feature("docstring") set_domain "S.set_domain(domain, obtained=CRED_SPECIFIED) -> None\n" \
- "Change domain name.";
- bool set_domain(const char *val,
- enum credentials_obtained obtained=CRED_SPECIFIED);
-
- /* realm */
- %feature("docstring") get_realm "S.get_realm() -> realm\nObtain realm name.";
- const char *get_realm(void);
- %feature("docstring") set_realm "S.set_realm(realm, obtained=CRED_SPECIFIED) -> None\n" \
- "Change realm name.";
- bool set_realm(const char *val,
- enum credentials_obtained obtained=CRED_SPECIFIED);
-
- /* Kerberos */
- void set_kerberos_state(enum credentials_use_kerberos use_kerberos);
-
- %feature("docstring") parse_string "S.parse_string(text, obtained=CRED_SPECIFIED) -> None\n" \
- "Parse credentials string.";
- void parse_string(const char *text,
- enum credentials_obtained obtained=CRED_SPECIFIED);
-
- /* bind dn */
- %feature("docstring") get_bind_dn "S.get_bind_dn() -> bind dn\nObtain bind DN.";
- const char *get_bind_dn(void);
- %feature("docstring") set_bind_dn "S.set_bind_dn(bind_dn) -> None\nChange bind DN.";
- bool set_bind_dn(const char *bind_dn);
-
- %feature("docstring") set_anonymous "S.set_anonymous() -> None\nUse anonymous credentials.";
- void set_anonymous();
-
- /* workstation name */
- const char *get_workstation(void);
- bool set_workstation(const char *workstation,
- enum credentials_obtained obtained=CRED_SPECIFIED);
-
- NTSTATUS set_machine_account(struct loadparm_context *lp_ctx);
-
- void guess(struct loadparm_context *lp_ctx);
- bool is_anonymous(void);
-
- const struct samr_Password *get_nt_hash(TALLOC_CTX *mem_ctx);
-
- bool authentication_requested(void);
-
- %feature("docstring") wrong_password "S.wrong_password() -> bool\nIndicate the returned password was incorrect.";
- bool wrong_password(void);
-
- %feature("docstring") set_cmdline_callbacks "S.set_cmdline_callbacks() -> bool\nUse command-line to obtain credentials not explicitly set.";
- bool set_cmdline_callbacks();
- }
-} cli_credentials;
-
-%{
-struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
-{
- struct cli_credentials *ret;
-
- if (py_obj == Py_None) {
- return cli_credentials_init_anon(NULL);
- }
-
- if (SWIG_ConvertPtr(py_obj, (void *)&ret, SWIGTYPE_p_cli_credentials, 0 | 0 ) < 0) {
- return NULL;
- }
- return ret;
-}
-
-%}
diff --git a/source4/auth/credentials/credentials.py b/source4/auth/credentials/credentials.py
deleted file mode 100644
index fe21dd2..0000000
--- a/source4/auth/credentials/credentials.py
+++ /dev/null
@@ -1,191 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.36
-#
-# Don't modify this file, modify the SWIG interface instead.
-
-"""
-Credentials management.
-"""
-
-import _credentials
-import new
-new_instancemethod = new.instancemethod
-try:
- _swig_property = property
-except NameError:
- pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
- if (name == "thisown"): return self.this.own(value)
- if (name == "this"):
- if type(value).__name__ == 'PySwigObject':
- self.__dict__[name] = value
- return
- method = class_type.__swig_setmethods__.get(name,None)
- if method: return method(self,value)
- if (not static) or hasattr(self,name):
- self.__dict__[name] = value
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
- if (name == "thisown"): return self.this.own()
- method = class_type.__swig_getmethods__.get(name,None)
- if method: return method(self)
- raise AttributeError,name
-
-def _swig_repr(self):
- try: strthis = "proxy of " + self.this.__repr__()
- except: strthis = ""
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-import types
-try:
- _object = types.ObjectType
- _newclass = 1
-except AttributeError:
- class _object : pass
- _newclass = 0
-del types
-
-
-def _swig_setattr_nondynamic_method(set):
- def set_attr(self,name,value):
- if (name == "thisown"): return self.this.own(value)
- if hasattr(self,name) or (name == "this"):
- set(self,name,value)
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
- return set_attr
-
-
-import param
-AUTO_USE_KERBEROS = _credentials.AUTO_USE_KERBEROS
-DONT_USE_KERBEROS = _credentials.DONT_USE_KERBEROS
-MUST_USE_KERBEROS = _credentials.MUST_USE_KERBEROS
-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):
- _credentials.Credentials_swiginit(self,_credentials.new_Credentials(*args, **kwargs))
- def get_username(*args, **kwargs):
- """
- S.get_username() -> username
- Obtain username.
- """
- return _credentials.Credentials_get_username(*args, **kwargs)
-
- def set_username(*args, **kwargs):
- """
- S.set_username(name, obtained=CRED_SPECIFIED) -> None
- Change username.
- """
- return _credentials.Credentials_set_username(*args, **kwargs)
-
- def get_password(*args, **kwargs):
- """
- S.get_password() -> password
- Obtain password.
- """
- return _credentials.Credentials_get_password(*args, **kwargs)
-
- def set_password(*args, **kwargs):
- """
- S.set_password(password, obtained=CRED_SPECIFIED) -> None
- Change password.
- """
- return _credentials.Credentials_set_password(*args, **kwargs)
-
- def set_domain(*args, **kwargs):
- """
- S.set_domain(domain, obtained=CRED_SPECIFIED) -> None
- Change domain name.
- """
- return _credentials.Credentials_set_domain(*args, **kwargs)
-
- def get_realm(*args, **kwargs):
- """
- S.get_realm() -> realm
- Obtain realm name.
- """
- return _credentials.Credentials_get_realm(*args, **kwargs)
-
- def set_realm(*args, **kwargs):
- """
- S.set_realm(realm, obtained=CRED_SPECIFIED) -> None
- Change realm name.
- """
- return _credentials.Credentials_set_realm(*args, **kwargs)
-
- def parse_string(*args, **kwargs):
- """
- S.parse_string(text, obtained=CRED_SPECIFIED) -> None
- Parse credentials string.
- """
- return _credentials.Credentials_parse_string(*args, **kwargs)
-
- def get_bind_dn(*args, **kwargs):
- """
- S.get_bind_dn() -> bind dn
- Obtain bind DN.
- """
- return _credentials.Credentials_get_bind_dn(*args, **kwargs)
-
- def set_bind_dn(*args, **kwargs):
- """
- S.set_bind_dn(bind_dn) -> None
- Change bind DN.
- """
- return _credentials.Credentials_set_bind_dn(*args, **kwargs)
-
- def set_anonymous(*args, **kwargs):
- """
- S.set_anonymous() -> None
- Use anonymous credentials.
- """
- return _credentials.Credentials_set_anonymous(*args, **kwargs)
-
- def wrong_password(*args, **kwargs):
- """
- S.wrong_password() -> bool
- Indicate the returned password was incorrect.
- """
- return _credentials.Credentials_wrong_password(*args, **kwargs)
-
- def set_cmdline_callbacks(*args, **kwargs):
- """
- S.set_cmdline_callbacks() -> bool
- Use command-line to obtain credentials not explicitly set.
- """
- return _credentials.Credentials_set_cmdline_callbacks(*args, **kwargs)
-
- __swig_destroy__ = _credentials.delete_Credentials
-Credentials.get_username = new_instancemethod(_credentials.Credentials_get_username,None,Credentials)
-Credentials.set_username = new_instancemethod(_credentials.Credentials_set_username,None,Credentials)
-Credentials.get_password = new_instancemethod(_credentials.Credentials_get_password,None,Credentials)
-Credentials.set_password = new_instancemethod(_credentials.Credentials_set_password,None,Credentials)
-Credentials.get_domain = new_instancemethod(_credentials.Credentials_get_domain,None,Credentials)
-Credentials.set_domain = new_instancemethod(_credentials.Credentials_set_domain,None,Credentials)
-Credentials.get_realm = new_instancemethod(_credentials.Credentials_get_realm,None,Credentials)
-Credentials.set_realm = new_instancemethod(_credentials.Credentials_set_realm,None,Credentials)
-Credentials.set_kerberos_state = new_instancemethod(_credentials.Credentials_set_kerberos_state,None,Credentials)
-Credentials.parse_string = new_instancemethod(_credentials.Credentials_parse_string,None,Credentials)
-Credentials.get_bind_dn = new_instancemethod(_credentials.Credentials_get_bind_dn,None,Credentials)
-Credentials.set_bind_dn = new_instancemethod(_credentials.Credentials_set_bind_dn,None,Credentials)
-Credentials.set_anonymous = new_instancemethod(_credentials.Credentials_set_anonymous,None,Credentials)
-Credentials.get_workstation = new_instancemethod(_credentials.Credentials_get_workstation,None,Credentials)
-Credentials.set_workstation = new_instancemethod(_credentials.Credentials_set_workstation,None,Credentials)
-Credentials.set_machine_account = new_instancemethod(_credentials.Credentials_set_machine_account,None,Credentials)
-Credentials.guess = new_instancemethod(_credentials.Credentials_guess,None,Credentials)
-Credentials.is_anonymous = new_instancemethod(_credentials.Credentials_is_anonymous,None,Credentials)
-Credentials.get_nt_hash = new_instancemethod(_credentials.Credentials_get_nt_hash,None,Credentials)
-Credentials.authentication_requested = new_instancemethod(_credentials.Credentials_authentication_requested,None,Credentials)
-Credentials.wrong_password = new_instancemethod(_credentials.Credentials_wrong_password,None,Credentials)
-Credentials.set_cmdline_callbacks = new_instancemethod(_credentials.Credentials_set_cmdline_callbacks,None,Credentials)
-Credentials_swigregister = _credentials.Credentials_swigregister
-Credentials_swigregister(Credentials)
-
-
-
diff --git a/source4/auth/credentials/credentials_wrap.c b/source4/auth/credentials/credentials_wrap.c
deleted file mode 100644
index 260451d..0000000
--- a/source4/auth/credentials/credentials_wrap.c
+++ /dev/null
@@ -1,4375 +0,0 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.36
- *
- * This file is not intended to be easily readable and contains a number of
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG
- * interface file instead.
- * ----------------------------------------------------------------------------- */
-
-#define SWIGPYTHON
-#define SWIG_PYTHON_NO_BUILD_NONE
-/* -----------------------------------------------------------------------------
- * This section contains generic SWIG labels for method/variable
- * declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-# define SWIGINLINE inline
-# else
-# define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-#endif
-
-#ifndef SWIG_MSC_UNSUPPRESS_4505
-# if defined(_MSC_VER)
-# pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-# define SWIGUNUSEDPARM(p)
-# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# ifndef GCC_HASCLASSVISIBILITY
-# define GCC_HASCLASSVISIBILITY
-# endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# if defined(STATIC_LINKED)
-# define SWIGEXPORT
-# else
-# define SWIGEXPORT __declspec(dllexport)
-# endif
-# else
-# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-# define SWIGEXPORT __attribute__ ((visibility("default")))
-# else
-# define SWIGEXPORT
-# endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# define SWIGSTDCALL __stdcall
-# else
-# define SWIGSTDCALL
-# endif
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
--
Samba Shared Repository
More information about the samba-cvs
mailing list