diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-04-17 12:23:44 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-04-17 12:23:44 +0200 |
commit | 21fc7673780aa1d7c0caab7b17ff9171238913ba (patch) | |
tree | 53556069de7ca28e4721473d679c559c71df22b8 /source4/lib | |
parent | ab07a60d6ed1d9704590747ac69bbaa22bef2df3 (diff) | |
download | samba-21fc7673780aa1d7c0caab7b17ff9171238913ba.tar.gz samba-21fc7673780aa1d7c0caab7b17ff9171238913ba.tar.bz2 samba-21fc7673780aa1d7c0caab7b17ff9171238913ba.zip |
Specify event_context to ldb_wrap_connect explicitly.
(This used to be commit b4e1ae07a284c044704322446c94351c2decff91)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb_wrap.c | 9 | ||||
-rw-r--r-- | source4/lib/ldb_wrap.h | 2 | ||||
-rw-r--r-- | source4/lib/registry/hive.c | 3 | ||||
-rw-r--r-- | source4/lib/registry/ldb.c | 3 | ||||
-rw-r--r-- | source4/lib/registry/registry.h | 4 | ||||
-rw-r--r-- | source4/lib/registry/registry.i | 5 | ||||
-rw-r--r-- | source4/lib/registry/registry.py | 1 | ||||
-rw-r--r-- | source4/lib/registry/registry_wrap.c | 170 | ||||
-rw-r--r-- | source4/lib/registry/samba.c | 14 | ||||
-rw-r--r-- | source4/lib/registry/tests/hive.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/tests/registry.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/tools/common.c | 9 | ||||
-rw-r--r-- | source4/lib/registry/tools/regdiff.c | 10 | ||||
-rw-r--r-- | source4/lib/registry/tools/regpatch.c | 6 | ||||
-rw-r--r-- | source4/lib/registry/tools/regshell.c | 7 | ||||
-rw-r--r-- | source4/lib/registry/tools/regtree.c | 7 |
16 files changed, 164 insertions, 90 deletions
diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c index 71ba37b479..b71adcbca2 100644 --- a/source4/lib/ldb_wrap.c +++ b/source4/lib/ldb_wrap.c @@ -94,6 +94,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb) TODO: We need an error_string parameter */ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev, struct loadparm_context *lp_ctx, const char *url, struct auth_session_info *session_info, @@ -103,7 +104,6 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, { struct ldb_context *ldb; int ret; - struct event_context *ev; char *real_url = NULL; size_t *startup_blocks; @@ -115,10 +115,9 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, ldb_set_modules_dir(ldb, talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx))); - /* we want to use the existing event context if possible. This - relies on the fact that in smbd, everything is a child of - the main event_context */ - ev = event_context_find(ldb); + if (ev == NULL) { + ev = event_context_find(mem_ctx); + } if (ldb_set_opaque(ldb, "EventContext", ev)) { talloc_free(ldb); diff --git a/source4/lib/ldb_wrap.h b/source4/lib/ldb_wrap.h index d3ff04b880..e626b6ef8a 100644 --- a/source4/lib/ldb_wrap.h +++ b/source4/lib/ldb_wrap.h @@ -27,10 +27,12 @@ struct ldb_message; struct ldb_dn; struct cli_credentials; struct loadparm_context; +struct event_context; char *wrap_casefold(void *context, void *mem_ctx, const char *s); struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, + struct event_context *ev, struct loadparm_context *lp_ctx, const char *url, struct auth_session_info *session_info, diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index 2a9b1a59ce..4a2309faee 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -28,6 +28,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root) { @@ -57,7 +58,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, } else if (!strncmp(peek, "TDB file", 8)) { close(fd); return reg_open_ldb_file(parent_ctx, location, session_info, - credentials, lp_ctx, root); + credentials, ev_ctx, lp_ctx, root); } return WERR_BADFILE; diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index a764ca6235..a8a9ed597e 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -357,6 +357,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k) { @@ -367,7 +368,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, if (location == NULL) return WERR_INVALID_PARAM; - wrap = ldb_wrap_connect(parent_ctx, lp_ctx, + wrap = ldb_wrap_connect(parent_ctx, ev_ctx, lp_ctx, location, session_info, credentials, 0, NULL); if (wrap == NULL) { diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index d4c4a89c20..9c0f66b6d6 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -149,10 +149,12 @@ struct hive_operations { struct cli_credentials; struct auth_session_info; +struct event_context; WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root); WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key, @@ -199,6 +201,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k); @@ -359,6 +362,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 1b3c1c281a..5ffee4bb3d 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -26,6 +26,7 @@ #include "includes.h" #include "registry.h" #include "param/param.h" +#include "events/events.h" typedef struct registry_context reg; typedef struct hive_key hive_key; @@ -41,6 +42,7 @@ typedef struct hive_key hive_key; %import "../../auth/credentials/credentials.i" %import "../../libcli/util/errors.i" %import "../../param/param.i" +%import "../events/events.i" /* Utility functions */ @@ -132,6 +134,7 @@ typedef struct registry_context { WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root); @@ -139,6 +142,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k); @@ -165,6 +169,7 @@ typedef struct hive_key { WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); diff --git a/source4/lib/registry/registry.py b/source4/lib/registry/registry.py index 9dab309f33..cb20d6039d 100644 --- a/source4/lib/registry/registry.py +++ b/source4/lib/registry/registry.py @@ -59,6 +59,7 @@ def _swig_setattr_nondynamic_method(set): import credentials import param +import events reg_get_predef_name = _registry.reg_get_predef_name str_regtype = _registry.str_regtype Registry = _registry.Registry diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index 4879b2e144..d9b85ee937 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2478,29 +2478,30 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_auth_session_info swig_types[1] #define SWIGTYPE_p_char swig_types[2] #define SWIGTYPE_p_cli_credentials swig_types[3] -#define SWIGTYPE_p_hive_key swig_types[4] -#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_char swig_types[9] -#define SWIGTYPE_p_p_hive_key swig_types[10] -#define SWIGTYPE_p_p_registry_context swig_types[11] -#define SWIGTYPE_p_p_registry_key swig_types[12] -#define SWIGTYPE_p_param_context swig_types[13] -#define SWIGTYPE_p_param_opt swig_types[14] -#define SWIGTYPE_p_param_section swig_types[15] -#define SWIGTYPE_p_reg_diff_callbacks swig_types[16] -#define SWIGTYPE_p_registry_context swig_types[17] -#define SWIGTYPE_p_registry_key swig_types[18] -#define SWIGTYPE_p_short swig_types[19] -#define SWIGTYPE_p_signed_char swig_types[20] -#define SWIGTYPE_p_unsigned_char swig_types[21] -#define SWIGTYPE_p_unsigned_int swig_types[22] -#define SWIGTYPE_p_unsigned_long_long swig_types[23] -#define SWIGTYPE_p_unsigned_short swig_types[24] -static swig_type_info *swig_types[26]; -static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; +#define SWIGTYPE_p_event_context swig_types[4] +#define SWIGTYPE_p_hive_key swig_types[5] +#define SWIGTYPE_p_int swig_types[6] +#define SWIGTYPE_p_loadparm_context swig_types[7] +#define SWIGTYPE_p_loadparm_service swig_types[8] +#define SWIGTYPE_p_long_long swig_types[9] +#define SWIGTYPE_p_p_char swig_types[10] +#define SWIGTYPE_p_p_hive_key swig_types[11] +#define SWIGTYPE_p_p_registry_context swig_types[12] +#define SWIGTYPE_p_p_registry_key swig_types[13] +#define SWIGTYPE_p_param_context swig_types[14] +#define SWIGTYPE_p_param_opt swig_types[15] +#define SWIGTYPE_p_param_section swig_types[16] +#define SWIGTYPE_p_reg_diff_callbacks swig_types[17] +#define SWIGTYPE_p_registry_context swig_types[18] +#define SWIGTYPE_p_registry_key swig_types[19] +#define SWIGTYPE_p_short swig_types[20] +#define SWIGTYPE_p_signed_char swig_types[21] +#define SWIGTYPE_p_unsigned_char swig_types[22] +#define SWIGTYPE_p_unsigned_int swig_types[23] +#define SWIGTYPE_p_unsigned_long_long swig_types[24] +#define SWIGTYPE_p_unsigned_short swig_types[25] +static swig_type_info *swig_types[27]; +static swig_module_info swig_module = {swig_types, 26, 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) @@ -2547,6 +2548,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; #include "includes.h" #include "registry.h" #include "param/param.h" +#include "events/events.h" typedef struct registry_context reg; typedef struct hive_key hive_key; @@ -3462,8 +3464,9 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar char *arg2 = (char *) 0 ; struct auth_session_info *arg3 = (struct auth_session_info *) 0 ; struct cli_credentials *arg4 = (struct cli_credentials *) 0 ; - struct loadparm_context *arg5 = (struct loadparm_context *) 0 ; - struct hive_key **arg6 = (struct hive_key **) 0 ; + struct event_context *arg5 = (struct event_context *) 0 ; + struct loadparm_context *arg6 = (struct loadparm_context *) 0 ; + struct hive_key **arg7 = (struct hive_key **) 0 ; WERROR result; int res2 ; char *buf2 = 0 ; @@ -3474,21 +3477,25 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; - struct hive_key *tmp6 ; + void *argp6 = 0 ; + int res6 = 0 ; + struct hive_key *tmp7 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; char * kwnames[] = { - (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL + (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL }; arg3 = NULL; arg4 = NULL; - arg5 = loadparm_init(NULL); + arg5 = event_context_init(NULL); + arg6 = loadparm_init(NULL); arg1 = NULL; - arg6 = &tmp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + arg7 = &tmp7; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "hive_key" "', argument " "2"" of type '" "char const *""'"); @@ -3509,13 +3516,20 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar arg4 = (struct cli_credentials *)(argp4); } if (obj3) { - res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 ); + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct loadparm_context *""'"); + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct event_context *""'"); } - arg5 = (struct loadparm_context *)(argp5); + arg5 = (struct event_context *)(argp5); } - result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6); + if (obj4) { + res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "hive_key" "', argument " "6"" of type '" "struct loadparm_context *""'"); + } + arg6 = (struct loadparm_context *)(argp6); + } + result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3524,7 +3538,7 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar resultobj = Py_None; } Py_XDECREF(resultobj); - resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0); + resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: @@ -3539,8 +3553,9 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar char *arg2 = (char *) 0 ; struct auth_session_info *arg3 = (struct auth_session_info *) 0 ; struct cli_credentials *arg4 = (struct cli_credentials *) 0 ; - struct loadparm_context *arg5 = (struct loadparm_context *) 0 ; - struct hive_key **arg6 = (struct hive_key **) 0 ; + struct event_context *arg5 = (struct event_context *) 0 ; + struct loadparm_context *arg6 = (struct loadparm_context *) 0 ; + struct hive_key **arg7 = (struct hive_key **) 0 ; WERROR result; int res2 ; char *buf2 = 0 ; @@ -3551,21 +3566,25 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; - struct hive_key *tmp6 ; + void *argp6 = 0 ; + int res6 = 0 ; + struct hive_key *tmp7 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; + PyObject * obj4 = 0 ; char * kwnames[] = { - (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL + (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL }; arg3 = NULL; arg4 = NULL; - arg5 = loadparm_init(NULL); + arg5 = event_context_init(NULL); + arg6 = loadparm_init(NULL); arg1 = NULL; - arg6 = &tmp6; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + arg7 = &tmp7; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail; res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_ldb" "', argument " "2"" of type '" "char const *""'"); @@ -3586,13 +3605,20 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar arg4 = (struct cli_credentials *)(argp4); } if (obj3) { - res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 ); + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct loadparm_context *""'"); + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct event_context *""'"); } - arg5 = (struct loadparm_context *)(argp5); + arg5 = (struct event_context *)(argp5); } - result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6); + if (obj4) { + res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_ldb" "', argument " "6"" of type '" "struct loadparm_context *""'"); + } + arg6 = (struct loadparm_context *)(argp6); + } + result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3601,7 +3627,7 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar resultobj = Py_None; } Py_XDECREF(resultobj); - resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0); + resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0); if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); return resultobj; fail: @@ -3696,9 +3722,10 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * PyObject *resultobj = 0; TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ; struct registry_context **arg2 = (struct registry_context **) 0 ; - struct loadparm_context *arg3 = (struct loadparm_context *) 0 ; - struct auth_session_info *arg4 = (struct auth_session_info *) 0 ; - struct cli_credentials *arg5 = (struct cli_credentials *) 0 ; + struct event_context *arg3 = (struct event_context *) 0 ; + struct loadparm_context *arg4 = (struct loadparm_context *) 0 ; + struct auth_session_info *arg5 = (struct auth_session_info *) 0 ; + struct cli_credentials *arg6 = (struct cli_credentials *) 0 ; WERROR result; struct registry_context *tmp2 ; void *argp3 = 0 ; @@ -3707,41 +3734,52 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject * int res4 = 0 ; void *argp5 = 0 ; int res5 = 0 ; + void *argp6 = 0 ; + int res6 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; char * kwnames[] = { - (char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL + (char *) "ev_ctx",(char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL }; - arg3 = loadparm_init(NULL); - arg4 = NULL; + arg3 = event_context_init(NULL); + arg4 = loadparm_init(NULL); arg5 = NULL; + arg6 = NULL; arg1 = NULL; arg2 = &tmp2; - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:open_samba",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; if (obj0) { - res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 ); + res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_event_context, 0 | 0 ); if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'"); + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct event_context *""'"); } - arg3 = (struct loadparm_context *)(argp3); + arg3 = (struct event_context *)(argp3); } if (obj1) { - res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_auth_session_info, 0 | 0 ); + res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_loadparm_context, 0 | 0 ); if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct auth_session_info *""'"); + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct loadparm_context *""'"); } - arg4 = (struct auth_session_info *)(argp4); + arg4 = (struct loadparm_context *)(argp4); } if (obj2) { - res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_cli_credentials, 0 | 0 ); + res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_auth_session_info, 0 | 0 ); if (!SWIG_IsOK(res5)) { - SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct cli_credentials *""'"); + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct auth_session_info *""'"); + } + arg5 = (struct auth_session_info *)(argp5); + } + if (obj3) { + res6 = SWIG_ConvertPtr(obj3, &argp6,SWIGTYPE_p_cli_credentials, 0 | 0 ); + if (!SWIG_IsOK(res6)) { + SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_samba" "', argument " "6"" of type '" "struct cli_credentials *""'"); } - arg5 = (struct cli_credentials *)(argp5); + arg6 = (struct cli_credentials *)(argp6); } - result = reg_open_samba(arg1,arg2,arg3,arg4,arg5); + result = reg_open_samba(arg1,arg2,arg3,arg4,arg5,arg6); if (!W_ERROR_IS_OK(result)) { PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result)); PyErr_SetObject(PyExc_RuntimeError, obj); @@ -3786,6 +3824,7 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0 static swig_type_info _swigt__p_auth_session_info = {"_p_auth_session_info", "struct auth_session_info *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_hive_key = {"_p_hive_key", "struct hive_key *", 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}; @@ -3813,6 +3852,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_auth_session_info, &_swigt__p_char, &_swigt__p_cli_credentials, + &_swigt__p_event_context, &_swigt__p_hive_key, &_swigt__p_int, &_swigt__p_loadparm_context, @@ -3840,6 +3880,7 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, static swig_cast_info _swigc__p_auth_session_info[] = { {&_swigt__p_auth_session_info, 0, 0, 0},{0, 0, 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_event_context[] = { {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_hive_key[] = { {&_swigt__p_hive_key, 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}}; @@ -3867,6 +3908,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_auth_session_info, _swigc__p_char, _swigc__p_cli_credentials, + _swigc__p_event_context, _swigc__p_hive_key, _swigc__p_int, _swigc__p_loadparm_context, diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index 59693dde8e..84a8112f17 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -26,6 +26,7 @@ */ static WERROR mount_samba_hive(struct registry_context *ctx, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *auth_info, struct cli_credentials *creds, @@ -40,11 +41,11 @@ static WERROR mount_samba_hive(struct registry_context *ctx, lp_private_dir(lp_ctx), name); - error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive); + error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive); if (W_ERROR_EQUAL(error, WERR_BADFILE)) error = reg_open_ldb_file(ctx, location, auth_info, - creds, lp_ctx, &hive); + creds, event_ctx, lp_ctx, &hive); if (!W_ERROR_IS_OK(error)) return error; @@ -55,6 +56,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx, _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials) @@ -66,18 +68,18 @@ _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, return result; } - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hklm", HKEY_LOCAL_MACHINE); - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hkcr", HKEY_CLASSES_ROOT); /* FIXME: Should be mounted from NTUSER.DAT in the home directory of the * current user */ - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hkcu", HKEY_CURRENT_USER); - mount_samba_hive(*ctx, lp_ctx, session_info, credentials, + mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials, "hku", HKEY_USERS); /* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index a16736c761..83abdd793d 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -363,7 +363,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data) rmdir(dirname); - error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key); + error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to initialize ldb hive\n"); return false; diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 33512a0c8c..ec7873a111 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -524,7 +524,7 @@ static bool setup_local_registry(struct torture_context *tctx, void **data) torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed"); filename = talloc_asprintf(tctx, "%s/classes_root.ldb", tempdir); - error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &hive_key); + error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &hive_key); torture_assert_werr_ok(tctx, error, "Opening classes_root file failed"); error = reg_mount_hive(rctx, hive_key, HKEY_CLASSES_ROOT, NULL); diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c index 52f3c6f551..3ea780de60 100644 --- a/source4/lib/registry/tools/common.c +++ b/source4/lib/registry/tools/common.c @@ -42,6 +42,7 @@ struct registry_context *reg_common_open_remote(const char *remote, } struct registry_key *reg_common_open_file(const char *path, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct cli_credentials *creds) { @@ -49,7 +50,7 @@ struct registry_key *reg_common_open_file(const char *path, struct registry_context *h = NULL; WERROR error; - error = reg_open_hive(NULL, path, NULL, creds, lp_ctx, &hive_root); + error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to open '%s': %s \n", @@ -67,12 +68,14 @@ struct registry_key *reg_common_open_file(const char *path, return reg_import_hive_key(h, hive_root, -1, NULL); } -struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx) +struct registry_context *reg_common_open_local(struct cli_credentials *creds, + struct event_context *ev_ctx, + struct loadparm_context *lp_ctx) { WERROR error; struct registry_context *h = NULL; - error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds); + error = reg_open_samba(NULL, &h, ev_ctx, lp_ctx, NULL, creds); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to open local registry:%s \n", diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 69fcfc2493..9b49799bed 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -29,6 +29,7 @@ enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL }; static struct registry_context *open_backend(poptContext pc, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, enum reg_backend backend, const char *remote_host) @@ -41,7 +42,7 @@ static struct registry_context *open_backend(poptContext pc, poptPrintUsage(pc, stderr, 0); return NULL; case REG_LOCAL: - error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials); + error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials); break; case REG_REMOTE: error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx, @@ -82,6 +83,7 @@ int main(int argc, const char **argv) }; TALLOC_CTX *ctx; void *callback_data; + struct event_context *ev_ctx; struct reg_diff_callbacks *callbacks; ctx = talloc_init("regdiff"); @@ -116,11 +118,13 @@ int main(int argc, const char **argv) } - h1 = open_backend(pc, cmdline_lp_ctx, backend1, remote1); + ev_ctx = event_context_init(NULL); + + h1 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend1, remote1); if (h1 == NULL) return 1; - h2 = open_backend(pc, cmdline_lp_ctx, backend2, remote2); + h2 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend2, remote2); if (h2 == NULL) return 1; diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index 98443e6456..9285459d85 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -24,6 +24,7 @@ #include "lib/cmdline/popt_common.h" #include "lib/registry/tools/common.h" #include "param/param.h" +#include "events/events.h" int main(int argc, char **argv) { @@ -33,6 +34,7 @@ int main(int argc, char **argv) struct registry_context *h; const char *file = NULL; const char *remote = NULL; + struct event_context *ev; struct poptOption long_options[] = { POPT_AUTOHELP {"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL}, @@ -47,10 +49,12 @@ int main(int argc, char **argv) while((opt = poptGetNextOpt(pc)) != -1) { } + ev = event_context_init(NULL); + if (remote) { h = reg_common_open_remote (remote, cmdline_lp_ctx, cmdline_credentials); } else { - h = reg_common_open_local (cmdline_credentials, cmdline_lp_ctx); + h = reg_common_open_local (cmdline_credentials, ev, cmdline_lp_ctx); } if (h == NULL) diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 58f64cb049..80eafcc4a2 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -498,6 +498,7 @@ int main(int argc, char **argv) poptContext pc; const char *remote = NULL; struct regshell_context *ctx; + struct event_context *ev_ctx; bool ret = true; struct poptOption long_options[] = { POPT_AUTOHELP @@ -516,17 +517,19 @@ int main(int argc, char **argv) ctx = talloc_zero(NULL, struct regshell_context); + ev_ctx = event_context_init(ctx); + if (remote != NULL) { ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials); } else if (file != NULL) { - ctx->current = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials); + ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials); if (ctx->current == NULL) return 1; ctx->registry = ctx->current->context; ctx->path = talloc_strdup(ctx, ""); } else { - ctx->registry = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx); + ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx); } if (ctx->registry == NULL) diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 424d3515e0..440399f764 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -109,6 +109,7 @@ int main(int argc, char **argv) poptContext pc; struct registry_context *h = NULL; struct registry_key *start_key = NULL; + struct event_context *ev_ctx; WERROR error; bool fullpath = false, no_values = false; struct poptOption long_options[] = { @@ -128,12 +129,14 @@ int main(int argc, char **argv) while((opt = poptGetNextOpt(pc)) != -1) { } + ev_ctx = event_context_init(NULL); + if (remote != NULL) { h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials); } else if (file != NULL) { - start_key = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials); + start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials); } else { - h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx); + h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx); } if (h == NULL && start_key == NULL) |