diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-04-11 11:11:42 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-04-11 11:11:42 +1000 |
commit | ae977ef24780c52da66e3608a3ed94649ae9f873 (patch) | |
tree | 51f1a491b9f515049bc6eb3dc2b3b8ae2a3743e6 /source4 | |
parent | 9198a519bea19a4d9f863fde5fb3aa23f60b5c88 (diff) | |
parent | 8ed6f6d5a825c8b0e8d66d30877a91a96fe6e7a4 (diff) | |
download | samba-ae977ef24780c52da66e3608a3ed94649ae9f873.tar.gz samba-ae977ef24780c52da66e3608a3ed94649ae9f873.tar.bz2 samba-ae977ef24780c52da66e3608a3ed94649ae9f873.zip |
Fix merge errors on C provision interface after jelmer's good work.
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-abartlet
Conflicts:
source/torture/local/torture.c
(This used to be commit 5bf1c89cf8af08fbcf4f5089079920840daad7b8)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/ldb.i | 8 | ||||
-rw-r--r-- | source4/lib/ldb/ldb.py | 4 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_wrap.c | 107 | ||||
-rw-r--r-- | source4/libcli/cldap/cldap.c | 5 | ||||
-rw-r--r-- | source4/param/config.mk | 2 | ||||
-rw-r--r-- | source4/param/provision.c | 18 | ||||
-rw-r--r-- | source4/param/provision.h | 10 | ||||
-rw-r--r-- | source4/scripting/ejs/config.mk | 1 | ||||
-rw-r--r-- | source4/scripting/python/samba/provision.py | 2 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_BecomeDC.c | 3 | ||||
-rw-r--r-- | source4/torture/local/torture.c | 6 |
11 files changed, 121 insertions, 45 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index e01a1107d2..6b94f19cb5 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -251,6 +251,14 @@ fail: #ifdef SWIGPYTHON %{ +struct ldb_context *ldb_context_from_py_object(PyObject *py_obj) +{ + struct ldb_context *ldb_ctx; + if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 | 0 ) < 0) + return NULL; + return ldb_ctx; +} + int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, ldb_dn **dn) { diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 0bcfd36779..b148782c63 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. @@ -99,7 +99,7 @@ Dn_swigregister(Dn) class ldb_msg_element(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self): raise AttributeError, "No constructor defined" + def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr __swig_destroy__ = _ldb.delete_ldb_msg_element def __getitem__(self, i): diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 082c6d9cad..390652eebe 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.33 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -126,7 +126,7 @@ /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "3" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -161,6 +161,7 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg) Py_DECREF(old_str); Py_DECREF(value); } else { - PyErr_Format(PyExc_RuntimeError, mesg); + PyErr_SetString(PyExc_RuntimeError, mesg); } } @@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v) { PySwigObject *sobj = (PySwigObject *) v; PyObject *next = sobj->next; - if (sobj->own) { + if (sobj->own == SWIG_POINTER_OWN) { swig_type_info *ty = sobj->ty; PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0; PyObject *destroy = data ? data->destroy : 0; @@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v) res = ((*meth)(mself, v)); } Py_XDECREF(res); - } else { - const char *name = SWIG_TypePrettyName(ty); + } #if !defined(SWIG_PYTHON_SILENT_MEMLEAK) - printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name); -#endif + else { + const char *name = SWIG_TypePrettyName(ty); + printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown")); } +#endif } Py_XDECREF(next); PyObject_DEL(v); @@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj) SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own) { - if (own) { + if (own == SWIG_POINTER_OWN) { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); if (sobj) { int oldown = sobj->own; @@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int return SWIG_OK; } else { PySwigObject *sobj = SWIG_Python_GetSwigThis(obj); + if (own) + *own = 0; while (sobj) { void *vptr = sobj->ptr; if (ty) { @@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int if (!tc) { sobj = (PySwigObject *)sobj->next; } else { - if (ptr) *ptr = SWIG_TypeCast(tc,vptr); + if (ptr) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); + if (own) + *own = *own | SWIG_CAST_NEW_MEMORY; + } + } break; } } @@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int } } if (sobj) { - if (own) *own = sobj->own; + if (own) + *own = *own | sobj->own; if (flags & SWIG_POINTER_DISOWN) { sobj->own = 0; } @@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { } if (ty) { swig_cast_info *tc = SWIG_TypeCheck(desc,ty); - if (!tc) return SWIG_ERROR; - *ptr = SWIG_TypeCast(tc,vptr); + if (tc) { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc,vptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + } else { + return SWIG_ERROR; + } } else { *ptr = vptr; } @@ -2471,7 +2489,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_ldb_module_ops swig_types[9] #define SWIGTYPE_p_ldb_result swig_types[10] #define SWIGTYPE_p_ldb_val swig_types[11] -#define SWIGTYPE_p_long swig_types[12] +#define SWIGTYPE_p_long_long swig_types[12] #define SWIGTYPE_p_p_char swig_types[13] #define SWIGTYPE_p_p_ldb_control swig_types[14] #define SWIGTYPE_p_p_ldb_result swig_types[15] @@ -2480,10 +2498,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_unsigned_char swig_types[18] #define SWIGTYPE_p_unsigned_int swig_types[19] #define SWIGTYPE_p_unsigned_long swig_types[20] -#define SWIGTYPE_p_unsigned_short swig_types[21] -#define SWIGTYPE_p_void swig_types[22] -static swig_type_info *swig_types[24]; -static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0}; +#define SWIGTYPE_p_unsigned_long_long swig_types[21] +#define SWIGTYPE_p_unsigned_short swig_types[22] +#define SWIGTYPE_p_void swig_types[23] +static swig_type_info *swig_types[25]; +static swig_module_info swig_module = {swig_types, 24, 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) @@ -2515,7 +2534,7 @@ static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0}; #define SWIG_name "_ldb" -#define SWIGVERSION 0x010333 +#define SWIGVERSION 0x010335 #define SWIG_VERSION SWIGVERSION @@ -2706,6 +2725,14 @@ SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){ return ret; } +struct ldb_context *ldb_context_from_py_object(PyObject *py_obj) +{ + struct ldb_context *ldb_ctx; + if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 | 0 ) < 0) + return NULL; + return ldb_ctx; +} + int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, struct ldb_context *ldb_ctx, ldb_dn **dn) { @@ -4193,7 +4220,10 @@ check_1: } fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n Possible C/C++ prototypes are:\n"" __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n"" __setitem__(ldb_msg *,char const *,PyObject *)\n"); + SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n" + " Possible C/C++ prototypes are:\n" + " __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n" + " __setitem__(ldb_msg *,char const *,PyObject *)\n"); return NULL; } @@ -5711,7 +5741,7 @@ static PyMethodDef SwigMethods[] = { static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void = {"_p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void", "void (*)(void *,enum ldb_debug_level,char const *,va_list)", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *|ldb *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_dn = {"_p_ldb_dn", "struct ldb_dn *|ldb_dn *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_ldif = {"_p_ldb_ldif", "struct ldb_ldif *|ldb_ldif *", 0, 0, (void*)0, 0}; @@ -5720,15 +5750,16 @@ static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element", static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_t *", 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_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_ldb_control = {"_p_p_ldb_control", "struct ldb_control **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_ldb_result = {"_p_p_ldb_result", "struct ldb_result **", 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", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|time_t *|uint_fast16_t *|uintmax_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 = {"_p_unsigned_long", "unsigned long *|time_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 _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; @@ -5745,7 +5776,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_ldb_module_ops, &_swigt__p_ldb_result, &_swigt__p_ldb_val, - &_swigt__p_long, + &_swigt__p_long_long, &_swigt__p_p_char, &_swigt__p_p_ldb_control, &_swigt__p_p_ldb_result, @@ -5754,6 +5785,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_unsigned_char, &_swigt__p_unsigned_int, &_swigt__p_unsigned_long, + &_swigt__p_unsigned_long_long, &_swigt__p_unsigned_short, &_swigt__p_void, }; @@ -5770,7 +5802,7 @@ static swig_cast_info _swigc__p_ldb_message_element[] = { {&_swigt__p_ldb_messa static swig_cast_info _swigc__p_ldb_module_ops[] = { {&_swigt__p_ldb_module_ops, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_ldb_result[] = { {&_swigt__p_ldb_result, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_ldb_val[] = { {&_swigt__p_ldb_val, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 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_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_ldb_control[] = { {&_swigt__p_p_ldb_control, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_p_ldb_result[] = { {&_swigt__p_p_ldb_result, 0, 0, 0},{0, 0, 0, 0}}; @@ -5779,6 +5811,7 @@ static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 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[] = { {&_swigt__p_unsigned_long, 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 _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; @@ -5795,7 +5828,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_ldb_module_ops, _swigc__p_ldb_result, _swigc__p_ldb_val, - _swigc__p_long, + _swigc__p_long_long, _swigc__p_p_char, _swigc__p_p_ldb_control, _swigc__p_p_ldb_result, @@ -5804,6 +5837,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_unsigned_char, _swigc__p_unsigned_int, _swigc__p_unsigned_long, + _swigc__p_unsigned_long_long, _swigc__p_unsigned_short, _swigc__p_void, }; @@ -5874,7 +5908,7 @@ SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; swig_module_info *module_head, *iter; - int found; + int found, init; clientdata = clientdata; @@ -5884,6 +5918,9 @@ SWIG_InitializeModule(void *clientdata) { swig_module.type_initial = swig_type_initial; swig_module.cast_initial = swig_cast_initial; swig_module.next = &swig_module; + init = 1; + } else { + init = 0; } /* Try and load any already created modules */ @@ -5912,6 +5949,12 @@ SWIG_InitializeModule(void *clientdata) { module_head->next = &swig_module; } + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index d10eeb8ffd..d9910285d9 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -601,8 +601,11 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req, NTSTATUS status; enum ndr_err_code ndr_err; struct cldap_search search; + struct cldap_socket *cldap; DATA_BLOB *data; + cldap = req->cldap; + status = cldap_search_recv(req, mem_ctx, &search); if (!NT_STATUS_IS_OK(status)) { return status; @@ -620,7 +623,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req, data = search.out.response->attributes[0].values; ndr_err = ndr_pull_union_blob_all(data, mem_ctx, - req->cldap->iconv_convenience, + cldap->iconv_convenience, &io->out.netlogon, io->in.version & 0xF, (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon); diff --git a/source4/param/config.mk b/source4/param/config.mk index 064c293fa4..b4182480a9 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -1,6 +1,6 @@ [LIBRARY::LIBSAMBA-HOSTCONFIG] VERSION = 0.0.1 -SO_VERSION = 1 +SO_VERSION = 0 OBJ_FILES = loadparm.o \ generic.o \ util.o \ diff --git a/source4/param/provision.c b/source4/param/provision.c index a15993ffc8..d9b2dd899d 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -29,9 +29,12 @@ #include "scripting/python/modules.h" NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct provision_settings *settings) + struct provision_settings *settings, + struct provision_result *result) { - PyObject *provision_mod, *provision_dict, *provision_fn, *result, *parameters; + extern struct loadparm_context *lp_from_py_object(PyObject *py_obj); + struct ldb_context *ldb_context_from_py_object(PyObject *py_obj); + PyObject *provision_mod, *provision_dict, *provision_fn, *py_result, *parameters; DEBUG(0,("Provision for Become-DC test using python\n")); @@ -115,15 +118,22 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, PyDict_SetItemString(parameters, "machinepass", PyString_FromString(settings->machine_password)); - result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters); + py_result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters); Py_DECREF(parameters); - if (result == NULL) { + if (py_result == NULL) { PyErr_Print(); PyErr_Clear(); return NT_STATUS_UNSUCCESSFUL; } + result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn"))); + + /* FIXME paths */ + /* FIXME samdb */ + result->lp_ctx = lp_from_py_object(PyObject_GetAttrString(py_result, "lp")); + result->samdb = ldb_context_from_py_object(PyObject_GetAttrString(py_result, "samdb")); + return NT_STATUS_OK; } diff --git a/source4/param/provision.h b/source4/param/provision.h index 38a66966c8..df95549272 100644 --- a/source4/param/provision.h +++ b/source4/param/provision.h @@ -38,7 +38,15 @@ struct provision_settings { const char *targetdir; }; +/* FIXME: Rename this to hostconfig ? */ +struct provision_result { + const char *domaindn; + struct ldb_context *samdb; + struct loadparm_context *lp_ctx; +}; + NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, - struct provision_settings *settings); + struct provision_settings *settings, + struct provision_result *result); #endif /* _PROVISION_H_ */ diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index 33a4ac915f..ea64d24eea 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -90,7 +90,6 @@ PRIVATE_DEPENDENCIES = \ ####################### # Start BINARY SMBSCRIPT [BINARY::smbscript] -INSTALLDIR = BINDIR OBJ_FILES = \ smbscript.o PRIVATE_DEPENDENCIES = EJS LIBSAMBA-UTIL smbcalls LIBSAMBA-HOSTCONFIG diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index ff76681c13..16b1eb2156 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1088,7 +1088,7 @@ def provision_become_dc(setup_dir=None, """print a message if quiet is not set.""" print text - provision(setup_dir, message, system_session(), None, + return provision(setup_dir, message, system_session(), None, smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS, realm=realm, rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, serverdn=serverdn, domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename); diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 07dd0ddd81..3305a814f5 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -67,6 +67,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, { struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state); struct provision_settings settings; + struct provision_result result; NTSTATUS status; bool ok; struct loadparm_context *lp_ctx = loadparm_init(s); @@ -88,7 +89,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, settings.machine_password = cli_credentials_get_password(s->machine_account); settings.targetdir = s->targetdir; - status = provision_bare(s, s->lp_ctx, &settings); + status = provision_bare(s, s->lp_ctx, &settings, &result); smbconf = talloc_asprintf(lp_ctx, "%s/%s", s->targetdir, "/etc/smb.conf"); diff --git a/source4/torture/local/torture.c b/source4/torture/local/torture.c index 83c531124d..b48b191be6 100644 --- a/source4/torture/local/torture.c +++ b/source4/torture/local/torture.c @@ -44,6 +44,7 @@ static bool test_provision(struct torture_context *tctx) { NTSTATUS status; struct provision_settings *settings = talloc_zero(tctx, struct provision_settings); + struct provision_result result; char *targetdir = NULL; torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir), @@ -64,10 +65,13 @@ static bool test_provision(struct torture_context *tctx) settings->ntds_dn_str = NULL; settings->machine_password = "geheim"; - status = provision_bare(settings, tctx->lp_ctx, settings); + status = provision_bare(settings, tctx->lp_ctx, settings, &result); torture_assert_ntstatus_ok(tctx, status, "provision"); + torture_assert_str_equal(tctx, result.domaindn, "DC=EXAMPLE,DC=COM", + "domaindn incorrect"); + return true; } |