1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r26570: - Trim size of the swig-generated Python bindings by removing a bunch of {}'s.

- Start working on Python equivalents for various EJS tests.
- Fix regression in argument order for reg_diff_apply() in EJS bindings.
(This used to be commit c550c03372)
This commit is contained in:
Jelmer Vernooij 2007-12-23 19:19:41 -06:00 committed by Stefan Metzmacher
parent 784c22899f
commit aa0a06f13c
37 changed files with 3779 additions and 1245 deletions

View File

@ -36,11 +36,11 @@
%import "../lib/talloc/talloc.i"
%import "../param/param.i"
%typemap(default) struct auth_session_info * {
%typemap(default,noblock=1) struct auth_session_info * {
$1 = system_session_anon(NULL, global_loadparm);
}
%typemap(freearg) struct auth_session_info * {
%typemap(freearg,noblock=1) struct auth_session_info * {
talloc_free($1);
}

View File

@ -2464,15 +2464,16 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_loadparm_service swig_types[5]
#define SWIGTYPE_p_long_long swig_types[6]
#define SWIGTYPE_p_param_context swig_types[7]
#define SWIGTYPE_p_param_section swig_types[8]
#define SWIGTYPE_p_short swig_types[9]
#define SWIGTYPE_p_signed_char swig_types[10]
#define SWIGTYPE_p_unsigned_char swig_types[11]
#define SWIGTYPE_p_unsigned_int swig_types[12]
#define SWIGTYPE_p_unsigned_long_long swig_types[13]
#define SWIGTYPE_p_unsigned_short swig_types[14]
static swig_type_info *swig_types[16];
static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0};
#define SWIGTYPE_p_param_opt swig_types[8]
#define SWIGTYPE_p_param_section swig_types[9]
#define SWIGTYPE_p_short swig_types[10]
#define SWIGTYPE_p_signed_char swig_types[11]
#define SWIGTYPE_p_unsigned_char swig_types[12]
#define SWIGTYPE_p_unsigned_int swig_types[13]
#define SWIGTYPE_p_unsigned_long_long swig_types[14]
#define SWIGTYPE_p_unsigned_short swig_types[15]
static swig_type_info *swig_types[17];
static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2537,12 +2538,8 @@ SWIGINTERN PyObject *_wrap_system_session(PyObject *SWIGUNUSEDPARM(self), PyObje
(char *) "lp_ctx", NULL
};
{
arg2 = loadparm_init(NULL);
}
{
arg1 = NULL;
}
arg2 = loadparm_init(NULL);
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:system_session",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2571,12 +2568,8 @@ SWIGINTERN PyObject *_wrap_system_session_anon(PyObject *SWIGUNUSEDPARM(self), P
(char *) "lp_ctx", NULL
};
{
arg2 = loadparm_init(NULL);
}
{
arg1 = NULL;
}
arg2 = loadparm_init(NULL);
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:system_session_anon",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2610,6 +2603,7 @@ static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "stru
static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
@ -2627,6 +2621,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_loadparm_service,
&_swigt__p_long_long,
&_swigt__p_param_context,
&_swigt__p_param_opt,
&_swigt__p_param_section,
&_swigt__p_short,
&_swigt__p_signed_char,
@ -2644,6 +2639,7 @@ static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_con
static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
@ -2661,6 +2657,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_loadparm_service,
_swigc__p_long_long,
_swigc__p_param_context,
_swigc__p_param_opt,
_swigc__p_param_section,
_swigc__p_short,
_swigc__p_signed_char,

View File

@ -34,7 +34,7 @@ typedef struct cli_credentials cli_credentials;
%import "typemaps.i"
%import "param/param.i"
%typemap(default) struct cli_credentials * {
%typemap(default,noblock=1) struct cli_credentials * {
$1 = NULL;
}
@ -42,7 +42,7 @@ typedef struct cli_credentials cli_credentials;
#include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
%}
%typemap(out) struct samr_Password * {
%typemap(out,noblock=1) struct samr_Password * {
$result = PyString_FromStringAndSize($1->hash, 16);
}

View File

@ -2464,15 +2464,16 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_loadparm_service swig_types[5]
#define SWIGTYPE_p_long_long swig_types[6]
#define SWIGTYPE_p_param_context swig_types[7]
#define SWIGTYPE_p_param_section swig_types[8]
#define SWIGTYPE_p_short swig_types[9]
#define SWIGTYPE_p_signed_char swig_types[10]
#define SWIGTYPE_p_unsigned_char swig_types[11]
#define SWIGTYPE_p_unsigned_int swig_types[12]
#define SWIGTYPE_p_unsigned_long_long swig_types[13]
#define SWIGTYPE_p_unsigned_short swig_types[14]
static swig_type_info *swig_types[16];
static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0};
#define SWIGTYPE_p_param_opt swig_types[8]
#define SWIGTYPE_p_param_section swig_types[9]
#define SWIGTYPE_p_short swig_types[10]
#define SWIGTYPE_p_signed_char swig_types[11]
#define SWIGTYPE_p_unsigned_char swig_types[12]
#define SWIGTYPE_p_unsigned_int swig_types[13]
#define SWIGTYPE_p_unsigned_long_long swig_types[14]
#define SWIGTYPE_p_unsigned_short swig_types[15]
static swig_type_info *swig_types[17];
static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2800,9 +2801,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_username(PyObject *SWIGUNUSEDPARM(sel
(char *) "self", NULL
};
{
arg1 = 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 );
@ -2839,9 +2838,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_username(PyObject *SWIGUNUSEDPARM(sel
(char *) "self",(char *) "value",(char *)"arg3", NULL
};
{
arg1 = 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 );
@ -2885,9 +2882,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_password(PyObject *SWIGUNUSEDPARM(sel
(char *) "self", NULL
};
{
arg1 = 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 );
@ -2924,9 +2919,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_password(PyObject *SWIGUNUSEDPARM(sel
(char *) "self",(char *) "val",(char *)"arg3", NULL
};
{
arg1 = 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 );
@ -2970,9 +2963,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_domain(PyObject *SWIGUNUSEDPARM(self)
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_domain",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3009,9 +3000,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_domain(PyObject *SWIGUNUSEDPARM(self)
(char *) "self",(char *) "val",(char *)"arg3", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_domain",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3055,9 +3044,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_realm(PyObject *SWIGUNUSEDPARM(self),
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_realm",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3094,9 +3081,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_realm(PyObject *SWIGUNUSEDPARM(self),
(char *) "self",(char *) "val",(char *)"arg3", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_realm",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3148,9 +3133,7 @@ SWIGINTERN PyObject *_wrap_Credentials_parse_string(PyObject *SWIGUNUSEDPARM(sel
(char *) "self",(char *) "text",(char *)"arg3", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_parse_string",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3194,9 +3177,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_bind_dn(PyObject *SWIGUNUSEDPARM(self
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_bind_dn",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3229,9 +3210,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_bind_dn(PyObject *SWIGUNUSEDPARM(self
(char *) "self",(char *) "bind_dn", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_set_bind_dn",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3268,9 +3247,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_workstation(PyObject *SWIGUNUSEDPARM(
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_workstation",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3307,9 +3284,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_workstation(PyObject *SWIGUNUSEDPARM(
(char *) "self",(char *) "workstation",(char *) "obtained", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_workstation",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3356,12 +3331,8 @@ SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyO
(char *) "self",(char *) "lp_ctx", NULL
};
{
arg1 = NULL;
}
{
arg2 = loadparm_init(NULL);
}
arg1 = NULL;
arg2 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_guess",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3396,9 +3367,7 @@ SWIGINTERN PyObject *_wrap_Credentials_is_anonymous(PyObject *SWIGUNUSEDPARM(sel
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_is_anonymous",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3427,12 +3396,8 @@ SWIGINTERN PyObject *_wrap_Credentials_get_nt_hash(PyObject *SWIGUNUSEDPARM(self
(char *) "self", NULL
};
{
arg1 = NULL;
}
{
arg2 = NULL;
}
arg1 = NULL;
arg2 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_nt_hash",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3442,9 +3407,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_nt_hash(PyObject *SWIGUNUSEDPARM(self
arg1 = (cli_credentials *)(argp1);
}
result = (struct samr_Password *)cli_credentials_get_nt_hash(arg1,arg2);
{
resultobj = PyString_FromStringAndSize(result->hash, 16);
}
resultobj = PyString_FromStringAndSize(result->hash, 16);
return resultobj;
fail:
return NULL;
@ -3462,9 +3425,7 @@ SWIGINTERN PyObject *_wrap_Credentials_authentication_requested(PyObject *SWIGUN
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_authentication_requested",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3492,9 +3453,7 @@ SWIGINTERN PyObject *_wrap_Credentials_wrong_password(PyObject *SWIGUNUSEDPARM(s
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_wrong_password",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3521,9 +3480,7 @@ SWIGINTERN PyObject *_wrap_delete_Credentials(PyObject *SWIGUNUSEDPARM(self), Py
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:delete_Credentials",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, SWIG_POINTER_DISOWN | 0 );
@ -3589,6 +3546,7 @@ static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "stru
static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
@ -3606,6 +3564,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_loadparm_service,
&_swigt__p_long_long,
&_swigt__p_param_context,
&_swigt__p_param_opt,
&_swigt__p_param_section,
&_swigt__p_short,
&_swigt__p_signed_char,
@ -3623,6 +3582,7 @@ static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_con
static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
@ -3640,6 +3600,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_loadparm_service,
_swigc__p_long_long,
_swigc__p_param_context,
_swigc__p_param_opt,
_swigc__p_param_section,
_swigc__p_short,
_swigc__p_signed_char,

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
%typemap(default) struct event_context * {
%typemap(default,noblock=1) struct event_context * {
$1 = event_context_init(NULL);
}

View File

@ -2579,9 +2579,7 @@ SWIGINTERN PyObject *_wrap_event_context_init(PyObject *SWIGUNUSEDPARM(self), Py
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
struct event_context *result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"event_context_init",0,0,0)) SWIG_fail;
result = (struct event_context *)event_context_init(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_event_context, 0 | 0 );
@ -2604,9 +2602,7 @@ SWIGINTERN PyObject *_wrap_event_context_init_byname(PyObject *SWIGUNUSEDPARM(se
(char *) "name", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:event_context_init_byname",kwnames,&obj0)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
@ -2628,9 +2624,7 @@ SWIGINTERN PyObject *_wrap_event_backend_list(PyObject *SWIGUNUSEDPARM(self), Py
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
char **result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"event_backend_list",0,0,0)) SWIG_fail;
result = (char **)event_backend_list(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0 );

View File

@ -67,13 +67,13 @@ typedef int ldb_error;
/* The ldb functions will crash if a NULL ldb context is passed so
catch this before it happens. */
%typemap(check) struct ldb_context* {
%typemap(check,noblock=1) struct ldb_context* {
if ($1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
%typemap(check) ldb_msg * {
%typemap(check,noblock=1) ldb_msg * {
if ($1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
@ -83,7 +83,7 @@ typedef int ldb_error;
* Wrap struct ldb_val
*/
%typemap(in) struct ldb_val *INPUT (struct ldb_val temp) {
%typemap(in,noblock=1) struct ldb_val *INPUT (struct ldb_val temp) {
$1 = &temp;
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
@ -93,7 +93,7 @@ typedef int ldb_error;
$1->data = PyString_AsString($input);
}
%typemap(out) struct ldb_val {
%typemap(out,noblock=1) struct ldb_val {
$result = PyString_FromStringAndSize((const char *)$1.data, $1.length);
}
@ -101,7 +101,7 @@ typedef int ldb_error;
* Wrap struct ldb_result
*/
%typemap(in, numinputs=0) struct ldb_result **OUT (struct ldb_result *temp_ldb_result) {
%typemap(in,noblock=1,numinputs=0) struct ldb_result **OUT (struct ldb_result *temp_ldb_result) {
$1 = &temp_ldb_result;
}
@ -115,7 +115,7 @@ typedef int ldb_error;
}
}
%typemap(in, numinputs=1) const char * const *attrs {
%typemap(in,noblock=1,numinputs=1) const char * const *attrs {
if ($input == Py_None) {
$1 = NULL;
} else if (PySequence_Check($input)) {
@ -196,12 +196,16 @@ fail:
int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
struct ldb_context *ldb, ldb_dn **dn)
{
int ret;
struct ldb_dn *odn;
if (ldb != NULL && PyString_Check(object)) {
*dn = ldb_dn_new(mem_ctx, ldb, PyString_AsString(object));
return 0;
}
return SWIG_ConvertPtr(object, (void **)dn, SWIGTYPE_p_ldb_dn,
ret = SWIG_ConvertPtr(object, (void **)&odn, SWIGTYPE_p_ldb_dn,
SWIG_POINTER_EXCEPTION);
*dn = ldb_dn_copy(mem_ctx, odn);
return ret;
}
ldb_msg_element *ldb_msg_element_from_pyobject(PyObject *set_obj, int flags,
@ -277,6 +281,15 @@ typedef struct ldb_message_element {
~ldb_msg_element() { talloc_free($self); }
int compare(ldb_msg_element *);
}
%pythoncode {
def __eq__(self, other):
if (isinstance(other, str) and
len(set(self)) == 1 and
set(self).pop() == other):
return True
return self.__cmp__(other) == 0
}
} ldb_msg_element;
/* ldb_message */
@ -427,7 +440,7 @@ PyObject *PyExc_LdbError;
*/
%typemap(out) ldb_error {
%typemap(out,noblock=1) ldb_error {
if ($1 != LDB_SUCCESS) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", $1, ldb_strerror($1)));
SWIG_fail;
@ -436,6 +449,17 @@ PyObject *PyExc_LdbError;
};
%rename(Ldb) ldb_context;
%typemap(in,noblock=1) struct ldb_dn * {
if (ldb_dn_from_pyobject(NULL, $input, arg1, &$1) != 0) {
SWIG_fail;
}
};
%typemap(freearg,noblock=1) struct ldb_dn * {
talloc_free($1);
};
/* Top-level ldb operations */
typedef struct ldb_context {
%extend {
@ -554,6 +578,9 @@ fail:
}
} ldb;
%typemap(in,noblock=1) struct ldb_dn *;
%typemap(freearg,noblock=1) struct ldb_dn *;
%nodefault ldb_message;
%nodefault ldb_context;
%nodefault Dn;

View File

@ -94,6 +94,14 @@ class ldb_msg_element(object):
def __init__(self): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
__swig_destroy__ = _ldb.delete_ldb_msg_element
def __eq__(self, other):
if (isinstance(other, str) and
len(set(self)) == 1 and
set(self).pop() == other):
return True
return self.__cmp__(other) == 0
ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element)
ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element)
ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element)

View File

@ -2675,12 +2675,16 @@ SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){
int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
struct ldb_context *ldb, ldb_dn **dn)
{
int ret;
struct ldb_dn *odn;
if (ldb != NULL && PyString_Check(object)) {
*dn = ldb_dn_new(mem_ctx, ldb, PyString_AsString(object));
return 0;
}
return SWIG_ConvertPtr(object, (void **)dn, SWIGTYPE_p_ldb_dn,
ret = SWIG_ConvertPtr(object, (void **)&odn, SWIGTYPE_p_ldb_dn,
SWIG_POINTER_EXCEPTION);
*dn = ldb_dn_copy(mem_ctx, odn);
return ret;
}
ldb_msg_element *ldb_msg_element_from_pyobject(PyObject *set_obj, int flags,
@ -3137,11 +3141,9 @@ SWIGINTERN PyObject *_wrap_new_Dn(PyObject *SWIGUNUSEDPARM(self), PyObject *args
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Dn" "', argument " "2"" of type '" "char const *""'");
}
arg2 = (char *)(buf2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (ldb_dn *)new_ldb_dn(arg1,(char const *)arg2);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_dn, SWIG_POINTER_NEW | 0 );
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -3760,11 +3762,9 @@ SWIGINTERN PyObject *_wrap_ldb_msg_list_elements(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_msg_list_elements" "', argument " "1"" of type '" "ldb_msg *""'");
}
arg1 = (ldb_msg *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = (PyObject *)ldb_msg_list_elements(arg1);
resultobj = result;
return resultobj;
@ -3794,11 +3794,9 @@ SWIGINTERN PyObject *_wrap_Message_dn_set(PyObject *SWIGUNUSEDPARM(self), PyObje
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message_dn_set" "', argument " "2"" of type '" "ldb_dn *""'");
}
arg2 = (ldb_dn *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
if (arg1) (arg1)->dn = arg2;
resultobj = SWIG_Py_Void();
@ -3823,11 +3821,9 @@ SWIGINTERN PyObject *_wrap_Message_dn_get(PyObject *SWIGUNUSEDPARM(self), PyObje
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_dn_get" "', argument " "1"" of type '" "ldb_msg *""'");
}
arg1 = (ldb_msg *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = (ldb_dn *) ((arg1)->dn);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_dn, 0 | 0 );
return resultobj;
@ -3877,11 +3873,9 @@ SWIGINTERN PyObject *_wrap_delete_Message(PyObject *SWIGUNUSEDPARM(self), PyObje
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Message" "', argument " "1"" of type '" "ldb_msg *""'");
}
arg1 = (ldb_msg *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
delete_ldb_msg(arg1);
resultobj = SWIG_Py_Void();
@ -3918,11 +3912,9 @@ SWIGINTERN PyObject *_wrap_Message___getitem__(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message___getitem__" "', argument " "2"" of type '" "char const *""'");
}
arg2 = (char *)(buf2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = (ldb_msg_element *)ldb_msg_find_element(arg1,(char const *)arg2);
{
if (result == NULL)
@ -3967,11 +3959,9 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Message___setitem__" "', argument " "3"" of type '" "ldb_msg_element *""'");
}
arg3 = (ldb_msg_element *)(argp3);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
ldb_msg___setitem____SWIG_0(arg1,(char const *)arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -4005,11 +3995,9 @@ SWIGINTERN PyObject *_wrap_Message___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(
}
arg2 = (char *)(buf2);
arg3 = swig_obj[2];
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
ldb_msg___setitem____SWIG_1(arg1,(char const *)arg2,arg3);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -4063,11 +4051,9 @@ SWIGINTERN PyObject *_wrap_Message___len__(PyObject *SWIGUNUSEDPARM(self), PyObj
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___len__" "', argument " "1"" of type '" "ldb_msg *""'");
}
arg1 = (ldb_msg *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = (unsigned int)ldb_msg___len__(arg1);
resultobj = SWIG_From_unsigned_SS_int((unsigned int)(result));
return resultobj;
@ -4091,11 +4077,9 @@ SWIGINTERN PyObject *_wrap_Message_keys(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message_keys" "', argument " "1"" of type '" "ldb_msg *""'");
}
arg1 = (ldb_msg *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = (PyObject *)ldb_msg_keys(arg1);
resultobj = result;
return resultobj;
@ -4119,11 +4103,9 @@ SWIGINTERN PyObject *_wrap_Message___iter__(PyObject *SWIGUNUSEDPARM(self), PyOb
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Message___iter__" "', argument " "1"" of type '" "ldb_msg *""'");
}
arg1 = (ldb_msg *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = (PyObject *)ldb_msg___iter__(arg1);
resultobj = result;
return resultobj;
@ -4158,11 +4140,9 @@ SWIGINTERN PyObject *_wrap_Message___delitem__(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Message___delitem__" "', argument " "2"" of type '" "char const *""'");
}
arg2 = (char *)(buf2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
ldb_msg_remove_attr(arg1,(char const *)arg2);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -4310,19 +4290,15 @@ SWIGINTERN PyObject *_wrap_Ldb_connect(PyObject *SWIGUNUSEDPARM(self), PyObject
}
arg4 = (char **)(argp4);
}
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_connect(arg1,(char const *)arg2,arg3,(char const *(*))arg4);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -4345,11 +4321,9 @@ SWIGINTERN PyObject *_wrap_delete_Ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Ldb" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
delete_ldb(arg1);
resultobj = SWIG_Py_Void();
@ -4370,8 +4344,6 @@ SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *
ldb_error result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
int val3 ;
int ecode3 = 0 ;
int res4 ;
@ -4388,9 +4360,7 @@ SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *
(char *) "self",(char *) "base",(char *) "scope",(char *) "expression",(char *) "attrs", NULL
};
{
arg6 = &temp_ldb_result6;
}
arg6 = &temp_ldb_result6;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:Ldb_search",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 );
if (!SWIG_IsOK(res1)) {
@ -4398,11 +4368,9 @@ SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *
}
arg1 = (ldb *)(argp1);
if (obj1) {
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_search" "', argument " "2"" of type '" "ldb_dn *""'");
if (ldb_dn_from_pyobject(NULL, obj1, arg1, &arg2) != 0) {
SWIG_fail;
}
arg2 = (ldb_dn *)(argp2);
}
if (obj2) {
ecode3 = SWIG_AsVal_int(obj2, &val3);
@ -4419,33 +4387,27 @@ SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *
arg4 = (char *)(buf4);
}
if (obj4) {
{
if (obj4 == Py_None) {
arg5 = NULL;
} else if (PySequence_Check(obj4)) {
int i;
arg5 = talloc_array(NULL, char *, PySequence_Size(obj4)+1);
for(i = 0; i < PySequence_Size(obj4); i++)
arg5[i] = PyString_AsString(PySequence_GetItem(obj4, i));
arg5[i] = NULL;
} else {
SWIG_exception(SWIG_TypeError, "expected sequence");
}
if (obj4 == Py_None) {
arg5 = NULL;
} else if (PySequence_Check(obj4)) {
int i;
arg5 = talloc_array(NULL, char *, PySequence_Size(obj4)+1);
for(i = 0; i < PySequence_Size(obj4); i++)
arg5[i] = PyString_AsString(PySequence_GetItem(obj4, i));
arg5[i] = NULL;
} else {
SWIG_exception(SWIG_TypeError, "expected sequence");
}
}
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_search(arg1,arg2,arg3,(char const *)arg4,(char const *const *)arg5,arg6);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
{
resultobj = PyList_New((*arg6)->count);
for (i6 = 0; i6 < (*arg6)->count; i6++) {
@ -4454,12 +4416,14 @@ SWIGINTERN PyObject *_wrap_Ldb_search(PyObject *SWIGUNUSEDPARM(self), PyObject *
);
}
}
talloc_free(arg2);
if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
{
talloc_free(arg5);
}
return resultobj;
fail:
talloc_free(arg2);
if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
{
talloc_free(arg5);
@ -4475,8 +4439,6 @@ SWIGINTERN PyObject *_wrap_Ldb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
ldb_error result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char * kwnames[] = {
@ -4489,26 +4451,22 @@ SWIGINTERN PyObject *_wrap_Ldb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_delete" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_delete" "', argument " "2"" of type '" "ldb_dn *""'");
}
arg2 = (ldb_dn *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
if (ldb_dn_from_pyobject(NULL, obj1, arg1, &arg2) != 0) {
SWIG_fail;
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_delete(arg1,arg2);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
talloc_free(arg2);
return resultobj;
fail:
talloc_free(arg2);
return NULL;
}
@ -4521,10 +4479,6 @@ SWIGINTERN PyObject *_wrap_Ldb_rename(PyObject *SWIGUNUSEDPARM(self), PyObject *
ldb_error result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
void *argp3 = 0 ;
int res3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
@ -4538,31 +4492,27 @@ SWIGINTERN PyObject *_wrap_Ldb_rename(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_rename" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_rename" "', argument " "2"" of type '" "ldb_dn *""'");
if (ldb_dn_from_pyobject(NULL, obj1, arg1, &arg2) != 0) {
SWIG_fail;
}
arg2 = (ldb_dn *)(argp2);
res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_ldb_dn, 0 | 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Ldb_rename" "', argument " "3"" of type '" "ldb_dn *""'");
}
arg3 = (ldb_dn *)(argp3);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
if (ldb_dn_from_pyobject(NULL, obj2, arg1, &arg3) != 0) {
SWIG_fail;
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_rename(arg1,arg2,arg3);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
talloc_free(arg2);
talloc_free(arg3);
return resultobj;
fail:
talloc_free(arg2);
talloc_free(arg3);
return NULL;
}
@ -4588,24 +4538,18 @@ SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int n
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_add" "', argument " "2"" of type '" "ldb_msg *""'");
}
arg2 = (ldb_msg *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
{
if (arg2 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
if (arg2 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = ldb_add(arg1,arg2);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -4627,19 +4571,15 @@ SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int n
}
arg1 = (ldb *)(argp1);
arg2 = swig_obj[1];
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_add__SWIG_1(arg1,arg2);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -4700,24 +4640,18 @@ SWIGINTERN PyObject *_wrap_Ldb_modify(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_modify" "', argument " "2"" of type '" "ldb_msg *""'");
}
arg2 = (ldb_msg *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
{
if (arg2 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
if (arg2 == NULL)
SWIG_exception(SWIG_ValueError,
"Message can not be None");
result = ldb_modify(arg1,arg2);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -4739,11 +4673,9 @@ SWIGINTERN PyObject *_wrap_Ldb_get_config_basedn(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_config_basedn" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (ldb_dn *)ldb_get_config_basedn(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_dn, 0 | 0 );
return resultobj;
@ -4767,11 +4699,9 @@ SWIGINTERN PyObject *_wrap_Ldb_get_root_basedn(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_root_basedn" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (ldb_dn *)ldb_get_root_basedn(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_dn, 0 | 0 );
return resultobj;
@ -4795,11 +4725,9 @@ SWIGINTERN PyObject *_wrap_Ldb_get_schema_basedn(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_schema_basedn" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (ldb_dn *)ldb_get_schema_basedn(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_dn, 0 | 0 );
return resultobj;
@ -4823,11 +4751,9 @@ SWIGINTERN PyObject *_wrap_Ldb_get_default_basedn(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_get_default_basedn" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (ldb_dn *)ldb_get_default_basedn(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ldb_dn, 0 | 0 );
return resultobj;
@ -4851,11 +4777,9 @@ SWIGINTERN PyObject *_wrap_Ldb_errstring(PyObject *SWIGUNUSEDPARM(self), PyObjec
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_errstring" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (char *)ldb_errstring(arg1);
resultobj = SWIG_FromCharPtr((const char *)result);
return resultobj;
@ -4889,11 +4813,9 @@ SWIGINTERN PyObject *_wrap_Ldb_set_create_perms(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Ldb_set_create_perms" "', argument " "2"" of type '" "unsigned int""'");
}
arg2 = (unsigned int)(val2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
ldb_set_create_perms(arg1,arg2);
resultobj = SWIG_Py_Void();
return resultobj;
@ -4928,11 +4850,9 @@ SWIGINTERN PyObject *_wrap_Ldb_set_modules_dir(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_set_modules_dir" "', argument " "2"" of type '" "char const *""'");
}
arg2 = (char *)(buf2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
ldb_set_modules_dir(arg1,(char const *)arg2);
resultobj = SWIG_Py_Void();
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -4970,19 +4890,15 @@ SWIGINTERN PyObject *_wrap_Ldb_set_debug(PyObject *SWIGUNUSEDPARM(self), PyObjec
Py_INCREF(obj1);
arg3 = obj1;
}
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_set_debug(arg1,arg2,arg3);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -5023,19 +4939,15 @@ SWIGINTERN PyObject *_wrap_Ldb_set_opaque(PyObject *SWIGUNUSEDPARM(self), PyObje
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Ldb_set_opaque" "', argument " "3"" of type '" "void *""'");
}
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_set_opaque(arg1,(char const *)arg2,arg3);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -5071,11 +4983,9 @@ SWIGINTERN PyObject *_wrap_Ldb_get_opaque(PyObject *SWIGUNUSEDPARM(self), PyObje
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_get_opaque" "', argument " "2"" of type '" "char const *""'");
}
arg2 = (char *)(buf2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (void *)ldb_get_opaque(arg1,(char const *)arg2);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -5101,19 +5011,15 @@ SWIGINTERN PyObject *_wrap_Ldb_transaction_start(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_transaction_start" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_transaction_start(arg1);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -5135,19 +5041,15 @@ SWIGINTERN PyObject *_wrap_Ldb_transaction_commit(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_transaction_commit" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_transaction_commit(arg1);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -5169,19 +5071,15 @@ SWIGINTERN PyObject *_wrap_Ldb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_transaction_cancel" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb_transaction_cancel(arg1);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;
@ -5196,8 +5094,6 @@ SWIGINTERN PyObject *_wrap_Ldb___contains__(PyObject *SWIGUNUSEDPARM(self), PyOb
ldb_error result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
struct ldb_result *tmp3 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
@ -5214,32 +5110,28 @@ SWIGINTERN PyObject *_wrap_Ldb___contains__(PyObject *SWIGUNUSEDPARM(self), PyOb
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb___contains__" "', argument " "1"" of type '" "ldb *""'");
}
arg1 = (ldb *)(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_dn, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb___contains__" "', argument " "2"" of type '" "ldb_dn *""'");
}
arg2 = (ldb_dn *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
if (ldb_dn_from_pyobject(NULL, obj1, arg1, &arg2) != 0) {
SWIG_fail;
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = ldb___contains__(arg1,arg2,arg3);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
{
resultobj = ((*arg3)->count > 0)?Py_True:Py_False;
}
talloc_free(arg2);
{
talloc_free(*arg3);
}
return resultobj;
fail:
talloc_free(arg2);
{
talloc_free(*arg3);
}
@ -5274,11 +5166,9 @@ SWIGINTERN PyObject *_wrap_Ldb_parse_ldif(PyObject *SWIGUNUSEDPARM(self), PyObje
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_parse_ldif" "', argument " "2"" of type '" "char const *""'");
}
arg2 = (char *)(buf2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (PyObject *)ldb_parse_ldif(arg1,(char const *)arg2);
resultobj = result;
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
@ -5397,13 +5287,11 @@ SWIGINTERN PyObject *_wrap_register_module(PyObject *SWIGUNUSEDPARM(self), PyObj
arg1->name = PyObject_GetAttrString(obj0, "name");
}
result = ldb_register_module((struct ldb_module_ops const *)arg1);
{
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
if (result != 0) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", result, ldb_strerror(result)));
SWIG_fail;
}
resultobj = Py_None;
return resultobj;
fail:
return NULL;

View File

@ -52,6 +52,10 @@ class SimpleLdb(unittest.TestCase):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search(ldb.Dn(l, ""), ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0)
def test_search_string_dn(self):
l = ldb.Ldb("foo.tdb")
self.assertEquals(len(l.search("", ldb.SCOPE_SUBTREE, "(dc=*)", ["dc"])), 0)
def test_opaque(self):
l = ldb.Ldb("foo.tdb")
l.set_opaque("my_opaque", l)
@ -142,6 +146,19 @@ class SimpleLdb(unittest.TestCase):
finally:
l.delete(ldb.Dn(l, "dc=bar"))
def test_rename_string_dns(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()
m.dn = ldb.Dn(l, "dc=foo")
m["bla"] = "bla"
self.assertEquals(len(l.search()), 1)
l.add(m)
try:
l.rename("dc=foo", "dc=bar")
self.assertEquals(len(l.search()), 2)
finally:
l.delete(ldb.Dn(l, "dc=bar"))
def test_modify_delete(self):
l = ldb.Ldb("foo.tdb")
m = ldb.Message()

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ typedef struct hive_key hive_key;
%}
/* FIXME: This should be in another file */
%typemap(default) struct auth_session_info * {
%typemap(default,noblock=1) struct auth_session_info * {
$1 = NULL;
}
@ -48,11 +48,11 @@ const char *reg_get_predef_name(uint32_t hkey);
const char *str_regtype(int type);
/* Registry contexts */
%typemap(in,numinputs=0) struct registry_context ** (struct registry_context *tmp) {
%typemap(in,noblock=1,numinputs=0) struct registry_context ** (struct registry_context *tmp) {
$1 = &tmp;
}
%typemap(argout) struct registry_context ** {
%typemap(argout,noblock=1) struct registry_context ** {
$result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_registry_context, 0);
}
@ -61,7 +61,7 @@ WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
%typemap(in) const char ** {
%typemap(in,noblock=1) const char ** {
/* Check if is a list */
if (PyList_Check($input)) {
int size = PyList_Size($input);
@ -84,7 +84,7 @@ WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx,
}
}
%typemap(freearg) const char ** {
%typemap(freearg,noblock=1) const char ** {
free((char **) $1);
}
@ -121,11 +121,11 @@ typedef struct registry_context {
} reg;
/* Hives */
%typemap(in,numinputs=0) struct hive_key ** (struct hive_key *tmp) {
%typemap(in,noblock=1,numinputs=0) struct hive_key ** (struct hive_key *tmp) {
$1 = &tmp;
}
%typemap(argout) struct hive_key ** {
%typemap(argout,noblock=1) struct hive_key ** {
Py_XDECREF($result);
$result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_hive_key, 0);
}

View File

@ -2928,18 +2928,12 @@ SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
(char *) "session_info",(char *) "credentials", NULL
};
{
arg3 = NULL;
}
arg3 = NULL;
{
arg4 = NULL;
}
{
arg1 = NULL;
}
{
arg2 = &tmp2;
}
arg1 = NULL;
arg2 = &tmp2;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Registry",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_auth_session_info, 0 | 0 );
@ -2956,17 +2950,14 @@ SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg4 = (struct cli_credentials *)(argp4);
}
result = reg_open_local(arg1,arg2,arg3,arg4);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_registry_context, 0);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_registry_context, 0);
return resultobj;
fail:
return NULL;
@ -3010,13 +3001,12 @@ SWIGINTERN PyObject *_wrap_reg_get_predefined_key_by_name(PyObject *SWIGUNUSEDPA
}
arg3 = (struct registry_key **)(argp3);
result = reg_get_predefined_key_by_name(arg1,(char const *)arg2,arg3);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
@ -3054,13 +3044,12 @@ SWIGINTERN PyObject *_wrap_reg_key_del_abs(PyObject *SWIGUNUSEDPARM(self), PyObj
}
arg2 = (char *)(buf2);
result = reg_key_del_abs(arg1,(char const *)arg2);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
@ -3106,13 +3095,12 @@ SWIGINTERN PyObject *_wrap_reg_get_predefined_key(PyObject *SWIGUNUSEDPARM(self)
}
arg3 = (struct registry_key **)(argp3);
result = reg_get_predefined_key(arg1,arg2,arg3);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
return resultobj;
fail:
@ -3148,13 +3136,12 @@ SWIGINTERN PyObject *_wrap_reg_diff_apply(PyObject *SWIGUNUSEDPARM(self), PyObje
}
arg2 = (char *)(buf2);
result = reg_diff_apply(arg1,(char const *)arg2);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
@ -3207,13 +3194,12 @@ SWIGINTERN PyObject *_wrap_reg_generate_diff(PyObject *SWIGUNUSEDPARM(self), PyO
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "reg_generate_diff" "', argument " "4"" of type '" "void *""'");
}
result = reg_generate_diff(arg1,arg2,(struct reg_diff_callbacks const *)arg3,arg4);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
return resultobj;
fail:
@ -3252,46 +3238,39 @@ SWIGINTERN PyObject *_wrap_reg_mount_hive__SWIG_0(PyObject *SWIGUNUSEDPARM(self)
}
arg3 = (uint32_t)(val3);
if (swig_obj[3]) {
{
/* Check if is a list */
if (PyList_Check(swig_obj[3])) {
int size = PyList_Size(swig_obj[3]);
int i = 0;
arg4 = (char **) malloc((size+1)*sizeof(const char *));
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem(swig_obj[3],i);
if (PyString_Check(o))
arg4[i] = PyString_AsString(PyList_GetItem(swig_obj[3],i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain strings");
free(arg4);
return NULL;
}
/* Check if is a list */
if (PyList_Check(swig_obj[3])) {
int size = PyList_Size(swig_obj[3]);
int i = 0;
arg4 = (char **) malloc((size+1)*sizeof(const char *));
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem(swig_obj[3],i);
if (PyString_Check(o))
arg4[i] = PyString_AsString(PyList_GetItem(swig_obj[3],i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain strings");
free(arg4);
return NULL;
}
arg4[i] = 0;
} else {
PyErr_SetString(PyExc_TypeError,"not a list");
return NULL;
}
arg4[i] = 0;
} else {
PyErr_SetString(PyExc_TypeError,"not a list");
return NULL;
}
}
result = reg_mount_hive(arg1,arg2,arg3,(char const **)arg4);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
free((char **) arg4);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
free((char **) arg4);
return resultobj;
fail:
{
free((char **) arg4);
}
free((char **) arg4);
return NULL;
}
@ -3333,38 +3312,32 @@ SWIGINTERN PyObject *_wrap_reg_import_hive_key(PyObject *SWIGUNUSEDPARM(self), P
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "reg_import_hive_key" "', argument " "3"" of type '" "uint32_t""'");
}
arg3 = (uint32_t)(val3);
{
/* Check if is a list */
if (PyList_Check(obj3)) {
int size = PyList_Size(obj3);
int i = 0;
arg4 = (char **) malloc((size+1)*sizeof(const char *));
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem(obj3,i);
if (PyString_Check(o))
arg4[i] = PyString_AsString(PyList_GetItem(obj3,i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain strings");
free(arg4);
return NULL;
}
/* Check if is a list */
if (PyList_Check(obj3)) {
int size = PyList_Size(obj3);
int i = 0;
arg4 = (char **) malloc((size+1)*sizeof(const char *));
for (i = 0; i < size; i++) {
PyObject *o = PyList_GetItem(obj3,i);
if (PyString_Check(o))
arg4[i] = PyString_AsString(PyList_GetItem(obj3,i));
else {
PyErr_SetString(PyExc_TypeError,"list must contain strings");
free(arg4);
return NULL;
}
arg4[i] = 0;
} else {
PyErr_SetString(PyExc_TypeError,"not a list");
return NULL;
}
arg4[i] = 0;
} else {
PyErr_SetString(PyExc_TypeError,"not a list");
return NULL;
}
result = (struct registry_key *)reg_import_hive_key(arg1,arg2,arg3,(char const **)arg4);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_registry_key, 0 | 0 );
{
free((char **) arg4);
}
free((char **) arg4);
return resultobj;
fail:
{
free((char **) arg4);
}
free((char **) arg4);
return NULL;
}
@ -3400,13 +3373,12 @@ SWIGINTERN PyObject *_wrap_reg_mount_hive__SWIG_1(PyObject *SWIGUNUSEDPARM(self)
}
arg3 = (char *)(buf3);
result = reg_mount_hive__SWIG_1(arg1,arg2,(char const *)arg3);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
return resultobj;
@ -3519,21 +3491,15 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
};
{
arg3 = NULL;
}
arg3 = NULL;
{
arg4 = NULL;
}
{
arg5 = loadparm_init(NULL);
}
{
arg1 = NULL;
}
{
arg6 = &tmp6;
}
arg1 = NULL;
arg6 = &tmp6;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
@ -3562,18 +3528,15 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg5 = (struct loadparm_context *)(argp5);
}
result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -3609,21 +3572,15 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
};
{
arg3 = NULL;
}
arg3 = NULL;
{
arg4 = NULL;
}
{
arg5 = loadparm_init(NULL);
}
{
arg1 = NULL;
}
{
arg6 = &tmp6;
}
arg1 = NULL;
arg6 = &tmp6;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
@ -3652,18 +3609,15 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg5 = (struct loadparm_context *)(argp5);
}
result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -3687,12 +3641,8 @@ SWIGINTERN PyObject *_wrap_create_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *
(char *) "location", NULL
};
{
arg1 = NULL;
}
{
arg3 = &tmp3;
}
arg1 = NULL;
arg3 = &tmp3;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:create_dir",kwnames,&obj0)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
@ -3700,18 +3650,15 @@ SWIGINTERN PyObject *_wrap_create_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *
}
arg2 = (char *)(buf2);
result = reg_create_directory(arg1,(char const *)arg2,arg3);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg3, SWIGTYPE_p_hive_key, 0);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg3, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -3735,12 +3682,8 @@ SWIGINTERN PyObject *_wrap_open_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
(char *) "location", NULL
};
{
arg1 = NULL;
}
{
arg3 = &tmp3;
}
arg1 = NULL;
arg3 = &tmp3;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:open_dir",kwnames,&obj0)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
@ -3748,18 +3691,15 @@ SWIGINTERN PyObject *_wrap_open_dir(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
}
arg2 = (char *)(buf2);
result = reg_open_directory(arg1,(char const *)arg2,arg3);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg3, SWIGTYPE_p_hive_key, 0);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg3, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -3793,18 +3733,12 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
{
arg3 = loadparm_init(NULL);
}
{
arg4 = NULL;
}
arg4 = NULL;
{
arg5 = NULL;
}
{
arg1 = NULL;
}
{
arg2 = &tmp2;
}
arg1 = NULL;
arg2 = &tmp2;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -3828,17 +3762,14 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
arg5 = (struct cli_credentials *)(argp5);
}
result = reg_open_samba(arg1,arg2,arg3,arg4,arg5);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
}
{
resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_registry_context, 0);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_registry_context, 0);
return resultobj;
fail:
return NULL;

View File

@ -40,11 +40,11 @@ class HiveTests(samba.tests.TestCaseInTempDir):
def test_ldb_new(self):
self.assertTrue(self.hive is not None)
def test_flush(self):
self.hive.flush()
#def test_flush(self):
# self.hive.flush()
def test_del_value(self):
self.hive.del_value("FOO")
#def test_del_value(self):
# self.hive.del_value("FOO")
class RegistryTests(unittest.TestCase):

View File

@ -19,7 +19,7 @@
/* Don't expose talloc contexts in Python code. Python does reference
counting for us, so just create a new top-level talloc context.
*/
%typemap(in, numinputs=0) TALLOC_CTX * {
%typemap(in, numinputs=0, noblock=1) TALLOC_CTX * {
$1 = NULL;
}

View File

@ -49,7 +49,7 @@ typedef TDB_CONTEXT tdb;
%import exception.i
%import stdint.i
%typemap(check) TDB_CONTEXT* {
%typemap(check,noblock=1) TDB_CONTEXT* {
if ($1 == NULL)
SWIG_exception(SWIG_ValueError,
"tdb context must be non-NULL");
@ -59,7 +59,7 @@ typedef TDB_CONTEXT tdb;
and from the Python string type which can contain arbitrary binary
data.. */
%typemap(in) TDB_DATA {
%typemap(in,noblock=1) TDB_DATA {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
@ -68,7 +68,7 @@ typedef TDB_CONTEXT tdb;
$1.dptr = (uint8_t *)PyString_AsString($input);
}
%typemap(out) TDB_DATA {
%typemap(out,noblock=1) TDB_DATA {
if ($1.dptr == NULL && $1.dsize == 0) {
$result = Py_None;
} else {
@ -115,23 +115,23 @@ enum TDB_ERROR {
%rename(read_lock_all) tdb_context::lockall_read;
%rename(read_unlock_all) tdb_context::unlockall_read;
%typemap(default) int tdb_flags {
%typemap(default,noblock=1) int tdb_flags {
$1 = TDB_DEFAULT;
}
%typemap(default) int open_flags {
%typemap(default,noblock=1) int open_flags {
$1 = O_RDWR;
}
%typemap(default) int hash_size {
%typemap(default,noblock=1) int hash_size {
$1 = 0;
}
%typemap(default) mode_t mode {
%typemap(default,noblock=1) mode_t mode {
$1 = 0600;
}
%typemap(default) int flag {
%typemap(default,noblock=1) int flag {
$1 = TDB_REPLACE;
}

View File

@ -2831,18 +2831,10 @@ SWIGINTERN PyObject *_wrap_new_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
(char *) "name",(char *) "hash_size",(char *) "tdb_flags",(char *) "open_flags",(char *) "mode", NULL
};
{
arg2 = 0;
}
{
arg3 = TDB_DEFAULT;
}
{
arg4 = O_RDWR;
}
{
arg5 = 0600;
}
arg2 = 0;
arg3 = TDB_DEFAULT;
arg4 = O_RDWR;
arg5 = 0600;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:new_Tdb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
if (!SWIG_IsOK(res1)) {
@ -2977,22 +2969,18 @@ SWIGINTERN PyObject *_wrap_tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_append" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
{
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
{
if (!PyString_Check(obj2)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg3)->dsize = PyString_Size(obj2);
(&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj2)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg3)->dsize = PyString_Size(obj2);
(&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
result = (int)tdb_append(arg1,arg2,arg3);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@ -3043,22 +3031,18 @@ SWIGINTERN PyObject *_wrap_tdb_fetch(PyObject *SWIGUNUSEDPARM(self), PyObject *a
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_fetch" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
{
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = tdb_fetch(arg1,arg2);
{
if ((&result)->dptr == NULL && (&result)->dsize == 0) {
resultobj = Py_None;
} else {
resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
free((&result)->dptr);
}
if ((&result)->dptr == NULL && (&result)->dsize == 0) {
resultobj = Py_None;
} else {
resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
free((&result)->dptr);
}
return resultobj;
fail:
@ -3085,14 +3069,12 @@ SWIGINTERN PyObject *_wrap_tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_delete" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
{
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = (int)tdb_delete(arg1,arg2);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@ -3120,31 +3102,25 @@ SWIGINTERN PyObject *_wrap_tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *a
(char *) "self",(char *) "key",(char *) "dbuf",(char *) "flag", NULL
};
{
arg4 = TDB_REPLACE;
}
arg4 = TDB_REPLACE;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_store" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
{
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
{
if (!PyString_Check(obj2)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg3)->dsize = PyString_Size(obj2);
(&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj2)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg3)->dsize = PyString_Size(obj2);
(&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
if (obj3) {
ecode4 = SWIG_AsVal_int(obj3, &val4);
if (!SWIG_IsOK(ecode4)) {
@ -3179,14 +3155,12 @@ SWIGINTERN PyObject *_wrap_tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_exists" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
{
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = (int)tdb_exists(arg1,arg2);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@ -3211,13 +3185,11 @@ SWIGINTERN PyObject *_wrap_tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject
}
arg1 = (tdb *)(argp1);
result = tdb_firstkey(arg1);
{
if ((&result)->dptr == NULL && (&result)->dsize == 0) {
resultobj = Py_None;
} else {
resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
free((&result)->dptr);
}
if ((&result)->dptr == NULL && (&result)->dsize == 0) {
resultobj = Py_None;
} else {
resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
free((&result)->dptr);
}
return resultobj;
fail:
@ -3244,22 +3216,18 @@ SWIGINTERN PyObject *_wrap_tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "tdb_nextkey" "', argument " "1"" of type '" "tdb *""'");
}
arg1 = (tdb *)(argp1);
{
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
if (!PyString_Check(obj1)) {
PyErr_SetString(PyExc_TypeError, "string arg expected");
return NULL;
}
(&arg2)->dsize = PyString_Size(obj1);
(&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
result = tdb_nextkey(arg1,arg2);
{
if ((&result)->dptr == NULL && (&result)->dsize == 0) {
resultobj = Py_None;
} else {
resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
free((&result)->dptr);
}
if ((&result)->dptr == NULL && (&result)->dsize == 0) {
resultobj = Py_None;
} else {
resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
free((&result)->dptr);
}
return resultobj;
fail:

View File

@ -2802,9 +2802,7 @@ SWIGINTERN PyObject *_wrap_new_SecurityToken(PyObject *SWIGUNUSEDPARM(self), PyO
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
security_token *result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"new_SecurityToken",0,0,0)) SWIG_fail;
result = (security_token *)new_security_token(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_security_token, SWIG_POINTER_NEW | 0 );
@ -3080,9 +3078,7 @@ SWIGINTERN PyObject *_wrap_new_security_descriptor(PyObject *SWIGUNUSEDPARM(self
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
security_descriptor *result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"new_security_descriptor",0,0,0)) SWIG_fail;
result = (security_descriptor *)new_security_descriptor(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_security_descriptor, SWIG_POINTER_NEW | 0 );
@ -3119,13 +3115,12 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_add(PyObject *SWIGUNUSEDPARM
}
arg2 = (struct security_ace *)(argp2);
result = security_descriptor_sacl_add(arg1,(struct security_ace const *)arg2);
{
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
return resultobj;
fail:
@ -3160,13 +3155,12 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_add(PyObject *SWIGUNUSEDPARM
}
arg2 = (struct security_ace *)(argp2);
result = security_descriptor_dacl_add(arg1,(struct security_ace const *)arg2);
{
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
return resultobj;
fail:
@ -3201,13 +3195,12 @@ SWIGINTERN PyObject *_wrap_security_descriptor_dacl_del(PyObject *SWIGUNUSEDPARM
}
arg2 = (struct security_ace *)(argp2);
result = security_descriptor_dacl_del(arg1,(struct security_ace const *)arg2);
{
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
return resultobj;
fail:
@ -3242,13 +3235,12 @@ SWIGINTERN PyObject *_wrap_security_descriptor_sacl_del(PyObject *SWIGUNUSEDPARM
}
arg2 = (struct security_ace *)(argp2);
result = security_descriptor_sacl_del(arg1,(struct security_ace const *)arg2);
{
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (NT_STATUS_IS_ERR(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
return resultobj;
fail:
@ -3337,9 +3329,7 @@ SWIGINTERN PyObject *_wrap_new_Sid(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
(char *) "text", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:new_Sid",kwnames,&obj0)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
@ -3365,9 +3355,7 @@ SWIGINTERN PyObject *_wrap_Sid___str__(PyObject *SWIGUNUSEDPARM(self), PyObject
int res1 = 0 ;
PyObject *swig_obj[1] ;
{
arg2 = NULL;
}
arg2 = NULL;
if (!args) SWIG_fail;
swig_obj[0] = args;
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_dom_sid, 0 | 0 );
@ -3456,9 +3444,7 @@ SWIGINTERN PyObject *_wrap_random_sid(PyObject *SWIGUNUSEDPARM(self), PyObject *
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
struct dom_sid *result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"random_sid",0,0,0)) SWIG_fail;
result = (struct dom_sid *)random_sid(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_dom_sid, 0 | 0 );

View File

@ -18,7 +18,7 @@
*/
#ifdef SWIGPYTHON
%typemap(out) WERROR {
%typemap(out,noblock=1) WERROR {
if (!W_ERROR_IS_OK($1)) {
PyObject *obj = Py_BuildValue("(i,s)", $1.v, win_errstr($1));
PyErr_SetObject(PyExc_RuntimeError, obj);
@ -28,7 +28,7 @@
}
};
%typemap(out) NTSTATUS {
%typemap(out,noblock=1) NTSTATUS {
if (NT_STATUS_IS_ERR($1)) {
PyObject *obj = Py_BuildValue("(i,s)", $1.v, nt_errstr($1));
PyErr_SetObject(PyExc_RuntimeError, obj);
@ -38,7 +38,7 @@
}
};
%typemap(in) NTSTATUS {
%typemap(in,noblock=1) NTSTATUS {
if (PyLong_Check($input))
$1 = NT_STATUS(PyLong_AsUnsignedLong($input));
else if (PyInt_Check($input))

View File

@ -44,11 +44,11 @@
%include "../../lib/talloc/talloc.i"
%include "../../auth/credentials/credentials.i"
%typemap(in, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
%typemap(in,noblock=1, numinputs=0) struct dcerpc_pipe **OUT (struct dcerpc_pipe *temp_dcerpc_pipe) {
$1 = &temp_dcerpc_pipe;
}
%typemap(argout) struct dcerpc_pipe ** {
%typemap(argout,noblock=1) struct dcerpc_pipe ** {
/* Set REF_ALLOC flag so we don't have to do too much extra
mucking around with ref variables in ndr unmarshalling. */
@ -71,7 +71,7 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
struct cli_credentials *credentials,
struct loadparm_context *lp_ctx);
%typemap(in) DATA_BLOB * (DATA_BLOB temp_data_blob) {
%typemap(in,noblock=1) DATA_BLOB * (DATA_BLOB temp_data_blob) {
temp_data_blob.data = PyString_AsString($input);
temp_data_blob.length = PyString_Size($input);
$1 = &temp_data_blob;
@ -83,16 +83,16 @@ const char *dcerpc_server_name(struct dcerpc_pipe *p);
also be done using the uint32 carray functions, but it's a bit of a
hassle. TODO: Fix memory leak here. */
%typemap(in) uint32_t *resume_handle {
%typemap(in,noblock=1) uint32_t *resume_handle {
$1 = malloc(sizeof(*$1));
*$1 = PyLong_AsLong($input);
}
%typemap(out) uint32_t *resume_handle {
%typemap(out,noblock=1) uint32_t *resume_handle {
$result = PyLong_FromLong(*$1);
}
%typemap(in) struct policy_handle * {
%typemap(in,noblock=1) struct policy_handle * {
if ((SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor,
SWIG_POINTER_EXCEPTION)) == -1)
@ -108,7 +108,7 @@ const char *dcerpc_server_name(struct dcerpc_pipe *p);
as the talloc context it is created under is destroyed after the
wrapper function returns. TODO: Fix memory leak created here. */
%typemap(out) struct policy_handle * {
%typemap(out,noblock=1) struct policy_handle * {
if ($1) {
struct policy_handle *temp = (struct policy_handle *)malloc(sizeof(struct policy_handle));
memcpy(temp, $1, sizeof(struct policy_handle));

View File

@ -57,6 +57,7 @@ def _swig_setattr_nondynamic_method(set):
return set_attr
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

View File

@ -2461,11 +2461,22 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_char swig_types[2]
#define SWIGTYPE_p_cli_credentials swig_types[3]
#define SWIGTYPE_p_dcerpc_pipe swig_types[4]
#define SWIGTYPE_p_loadparm_context swig_types[5]
#define SWIGTYPE_p_p_dcerpc_pipe swig_types[6]
#define SWIGTYPE_p_uint32_t swig_types[7]
static swig_type_info *swig_types[9];
static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
#define SWIGTYPE_p_int swig_types[5]
#define SWIGTYPE_p_loadparm_context swig_types[6]
#define SWIGTYPE_p_loadparm_service swig_types[7]
#define SWIGTYPE_p_long_long swig_types[8]
#define SWIGTYPE_p_p_dcerpc_pipe swig_types[9]
#define SWIGTYPE_p_param_context swig_types[10]
#define SWIGTYPE_p_param_opt swig_types[11]
#define SWIGTYPE_p_param_section swig_types[12]
#define SWIGTYPE_p_short swig_types[13]
#define SWIGTYPE_p_signed_char swig_types[14]
#define SWIGTYPE_p_unsigned_char swig_types[15]
#define SWIGTYPE_p_unsigned_int swig_types[16]
#define SWIGTYPE_p_unsigned_long_long swig_types[17]
#define SWIGTYPE_p_unsigned_short swig_types[18]
static swig_type_info *swig_types[20];
static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2528,6 +2539,7 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
#include "includes.h"
#include "auth/credentials/credentials.h"
#include "param/param.h"
typedef struct cli_credentials cli_credentials;
@ -2536,7 +2548,6 @@ typedef struct cli_credentials cli_credentials;
SWIGINTERN cli_credentials *new_cli_credentials(){
return cli_credentials_init(NULL);
}
SWIGINTERN void delete_cli_credentials(cli_credentials *self){ talloc_free(self); }
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
@ -2781,6 +2792,67 @@ SWIGINTERNINLINE PyObject*
return PyBool_FromLong(value ? 1 : 0);
}
SWIGINTERN void delete_cli_credentials(cli_credentials *self){ talloc_free(self); }
SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
{
if (PyInt_Check(obj)) {
long v = PyInt_AsLong(obj);
if (v >= 0) {
if (val) *val = v;
return SWIG_OK;
} else {
return SWIG_OverflowError;
}
} else if (PyLong_Check(obj)) {
unsigned long v = PyLong_AsUnsignedLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_OK;
} else {
PyErr_Clear();
}
}
#ifdef SWIG_PYTHON_CAST_MODE
{
int dispatch = 0;
unsigned long v = PyLong_AsUnsignedLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_AddCast(SWIG_OK);
} else {
PyErr_Clear();
}
if (!dispatch) {
double d;
int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
if (val) *val = (unsigned long)(d);
return res;
}
}
}
#endif
return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
{
unsigned long v;
int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
if (SWIG_IsOK(res)) {
if ((v > UINT_MAX)) {
return SWIG_OverflowError;
} else {
if (val) *val = (unsigned int)(v);
}
}
return res;
}
#ifdef __cplusplus
extern "C" {
#endif
@ -2797,36 +2869,6 @@ fail:
}
SWIGINTERN PyObject *_wrap_delete_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
cli_credentials *arg1 = (cli_credentials *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char * kwnames[] = {
(char *) "self", NULL
};
{
arg1 = NULL;
}
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:delete_Credentials",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Credentials" "', argument " "1"" of type '" "cli_credentials *""'");
}
arg1 = (cli_credentials *)(argp1);
}
delete_cli_credentials(arg1);
resultobj = SWIG_Py_Void();
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 ;
@ -2838,9 +2880,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_username(PyObject *SWIGUNUSEDPARM(sel
(char *) "self", NULL
};
{
arg1 = 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 );
@ -2877,9 +2917,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_username(PyObject *SWIGUNUSEDPARM(sel
(char *) "self",(char *) "value",(char *)"arg3", NULL
};
{
arg1 = 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 );
@ -2923,9 +2961,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_password(PyObject *SWIGUNUSEDPARM(sel
(char *) "self", NULL
};
{
arg1 = 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 );
@ -2962,9 +2998,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_password(PyObject *SWIGUNUSEDPARM(sel
(char *) "self",(char *) "val",(char *)"arg3", NULL
};
{
arg1 = 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 );
@ -3008,9 +3042,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_domain(PyObject *SWIGUNUSEDPARM(self)
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_domain",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3047,9 +3079,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_domain(PyObject *SWIGUNUSEDPARM(self)
(char *) "self",(char *) "val",(char *)"arg3", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_domain",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3093,9 +3123,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_realm(PyObject *SWIGUNUSEDPARM(self),
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_realm",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3132,9 +3160,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_realm(PyObject *SWIGUNUSEDPARM(self),
(char *) "self",(char *) "val",(char *)"arg3", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_realm",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3186,9 +3212,7 @@ SWIGINTERN PyObject *_wrap_Credentials_parse_string(PyObject *SWIGUNUSEDPARM(sel
(char *) "self",(char *) "text",(char *)"arg3", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_parse_string",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3232,9 +3256,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_bind_dn(PyObject *SWIGUNUSEDPARM(self
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_bind_dn",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3267,9 +3289,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_bind_dn(PyObject *SWIGUNUSEDPARM(self
(char *) "self",(char *) "bind_dn", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_set_bind_dn",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3306,9 +3326,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_workstation(PyObject *SWIGUNUSEDPARM(
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_workstation",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3345,9 +3363,7 @@ SWIGINTERN PyObject *_wrap_Credentials_set_workstation(PyObject *SWIGUNUSEDPARM(
(char *) "self",(char *) "workstation",(char *) "obtained", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:Credentials_set_workstation",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3383,7 +3399,7 @@ fail:
SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
cli_credentials *arg1 = (cli_credentials *) 0 ;
struct loadparm_context *arg2 = (struct loadparm_context *) NULL ;
struct loadparm_context *arg2 = (struct loadparm_context *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
@ -3394,9 +3410,8 @@ SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyO
(char *) "self",(char *) "lp_ctx", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
arg2 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_guess",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3431,9 +3446,7 @@ SWIGINTERN PyObject *_wrap_Credentials_is_anonymous(PyObject *SWIGUNUSEDPARM(sel
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_is_anonymous",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3462,12 +3475,8 @@ SWIGINTERN PyObject *_wrap_Credentials_get_nt_hash(PyObject *SWIGUNUSEDPARM(self
(char *) "self", NULL
};
{
arg1 = NULL;
}
{
arg2 = NULL;
}
arg1 = NULL;
arg2 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_get_nt_hash",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3477,9 +3486,7 @@ SWIGINTERN PyObject *_wrap_Credentials_get_nt_hash(PyObject *SWIGUNUSEDPARM(self
arg1 = (cli_credentials *)(argp1);
}
result = (struct samr_Password *)cli_credentials_get_nt_hash(arg1,arg2);
{
resultobj = PyString_FromStringAndSize(result->hash, 16);
}
resultobj = PyString_FromStringAndSize(result->hash, 16);
return resultobj;
fail:
return NULL;
@ -3497,9 +3504,7 @@ SWIGINTERN PyObject *_wrap_Credentials_authentication_requested(PyObject *SWIGUN
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_authentication_requested",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3527,9 +3532,7 @@ SWIGINTERN PyObject *_wrap_Credentials_wrong_password(PyObject *SWIGUNUSEDPARM(s
(char *) "self", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:Credentials_wrong_password",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
@ -3546,6 +3549,34 @@ fail:
}
SWIGINTERN PyObject *_wrap_delete_Credentials(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
cli_credentials *arg1 = (cli_credentials *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
char * kwnames[] = {
(char *) "self", NULL
};
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:delete_Credentials",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Credentials" "', argument " "1"" of type '" "cli_credentials *""'");
}
arg1 = (cli_credentials *)(argp1);
}
delete_cli_credentials(arg1);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *Credentials_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
@ -3574,8 +3605,8 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
void *argp5 ;
int res5 = 0 ;
unsigned int val5 ;
int ecode5 = 0 ;
void *argp6 = 0 ;
int res6 = 0 ;
void *argp7 = 0 ;
@ -3589,15 +3620,10 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject
(char *) "binding",(char *) "pipe_uuid",(char *) "pipe_version",(char *) "credentials",(char *) "lp_ctx", NULL
};
{
arg6 = NULL;
}
{
arg1 = NULL;
}
{
arg2 = &temp_dcerpc_pipe2;
}
arg6 = NULL;
arg7 = loadparm_init(NULL);
arg1 = NULL;
arg2 = &temp_dcerpc_pipe2;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|OO:pipe_connect",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res3 = SWIG_AsCharPtrAndSize(obj0, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
@ -3609,17 +3635,11 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "pipe_connect" "', argument " "4"" of type '" "char const *""'");
}
arg4 = (char *)(buf4);
{
res5 = SWIG_ConvertPtr(obj2, &argp5, SWIGTYPE_p_uint32_t, 0 );
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "pipe_connect" "', argument " "5"" of type '" "uint32_t""'");
}
if (!argp5) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "pipe_connect" "', argument " "5"" of type '" "uint32_t""'");
} else {
arg5 = *((uint32_t *)(argp5));
}
ecode5 = SWIG_AsVal_unsigned_SS_int(obj2, &val5);
if (!SWIG_IsOK(ecode5)) {
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "pipe_connect" "', argument " "5"" of type '" "uint32_t""'");
}
arg5 = (uint32_t)(val5);
if (obj3) {
res6 = SWIG_ConvertPtr(obj3, &argp6,SWIGTYPE_p_cli_credentials, 0 | 0 );
if (!SWIG_IsOK(res6)) {
@ -3636,16 +3656,14 @@ SWIGINTERN PyObject *_wrap_pipe_connect(PyObject *SWIGUNUSEDPARM(self), PyObject
}
result = dcerpc_pipe_connect(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
resultobj = SWIG_NewPointerObj((NTSTATUS *)memcpy((NTSTATUS *)malloc(sizeof(NTSTATUS)),&result,sizeof(NTSTATUS)), SWIGTYPE_p_NTSTATUS, SWIG_POINTER_OWN | 0 );
{
/* Set REF_ALLOC flag so we don't have to do too much extra
mucking around with ref variables in ndr unmarshalling. */
/* Set REF_ALLOC flag so we don't have to do too much extra
mucking around with ref variables in ndr unmarshalling. */
(*arg2)->conn->flags |= DCERPC_NDR_REF_ALLOC;
(*arg2)->conn->flags |= DCERPC_NDR_REF_ALLOC;
/* Return swig handle on dcerpc_pipe */
/* Return swig handle on dcerpc_pipe */
resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_dcerpc_pipe, 0);
}
resultobj = SWIG_NewPointerObj(*arg2, SWIGTYPE_p_dcerpc_pipe, 0);
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
return resultobj;
@ -3683,7 +3701,6 @@ fail:
static PyMethodDef SwigMethods[] = {
{ (char *)"new_Credentials", (PyCFunction)_wrap_new_Credentials, METH_NOARGS, NULL},
{ (char *)"delete_Credentials", (PyCFunction) _wrap_delete_Credentials, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_get_username", (PyCFunction) _wrap_Credentials_get_username, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_set_username", (PyCFunction) _wrap_Credentials_set_username, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_get_password", (PyCFunction) _wrap_Credentials_get_password, METH_VARARGS | METH_KEYWORDS, NULL},
@ -3702,6 +3719,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_authentication_requested", (PyCFunction) _wrap_Credentials_authentication_requested, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_wrong_password", (PyCFunction) _wrap_Credentials_wrong_password, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"delete_Credentials", (PyCFunction) _wrap_delete_Credentials, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_swigregister", Credentials_swigregister, METH_VARARGS, NULL},
{ (char *)"Credentials_swiginit", Credentials_swiginit, METH_VARARGS, NULL},
{ (char *)"pipe_connect", (PyCFunction) _wrap_pipe_connect, METH_VARARGS | METH_KEYWORDS, NULL},
@ -3717,9 +3735,20 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 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 *|cli_credentials *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_dcerpc_pipe = {"_p_dcerpc_pipe", "struct dcerpc_pipe *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *", 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_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_dcerpc_pipe = {"_p_p_dcerpc_pipe", "struct dcerpc_pipe **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_NTSTATUS,
@ -3727,9 +3756,20 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_char,
&_swigt__p_cli_credentials,
&_swigt__p_dcerpc_pipe,
&_swigt__p_int,
&_swigt__p_loadparm_context,
&_swigt__p_loadparm_service,
&_swigt__p_long_long,
&_swigt__p_p_dcerpc_pipe,
&_swigt__p_uint32_t,
&_swigt__p_param_context,
&_swigt__p_param_opt,
&_swigt__p_param_section,
&_swigt__p_short,
&_swigt__p_signed_char,
&_swigt__p_unsigned_char,
&_swigt__p_unsigned_int,
&_swigt__p_unsigned_long_long,
&_swigt__p_unsigned_short,
};
static swig_cast_info _swigc__p_NTSTATUS[] = { {&_swigt__p_NTSTATUS, 0, 0, 0},{0, 0, 0, 0}};
@ -3737,9 +3777,20 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0,
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_cli_credentials[] = { {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_dcerpc_pipe[] = { {&_swigt__p_dcerpc_pipe, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_dcerpc_pipe[] = { {&_swigt__p_p_dcerpc_pipe, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_NTSTATUS,
@ -3747,9 +3798,20 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_char,
_swigc__p_cli_credentials,
_swigc__p_dcerpc_pipe,
_swigc__p_int,
_swigc__p_loadparm_context,
_swigc__p_loadparm_service,
_swigc__p_long_long,
_swigc__p_p_dcerpc_pipe,
_swigc__p_uint32_t,
_swigc__p_param_context,
_swigc__p_param_opt,
_swigc__p_param_section,
_swigc__p_short,
_swigc__p_signed_char,
_swigc__p_unsigned_char,
_swigc__p_unsigned_int,
_swigc__p_unsigned_long_long,
_swigc__p_unsigned_short,
};

View File

@ -38,7 +38,7 @@ typedef struct param_opt param_opt;
%import "typemaps.i"
%import "../lib/talloc/talloc.i"
%typemap(default) struct loadparm_context * {
%typemap(default,noblock=1) struct loadparm_context * {
$1 = loadparm_init(NULL);
}

View File

@ -2762,9 +2762,7 @@ SWIGINTERN PyObject *_wrap_new_LoadParm(PyObject *SWIGUNUSEDPARM(self), PyObject
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
loadparm_context *result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"new_LoadParm",0,0,0)) SWIG_fail;
result = (loadparm_context *)new_loadparm_context(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_loadparm_context, SWIG_POINTER_NEW | 0 );
@ -2790,9 +2788,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_load(PyObject *SWIGUNUSEDPARM(self), PyObjec
(char *) "self",(char *) "filename", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:LoadParm_load",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2829,9 +2825,7 @@ SWIGINTERN PyObject *_wrap_LoadParm___len__(PyObject *SWIGUNUSEDPARM(self), PyOb
(char *) "self", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:LoadParm___len__",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2864,9 +2858,7 @@ SWIGINTERN PyObject *_wrap_LoadParm___getitem__(PyObject *SWIGUNUSEDPARM(self),
(char *) "self",(char *) "name", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:LoadParm___getitem__",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2903,9 +2895,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_configfile(PyObject *SWIGUNUSEDPARM(self), P
(char *) "self", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:LoadParm_configfile",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2938,9 +2928,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_is_mydomain(PyObject *SWIGUNUSEDPARM(self),
(char *) "self",(char *) "domain", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:LoadParm_is_mydomain",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -2982,9 +2970,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_is_myname(PyObject *SWIGUNUSEDPARM(self), Py
(char *) "self",(char *) "name", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:LoadParm_is_myname",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -3025,9 +3011,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_use(PyObject *SWIGUNUSEDPARM(self), PyObject
(char *) "self",(char *) "param", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:LoadParm_use",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -3072,9 +3056,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_set(PyObject *SWIGUNUSEDPARM(self), PyObject
(char *) "self",(char *) "parm_name",(char *) "parm_value", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:LoadParm_set",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -3130,9 +3112,7 @@ SWIGINTERN PyObject *_wrap_LoadParm_get(PyObject *SWIGUNUSEDPARM(self), PyObject
(char *) "self",(char *) "param_name",(char *) "service_name", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:LoadParm_get",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 | 0 );
@ -3177,9 +3157,7 @@ SWIGINTERN PyObject *_wrap_delete_LoadParm(PyObject *SWIGUNUSEDPARM(self), PyObj
(char *) "self", NULL
};
{
arg1 = loadparm_init(NULL);
}
arg1 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:delete_LoadParm",kwnames,&obj0)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, SWIG_POINTER_DISOWN | 0 );
@ -3289,9 +3267,7 @@ SWIGINTERN PyObject *_wrap_new_ParamFile(PyObject *SWIGUNUSEDPARM(self), PyObjec
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
param *result = 0 ;
{
arg1 = NULL;
}
arg1 = NULL;
if (!SWIG_Python_UnpackTuple(args,"new_ParamFile",0,0,0)) SWIG_fail;
result = (param *)new_param(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_param_context, SWIG_POINTER_NEW | 0 );

View File

@ -33,3 +33,4 @@ RPC-NETLOGON.*.GetPassword
RPC-NETLOGON.*.GetTrustPasswords
BASE-CHARSET.*.Testing partial surrogate
.*NET-API-DELSHARE.* # DelShare isn't implemented yet
ldap.python # Conversion not finished yet

View File

@ -1,234 +1,157 @@
#!/bin/sh
exec smbscript "$0" ${1+"$@"}
/*
Dump Samba3 data
Copyright Jelmer Vernooij 2005
Released under the GNU GPL v2 or later
*/
#!/usr/bin/python
#
# Dump Samba3 data
# Copyright Jelmer Vernooij 2005-2007
# Released under the GNU GPL v3 or later
#
options = GetOptions(ARGV,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"POPT_COMMON_VERSION",
'format=s',
'quiet', 'blank');
import optparse
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../python"))
import samba
import samba.samba3
if (options == undefined) {
println("Failed to parse options");
return -1;
}
parser = optparse.OptionParser("provision <libdir> <smb.conf>")
parser.add_option("--format", type="choice", metavar="FORMAT",
choices=["full", "summary"])
if (options.format == undefined) {
options.format = "summary";
}
opts, args = parser.parse_args()
if (options.format != "summary" && options.format != "full") {
printf("Unknown format %s\n", options.format);
return -1;
}
if opts.format is None:
opts.format = "summary"
libinclude("base.js");
def print_header(txt):
print "\n%s" % txt
print "=========================================="
if (options.ARGV.length != 2) {
println("Usage: samba3dump <libdir> <smb.conf>");
return -1;
}
def print_samba3_policy(pol):
print_header("Account Policies")
print "Min password length: %d" % pol.min_password_length
print "Password history length: %d" % pol.password_history
print "User must logon to change password: %d" % pol.user_must_logon_to_change_password
print "Maximum password age: %d" % pol.maximum_password_age
print "Minimum password age: %d" % pol.minimum_password_age
print "Lockout duration: %d" % pol.lockout_duration
print "Reset Count Minutes: %d" % pol.reset_count_minutes
print "Bad Lockout Minutes: %d" % pol.bad_lockout_minutes
print "Disconnect Time: %d" % pol.disconnect_time
print "Refuse Machine Password Change: %d" % pol.refuse_machine_password_change
function print_header(txt)
{
printf("\n%s\n", txt);
println("==========================================");
}
def print_samba3_sam(samba3):
print_header("SAM Database")
function print_samba3_policy(pol)
{
print_header("Account Policies");
printf("Min password length: %d\n", pol.min_password_length);
printf("Password history length: %d\n", pol.password_history);
printf("User must logon to change password: %d\n", pol.user_must_logon_to_change_password);
printf("Maximum password age: %d\n", pol.maximum_password_age);
printf("Minimum password age: %d\n", pol.minimum_password_age);
printf("Lockout duration: %d\n", pol.lockout_duration);
printf("Reset Count Minutes: %d\n", pol.reset_count_minutes);
printf("Bad Lockout Minutes: %d\n", pol.bad_lockout_minutes);
printf("Disconnect Time: %d\n", pol.disconnect_time);
printf("Refuse Machine Password Change: %d\n", pol.refuse_machine_password_change);
}
for a in samba3.samaccounts:
print "%d: %s" % a.user_rid, a.username
function print_samba3_sam(samba3)
{
var i;
print_header("SAM Database");
def print_samba3_shares(samba3):
print_header("Configured shares")
for s in samba3.shares:
print "--- %s ---" % s.name
for (i in samba3.samaccounts) {
var a = samba3.samaccounts[i];
printf("%d: %s\n", a.user_rid, a.username);
}
}
for p in s.parameters:
print "\t%s = %s" % (p.name, p.value)
function print_samba3_shares(samba3)
{
var i, j;
print_header("Configured shares");
for (i in samba3.shares) {
var s = samba3.shares[i];
printf("--- %s ---\n", s.name);
print ""
for (j in s.parameters) {
var p = s.parameters[j];
printf("\t%s = %s\n", p.name, p.value);
}
def print_samba3_secrets(secrets):
print_header("Secrets")
println("");
}
}
print "IPC Credentials:"
if secrets.ipc_cred.username_obtained:
print " User: %s\n" % secrets.ipc_cred.get_username
if secrets.ipc_cred.password_obtained:
print " Password: %s\n" % secrets.ipc_cred.get_password
function print_samba3_secrets(secrets)
{
var i;
print_header("Secrets");
if secrets.ipc_cred.domain_obtained:
print " Domain: %s\n" % secrets.ipc_cred.get_domain
println("IPC Credentials:");
if (secrets.ipc_cred.username_obtained)
printf(" User: %s\n", secrets.ipc_cred.get_username);
if (secrets.ipc_cred.password_obtained)
printf(" Password: %s\n", secrets.ipc_cred.get_password);
print "LDAP passwords:"
for pw in secrets.ldappws:
print "\t%s -> %s" % (pw.dn, pw.password)
print ""
if (secrets.ipc_cred.domain_obtained)
printf(" Domain: %s\n\n", secrets.ipc_cred.get_domain);
print "Domains:"
for d in secrets.domains:
print "\t--- %s ---" % d.name
print "\tSID: %s" % d.sid
print "\tGUID: %s" % d.guid
print "\tPlaintext pwd: %s" % d.plaintext_pw
print "\tLast Changed: %lu" % d.last_change_time
print "\tSecure Channel Type: %d\n" % d.sec_channel_type
println("LDAP passwords:");
for (i in secrets.ldappws) {
var pw = secrets.ldappws[i];
printf("\t%s -> %s\n", pw.dn, pw.password);
}
println("");
print "Trusted domains:"
for td in secrets.trusted_domains:
for n in td.uni_name:
print "\t--- %s ---" % n
print "\tPassword: %s" % td.password
print "\tModified: %lu" % td.mod_time
print "\tSID: %s" % td.domain_sid
println("Domains:");
for (i in secrets.domains) {
var d = secrets.domains[i];
printf("\t--- %s ---\n", d.name);
printf("\tSID: %s\n", d.sid);
printf("\tGUID: %s\n", d.guid);
printf("\tPlaintext pwd: %s\n", d.plaintext_pw);
printf("\tLast Changed: %lu\n", d.last_change_time);
printf("\tSecure Channel Type: %d\n\n", d.sec_channel_type);
}
def print_samba3_regdb(regdb):
print_header("Registry")
println("Trusted domains:");
for (i in secrets.trusted_domains) {
var td = secrets.trusted_domains[i];
for (j = 0; j < td.uni_name_len; j++) {
printf("\t--- %s ---\n", td.uni_name[j]);
}
printf("\tPassword: %s\n", td.pass);
printf("\tModified: %lu\n", td.mod_time);
printf("\tSID: %s\n", td.domain_sid);
}
}
for k in regdb.keys:
print "%s\n" % k.name
for v in regdb.values(k):
print "\t%s: type %d, length %d" % (v.name, v.type, v.data.length)
function print_samba3_regdb(regdb)
{
var i, j;
print_header("Registry");
def print_samba3_winsdb(samba3):
print_header("WINS Database")
for (i in regdb.keys) {
var k = regdb.keys[i];
printf("%s\n", k.name);
for (j in k.values) {
var v = k.values[j];
printf("\t%s: type %d, length %d\n", v.name, v.type, v.data.length);
}
}
}
for e in samba3.winsentries:
print "%s, nb_flags: %x, type: %d, ttl: %lu, %d ips, fst: %s" % (e.name, e.nb_flags, e.type, e.ttl, e.ips.length, e.ips[0])
function print_samba3_winsdb(samba3)
{
var i;
print_header("WINS Database");
def print_samba3_groupmappings(groupdb):
print_header("Group Mappings")
for (i in samba3.winsentries) {
var e = samba3.winsentries[i];
printf("%s, nb_flags: %x, type: %d, ttl: %lu, %d ips, fst: %s\n", e.name, e.nb_flags, e.type, e.ttl, e.ips.length, e.ips[0]);
}
}
for g in groupdb.groupmappings:
print "\t--- Group: %s ---" % g.nt_name
print "\tComment: %s" % g.comment
print "\tGID: %d" % g.gid
print "\tSID Name Use: %d" % g.sid_name_use
print "\tSID: %s\n" % g.sid
function print_samba3_groupmappings(groupdb)
{
print_header("Group Mappings");
def print_samba3_aliases(groupdb):
for a in groupdb.aliases:
print "\t--- Alias: %s ---" % a.sid
for m in a.members:
print "\t%s" % m
for (var i in groupdb.groupmappings) {
var g = groupdb.groupmappings[i];
printf("\t--- Group: %s ---\n", g.nt_name);
printf("\tComment: %s\n", g.comment);
printf("\tGID: %d\n", g.gid);
printf("\tSID Name Use: %d\n", g.sid_name_use);
printf("\tSID: %s\n\n", g.sid);
}
}
def print_samba3_idmapdb(idmapdb):
print_header("Winbindd SID<->GID/UID mappings")
function print_samba3_aliases(groupdb)
{
var i, j;
for (i in groupdb.aliases) {
var a = groupdb.aliases[i];
printf("\t--- Alias: %s ---\n", a.sid);
for (j in a.members) {
printf("\t%s\n", a.members[j]);
}
}
}
print "User High Water Mark: %d" % idmapdb.user_hwm
print "Group High Water Mark: %d\n" % idmapdb.group_hwm
function print_samba3_idmapdb(idmapdb)
{
var i;
print_header("Winbindd SID<->GID/UID mappings");
for e in idmapdb.mappings:
if e.type == e.IDMAP_GROUP:
print "%s -> GID %d" % (e.sid, e.unix_id)
else:
print "%s -> UID %d" % (e.sid, e.unix_id)
printf("User High Water Mark: %d\n", idmapdb.user_hwm);
printf("Group High Water Mark: %d\n\n", idmapdb.group_hwm);
def print_samba3(samba3):
print_samba3_sam(samba3)
print_samba3_policy(samba3.get_policy_db())
print_samba3_shares(samba3)
print_samba3_winsdb(samba3.get_wins_db())
print_samba3_regdb(samba3.get_registry())
print_samba3_secrets(samba3.get_secrets_db())
print_samba3_groupmappings(samba3.get_groupmapping_db())
print_samba3_aliases(samba3)
print_samba3_idmapdb(samba3.get_idmap_db())
for (i in idmapdb.mappings) {
var e = idmapdb.mappings[i];
printf("%s -> ", e.sid);
def print_samba3_summary(samba3):
print "WINS db entries: %d" % len(samba3.winsentries)
print "SAM Accounts: %d" % len(samba3.samaccounts)
print "Registry key count: %d" % len(samba3.registry.keys)
print "Shares (including [global]): %d" % len(samba3.shares)
print "Groupmap count: %d" % len(samba3.groupmappings)
print "Alias count: %d" % len(samba3.aliases)
print "Idmap count: %d" % len(samba3.idmapdb.mappings)
if (e.type == e.IDMAP_GROUP) {
printf("GID %d\n", e.unix_id);
} else {
printf("UID %d\n", e.unix_id);
}
}
}
samba3 = samba.samba3.Samba3(args[0], args[1])
function print_samba3(samba3)
{
print_samba3_sam(samba3);
print_samba3_policy(samba3.policy);
print_samba3_shares(samba3);
print_samba3_winsdb(samba3);
print_samba3_regdb(samba3.registry);
print_samba3_secrets(samba3.secrets);
print_samba3_groupmappings(samba3);
print_samba3_aliases(samba3);
print_samba3_idmapdb(samba3.idmapdb);
}
function print_samba3_summary(samba3)
{
printf("WINS db entries: %d\n", samba3.winsentries.length);
printf("SAM Accounts: %d\n", samba3.samaccounts.length);
printf("Registry key count: %d\n", samba3.registry.keys.length);
printf("Shares (including [global]): %d\n", samba3.shares.length);
printf("Groupmap count: %d\n", samba3.groupmappings.length);
printf("Alias count: %d\n", samba3.aliases.length);
printf("Idmap count: %d\n", samba3.idmapdb.mappings.length);
}
samba3 = samba3_read(options.ARGV[0], options.ARGV[1]);
if (options.format == "summary") {
print_samba3_summary(samba3);
} else if (options.format == "full") {
print_samba3(samba3);
}
return 0;
if opts.format == "summary":
print_samba3_summary(samba3)
elif opts.format == "full":
print_samba3(samba3)

View File

@ -0,0 +1,93 @@
#!/usr/bin/python
#
# tool to manipulate a remote registry
# Copyright Andrew Tridgell 2005
# Copyright Jelmer Vernooij 2007
# Released under the GNU GPL v3 or later
#
import sys
options = GetOptions(ARGV,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"POPT_COMMON_CREDENTIALS",
"createkey=s")
if (options == undefined) {
print "Failed to parse options"
sys.exit(-1)
if len(sys.argv < 2:
print "Usage: %s <BINDING> [path]" % sys.argv[0]
sys.exit(-1)
binding = options.ARGV[0]
reg = winregObj()
print "Connecting to " + binding
status = reg.connect(binding)
if (status.is_ok != true) {
print("Failed to connect to " + binding + " - " + status.errstr + "\n")
return -1
}
def list_values(path):
list = reg.enum_values(path)
if (list == undefined) {
return
}
for (i=0;i<list.length;i++) {
v = list[i]
printf("\ttype=%-30s size=%4d '%s'\n", reg.typestring(v.type), v.size, v.name)
if (v.type == reg.REG_SZ || v.type == reg.REG_EXPAND_SZ) {
printf("\t\t'%s'\n", v.value)
}
if (v.type == reg.REG_MULTI_SZ) {
for (j in v.value) {
printf("\t\t'%s'\n", v.value[j])
}
}
if (v.type == reg.REG_DWORD || v.type == reg.REG_DWORD_BIG_ENDIAN) {
printf("\t\t0x%08x (%d)\n", v.value, v.value)
}
if (v.type == reg.REG_QWORD) {
printf("\t\t0x%llx (%lld)\n", v.value, v.value)
}
}
def list_path(path):
count = 0
list = reg.enum_path(path)
if (list == undefined) {
println("Unable to list " + path)
return 0
}
list_values(path)
count = count + list.length
for (i=0;i<list.length;i++) {
if (path) {
npath = path + "\\" + list[i]
} else {
npath = list[i]
}
println(npath)
count = count + list_path(npath)
}
return count
if len(sys.argv) > 2:
root = sys.argv[2]
else:
root = ''
if options.createkey:
try:
reg.create_key("HKLM\\SOFTWARE", options.createkey)
except:
print "Failed to create key"
else:
printf("Listing registry tree '%s'\n", root)
count = list_path(root)
if count == 0:
println("No entries found")
sys.exit(1)

View File

@ -54,7 +54,7 @@ static int ejs_apply_patchfile(MprVarHandle eid, int argc, struct MprVar **argv)
return -1;
}
error = reg_diff_apply(mprToString(argv[0]), rctx);
error = reg_diff_apply(rctx, mprToString(argv[0]));
mpr_Return(eid, mprWERROR(error));

View File

@ -2808,9 +2808,7 @@ SWIGINTERN PyObject *_wrap_random_password(PyObject *SWIGUNUSEDPARM(self), PyObj
(char *) "len", NULL
};
{
arg1 = NULL;
}
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:random_password",kwnames,&obj0)) SWIG_fail;
ecode2 = SWIG_AsVal_size_t(obj0, &val2);
if (!SWIG_IsOK(ecode2)) {
@ -2855,11 +2853,9 @@ SWIGINTERN PyObject *_wrap_ldb_set_credentials(PyObject *SWIGUNUSEDPARM(self), P
}
arg2 = (struct cli_credentials *)(argp2);
}
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
ldb_set_credentials(arg1,arg2);
resultobj = SWIG_Py_Void();
return resultobj;
@ -2893,11 +2889,9 @@ SWIGINTERN PyObject *_wrap_ldb_set_session_info(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ldb_set_session_info" "', argument " "2"" of type '" "struct auth_session_info *""'");
}
arg2 = (struct auth_session_info *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
ldb_set_session_info(arg1,arg2);
resultobj = SWIG_Py_Void();
return resultobj;
@ -2936,11 +2930,9 @@ SWIGINTERN PyObject *_wrap_ldb_set_loadparm(PyObject *SWIGUNUSEDPARM(self), PyOb
}
arg2 = (struct loadparm_context *)(argp2);
}
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
ldb_set_loadparm(arg1,arg2);
resultobj = SWIG_Py_Void();
return resultobj;
@ -2975,11 +2967,9 @@ SWIGINTERN PyObject *_wrap_samdb_set_domain_sid(PyObject *SWIGUNUSEDPARM(self),
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "samdb_set_domain_sid" "', argument " "2"" of type '" "struct dom_sid const *""'");
}
arg2 = (struct dom_sid *)(argp2);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (bool)samdb_set_domain_sid(arg1,(struct dom_sid const *)arg2);
resultobj = SWIG_From_bool((bool)(result));
return resultobj;
@ -3025,19 +3015,16 @@ SWIGINTERN PyObject *_wrap_dsdb_attach_schema_from_ldif_file(PyObject *SWIGUNUSE
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dsdb_attach_schema_from_ldif_file" "', argument " "3"" of type '" "char const *""'");
}
arg3 = (char *)(buf3);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = dsdb_attach_schema_from_ldif_file(arg1,(char const *)arg2,(char const *)arg3);
{
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
SWIG_fail;
} else if (resultobj == NULL) {
resultobj = Py_None;
}
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
@ -3079,11 +3066,9 @@ SWIGINTERN PyObject *_wrap_dsdb_set_global_schema(PyObject *SWIGUNUSEDPARM(self)
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dsdb_set_global_schema" "', argument " "1"" of type '" "struct ldb_context *""'");
}
arg1 = (struct ldb_context *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (int)dsdb_set_global_schema(arg1);
resultobj = SWIG_From_int((int)(result));
return resultobj;
@ -3109,11 +3094,9 @@ SWIGINTERN PyObject *_wrap_ldb_register_samba_handlers(PyObject *SWIGUNUSEDPARM(
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ldb_register_samba_handlers" "', argument " "1"" of type '" "struct ldb_context *""'");
}
arg1 = (struct ldb_context *)(argp1);
{
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
}
if (arg1 == NULL)
SWIG_exception(SWIG_ValueError,
"ldb context must be non-NULL");
result = (int)ldb_register_samba_handlers(arg1);
resultobj = SWIG_From_int((int)(result));
return resultobj;

View File

@ -91,7 +91,14 @@ class Ldb(ldb.Ldb):
def searchone(self, basedn, attribute, expression=None,
scope=ldb.SCOPE_BASE):
"""Search for one attribute as a string."""
"""Search for one attribute as a string.
:param basedn: BaseDN for the search.
:param attribute: Name of the attribute
:param expression: Optional search expression.
:param scope: Search scope (defaults to base).
:return: Value of attribute as a string or None if it wasn't found.
"""
res = self.search(basedn, scope, expression, [attribute])
if len(res) != 1 or res[0][attribute] is None:
return None
@ -100,7 +107,7 @@ class Ldb(ldb.Ldb):
return values.pop()
def erase(self):
"""Erase an ldb, removing all records."""
"""Erase this ldb, removing all records."""
# delete the specials
for attr in ["@INDEXLIST", "@ATTRIBUTES", "@SUBCLASSES", "@MODULES",
"@OPTIONS", "@PARTITION", "@KLUDGEACL"]:
@ -149,13 +156,18 @@ class Ldb(ldb.Ldb):
:param ldif_path: Path to LDIF file.
"""
self.load_ldif_add(open(ldif_path, 'r').read())
self.add_ldif(open(ldif_path, 'r').read())
def load_ldif_add(self, ldif):
def add_ldif(self, ldif):
for changetype, msg in self.parse_ldif(ldif):
assert changetype == ldb.CHANGETYPE_NONE
self.add(msg)
def modify_ldif(self, ldif):
for (changetype, msg) in ldb.parse_ldif(data):
assert changetype == CHANGETYPE_MODIFY
ldb.modify(msg)
def substitute_var(text, values):
"""substitute strings of the form ${NAME} in str, replacing

View File

@ -111,9 +111,7 @@ def setup_modify_ldif(ldb, ldif_path, substvars=None):
assert "${" not in data
for (changetype, msg) in ldb.parse_ldif(data):
assert changetype == CHANGETYPE_MODIFY
ldb.modify(msg)
ldb.modify_ldif(data)
def setup_ldb(ldb, ldif_path, subst_vars):

View File

@ -0,0 +1,224 @@
#!/usr/bin/python
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@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/>.
#
"""Support for reading Samba 3 data files."""
REGISTRY_VALUE_PREFIX = "SAMBA_REGVAL"
REGISTRY_DB_VERSION = 1
import tdb
class Registry:
"""Simple read-only support for reading the Samba3 registry."""
def __init__(self, file):
self.tdb = tdb.Tdb(file)
def __len__(self):
"""Return the number of keys."""
return len(self.keys())
def keys(self):
"""Return list with all the keys."""
return [k.rstrip("\x00") for k in self.tdb.keys() if not k.startswith(REGISTRY_VALUE_PREFIX)]
def subkeys(self, key):
data = self.tdb.get(key)
if data is None:
return []
# FIXME: Parse data
return []
def values(self, key):
"""Return a dictionary with the values set for a specific key."""
data = self.tdb.get("%s/%s" % (REGISTRY_VALUE_PREFIX, key))
if data is None:
return {}
# FIXME: Parse data
return {}
class PolicyDatabase:
def __init__(self, file):
self.tdb = tdb.Tdb(file)
self.min_password_length = tdb.fetch_uint32("min password length")
self.user_must_logon_to_change_password = tdb.fetch_uint32("password history")
self.user_must_logon_to_change_password = tdb.fetch_uint32("user must logon to change pasword")
self.maximum_password_age = tdb.fetch_uint32("maximum password age")
self.minimum_password_age = tdb.fetch_uint32("minimum password age")
self.lockout_duration = tdb.fetch_uint32("lockout duration")
self.reset_count_minutes = tdb.fetch_uint32("reset count minutes")
self.bad_lockout_minutes = tdb.fetch_uint32("bad lockout minutes")
self.disconnect_time = tdb.fetch_uint32("disconnect time")
self.refuse_machine_password_change = tdb.fetch_uint32("refuse machine password change")
# FIXME: Read privileges as well
GROUPDB_DATABASE_VERSION_V1 = 1 # native byte format.
GROUPDB_DATABASE_VERSION_V2 = 2 # le format.
GROUP_PREFIX = "UNIXGROUP/"
# Alias memberships are stored reverse, as memberships. The performance
# critical operation is to determine the aliases a SID is member of, not
# listing alias members. So we store a list of alias SIDs a SID is member of
# hanging of the member as key.
MEMBEROF_PREFIX = "MEMBEROF/"
class GroupMappingDatabase:
def __init__(self, file):
self.tdb = tdb.Tdb(file)
# High water mark keys
HWM_GROUP = "GROUP HWM"
HWM_USER = "USER HWM"
# idmap version determines auto-conversion
IDMAP_VERSION = 2
class IdmapDatabase:
def __init__(self, file):
self.tdb = tdb.Tdb(file)
assert self.tdb.fetch_int32("IDMAP_VERSION") == IDMAP_VERSION
class SecretsDatabase:
def __init__(self, file):
self.tdb = tdb.Tdb(file)
self.domains = {}
for k, v in self.tdb.items():
if k == "SECRETS/AUTH_PASSWORD":
self.auth_password = v
elif k == "SECRETS/AUTH_DOMAIN":
self.auth_domain = v
elif k == "SECRETS/AUTH_USER":
self.auth_user = v
elif k.startswith("SECRETS/SID/"):
pass # FIXME
elif k.startswith("SECRETS/DOMGUID/"):
pass # FIXME
elif k.startswith("SECRETS/LDAP_BIND_PW/"):
pass # FIXME
elif k.startswith("SECRETS/AFS_KEYFILE/"):
pass # FIXME
elif k.startswith("SECRETS/MACHINE_SEC_CHANNEL_TYPE/"):
pass # FIXME
elif k.startswith("SECRETS/MACHINE_LAST_CHANGE_TIME/"):
pass # FIXME
elif k.startswith("SECRETS/MACHINE_PASSWORD/"):
pass # FIXME
elif k.startswith("SECRETS/$MACHINE.ACC/"):
pass # FIXME
elif k.startswith("SECRETS/$DOMTRUST.ACC/"):
pass # FIXME
elif k == "INFO/random_seed":
self.random_seed = v
else:
raise "Unknown key %s in secrets database" % k
SHARE_DATABASE_VERSION_V1 = 1
SHARE_DATABASE_VERSION_V2 = 2
class ShareInfoDatabase:
def __init__(self, file):
self.tdb = tdb.Tdb(file)
assert self.tdb.fetch_int32("INFO/version") in (SHARE_DATABASE_VERSION_V1, SHARE_DATABASE_VERSION_V2)
def get_secdesc(self, name):
secdesc = self.tdb.get("SECDESC/%s" % name)
# FIXME: Run ndr_pull_security_descriptor
ACB_DISABLED = 0x00000001
ACB_HOMDIRREQ = 0x00000002
ACB_PWNOTREQ = 0x00000004
ACB_TEMPDUP = 0x00000008
ACB_NORMAL = 0x00000010
ACB_MNS = 0x00000020
ACB_DOMTRUST = 0x00000040
ACB_WSTRUST = 0x00000080
ACB_SVRTRUST = 0x00000100
ACB_PWNOEXP = 0x00000200
ACB_AUTOLOCK = 0x00000400
ACB_ENC_TXT_PWD_ALLOWED = 0x00000800
ACB_SMARTCARD_REQUIRED = 0x00001000
ACB_TRUSTED_FOR_DELEGATION = 0x00002000
ACB_NOT_DELEGATED = 0x00004000
ACB_USE_DES_KEY_ONLY = 0x00008000
ACB_DONT_REQUIRE_PREAUTH = 0x00010000
ACB_PW_EXPIRED = 0x00020000
ACB_NO_AUTH_DATA_REQD = 0x00080000
acb_info_mapping = {
'N': ACB_PWNOTREQ, # 'N'o password.
'D': ACB_DISABLED, # 'D'isabled.
'H': ACB_HOMDIRREQ, # 'H'omedir required.
'T': ACB_TEMPDUP, # 'T'emp account.
'U': ACB_NORMAL, # 'U'ser account (normal).
'M': ACB_MNS, # 'M'NS logon user account. What is this ?
'W': ACB_WSTRUST, # 'W'orkstation account.
'S': ACB_SVRTRUST, # 'S'erver account.
'L': ACB_AUTOLOCK, # 'L'ocked account.
'X': ACB_PWNOEXP, # No 'X'piry on password
'I': ACB_DOMTRUST, # 'I'nterdomain trust account.
' ': 0
}
class Smbpasswd:
def __init__(self, file):
pass
class TdbSam:
def __init__(self, file):
self.tdb = tdb.Tdb(file)
class WinsDatabase:
def __init__(self, file):
pass
class Samba3:
def __init__(self, smbconfpath, libdir):
self.smbconfpath = smbconfpath
self.libdir = libdir
def get_policy_db(self):
return PolicyDatabase(os.path.join(libdir, "account_policy.tdb"))
def get_registry(self):
return Registry(os.path.join(libdir, "registry.tdb"))
def get_secrets_db(self):
return SecretsDatabase(os.path.join(libdir, "secrets.tdb"))
def get_shares_db(self):
return ShareInfoDatabase(os.path.join(libdir, "share_info.tdb"))
def get_idmap_db(self):
return IdmapDatabase(os.path.join(libdir, "winbindd_idmap.tdb"))
def get_wins_db(self):
return WinsDatabase(os.path.join(libdir, "wins.dat"))
def get_groupmapping_db(self):
return GroupMappingDatabase(os.path.join(libdir, "group_mapping.tdb"))

View File

@ -43,6 +43,7 @@ class TestCaseInTempDir(unittest.TestCase):
def tearDown(self):
super(TestCaseInTempDir, self).tearDown()
# FIXME: Remove all files in self.tempdir
class SubstituteVarTestCase(unittest.TestCase):

View File

@ -0,0 +1,57 @@
#!/usr/bin/python
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@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/>.
#
import unittest
from samba.samba3 import GroupMappingDatabase, Registry, PolicyDatabase
import os
DATADIR=os.path.join(os.path.dirname(__file__), "../../../../../testdata/samba3")
class RegistryTestCase(unittest.TestCase):
def setUp(self):
self.registry = Registry(os.path.join(DATADIR, "registry.tdb"))
def test_length(self):
self.assertEquals(28, len(self.registry))
def test_keys(self):
self.assertEquals([], self.registry.keys())
class PolicyTestCase(unittest.TestCase):
def setUp(self):
self.policy = PolicyDatabase(os.path.join(DATADIR, "account_policy.tdb"))
def test_policy(self):
self.assertEquals(self.policy.min_password_length, 5)
self.assertEquals(self.policy.minimum_password_age, 0)
self.assertEquals(self.policy.maximum_password_age, 999999999)
self.assertEquals(self.policy.refuse_machine_password_change, 0)
self.assertEquals(self.policy.reset_count_minutes, 0)
self.assertEquals(self.policy.disconnect_time, -1)
self.assertEquals(self.policy.user_must_logon_to_change_password, 0)
self.assertEquals(self.policy.password_history, 0)
self.assertEquals(self.policy.lockout_duration, 0)
self.assertEquals(self.policy.bad_lockout_minutes, 0)
class GroupsTestCase(unittest.TestCase):
def setUp(self):
self.groupdb = GroupMappingDatabase(os.path.join(DATADIR, "group_mapping.tdb"))

View File

@ -7,7 +7,7 @@
"""Support code for upgrading from Samba 3 to Samba 4."""
from provision import findnss
from provision import findnss, provision
import provision
import grp
import pwd
@ -69,7 +69,7 @@ data:: %s""" % (keydn, rv.name, rv.name, rv.type, ldb.encode(rv.data))
return ldif
def upgrade_sam_policy(samba3,dn):
def upgrade_sam_policy(policy,dn):
ldif = """
dn: %s
changetype: modify
@ -84,11 +84,11 @@ samba3UserMustLogonToChangePassword: %d
samba3BadLockoutMinutes: %d
samba3DisconnectTime: %d
""" % (dn, samba3.policy.min_password_length,
samba3.policy.password_history, samba3.policy.minimum_password_age,
samba3.policy.maximum_password_age, samba3.policy.lockout_duration,
samba3.policy.reset_count_minutes, samba3.policy.user_must_logon_to_change_password,
samba3.policy.bad_lockout_minutes, samba3.policy.disconnect_time)
""" % (dn, policy.min_password_length,
policy.password_history, policy.minimum_password_age,
policy.maximum_password_age, policy.lockout_duration,
policy.reset_count_minutes, policy.user_must_logon_to_change_password,
policy.bad_lockout_minutes, policy.disconnect_time)
return ldif
@ -465,7 +465,7 @@ replace: type
type: 4
replace: data
data: %d
""" % samba3.policy.refuse_machine_password_change)
""" % policy.refuse_machine_password_change)
message("Importing users")
for account in samba3.samaccounts:

View File

@ -287,6 +287,7 @@ fi
# if python is available, run the python tests:
if which python 2>/dev/null >/dev/null
then
PYTHON=python
plantest "ldb.python" none PYTHONPATH=bin/python:scripting/python:lib/ldb/tests/python/ scripting/bin/subunitrun api
plantest "credentials.python" none PYTHONPATH=bin/python:scripting/python:auth/credentials/tests scripting/bin/subunitrun bindings
plantest "registry.python" none PYTHONPATH=bin/python:scripting/python:lib/registry/tests/ scripting/bin/subunitrun bindings
@ -297,4 +298,7 @@ then
plantest "upgrade.python" none PYTHONPATH=bin/python:scripting/python scripting/bin/subunitrun samba.tests.upgrade
plantest "samba.python" none PYTHONPATH=bin/python:scripting/python scripting/bin/subunitrun samba.tests
plantest "provision.python" none PYTHONPATH=bin/python:scripting/python scripting/bin/subunitrun samba.tests.provision
plantest "samba3.python" none PYTHONPATH=bin/python:scripting/python scripting/bin/subunitrun samba.tests.samba3
plantest "samba3sam.python" none PYTHONPATH=bin/python:scripting/python $PYTHON dsdb/samdb/ldb_modules/tests/samba3sam.py `pwd` $DATADIR/samba3/
plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py \$SERVER -U\$USERNAME%\$PASSWORD
fi