1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

Remove more usages of global_loadparm.

This commit is contained in:
Jelmer Vernooij
2008-10-24 14:57:03 +02:00
parent 61013deff8
commit 27dce768d3
7 changed files with 50 additions and 27 deletions

View File

@ -479,7 +479,9 @@ static WERROR reg_diff_apply_del_all_values(void *_ctx, const char *key_name)
/** /**
* Apply diff to a registry context * Apply diff to a registry context
*/ */
_PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx, const char *filename) _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx,
struct smb_iconv_convenience *iconv_convenience,
const char *filename)
{ {
struct reg_diff_callbacks callbacks; struct reg_diff_callbacks callbacks;
@ -490,6 +492,6 @@ _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx, const char *filenam
callbacks.del_all_values = reg_diff_apply_del_all_values; callbacks.del_all_values = reg_diff_apply_del_all_values;
callbacks.done = NULL; callbacks.done = NULL;
return reg_diff_load(filename, lp_iconv_convenience(global_loadparm), return reg_diff_load(filename, iconv_convenience,
&callbacks, ctx); &callbacks, ctx);
} }

View File

@ -484,7 +484,8 @@ struct reg_diff_callbacks {
WERROR (*done) (void *callback_data); WERROR (*done) (void *callback_data);
}; };
WERROR reg_diff_apply(struct registry_context *ctx, const char *filename); WERROR reg_diff_apply(struct registry_context *ctx,
struct smb_iconv_convenience *ic, const char *filename);
WERROR reg_generate_diff(struct registry_context *ctx1, WERROR reg_generate_diff(struct registry_context *ctx1,
struct registry_context *ctx2, struct registry_context *ctx2,

View File

@ -31,6 +31,7 @@
#include "registry.h" #include "registry.h"
#include "param/param.h" #include "param/param.h"
#include "events/events.h" #include "events/events.h"
#include "scripting/python/modules.h"
typedef struct registry_context reg; typedef struct registry_context reg;
typedef struct hive_key hive_key; typedef struct hive_key hive_key;
@ -62,6 +63,14 @@ const char *str_regtype(int type);
$result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_registry_context, 0); $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_registry_context, 0);
} }
%typemap(in,noblock=1) struct smb_iconv_convenience * {
$1 = py_iconv_convenience(NULL);
}
%typemap(freearg,noblock=1) struct smb_iconv_convenience * {
talloc_free($1);
}
%rename(Registry) reg_open_local; %rename(Registry) reg_open_local;
WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx); WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx);
@ -111,7 +120,7 @@ typedef struct registry_context {
%feature("docstring") diff_apply "S.diff_apply(filename) -> None\n" %feature("docstring") diff_apply "S.diff_apply(filename) -> None\n"
"Apply the diff from the specified file"; "Apply the diff from the specified file";
WERROR diff_apply(const char *filename); WERROR diff_apply(struct smb_iconv_convenience *ic, const char *filename);
WERROR generate_diff(struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks, WERROR generate_diff(struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks,
void *callback_data); void *callback_data);

View File

@ -2502,12 +2502,13 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_registry_key swig_types[19] #define SWIGTYPE_p_registry_key swig_types[19]
#define SWIGTYPE_p_short swig_types[20] #define SWIGTYPE_p_short swig_types[20]
#define SWIGTYPE_p_signed_char swig_types[21] #define SWIGTYPE_p_signed_char swig_types[21]
#define SWIGTYPE_p_unsigned_char swig_types[22] #define SWIGTYPE_p_smb_iconv_convenience swig_types[22]
#define SWIGTYPE_p_unsigned_int swig_types[23] #define SWIGTYPE_p_unsigned_char swig_types[23]
#define SWIGTYPE_p_unsigned_long_long swig_types[24] #define SWIGTYPE_p_unsigned_int swig_types[24]
#define SWIGTYPE_p_unsigned_short swig_types[25] #define SWIGTYPE_p_unsigned_long_long swig_types[25]
static swig_type_info *swig_types[27]; #define SWIGTYPE_p_unsigned_short swig_types[26]
static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0}; static swig_type_info *swig_types[28];
static swig_module_info swig_module = {swig_types, 27, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2555,6 +2556,7 @@ static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
#include "registry.h" #include "registry.h"
#include "param/param.h" #include "param/param.h"
#include "events/events.h" #include "events/events.h"
#include "scripting/python/modules.h"
typedef struct registry_context reg; typedef struct registry_context reg;
typedef struct hive_key hive_key; typedef struct hive_key hive_key;
@ -3107,41 +3109,46 @@ fail:
SWIGINTERN PyObject *_wrap_reg_diff_apply(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { SWIGINTERN PyObject *_wrap_reg_diff_apply(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0; PyObject *resultobj = 0;
reg *arg1 = (reg *) 0 ; reg *arg1 = (reg *) 0 ;
char *arg2 = (char *) 0 ; struct smb_iconv_convenience *arg2 = (struct smb_iconv_convenience *) 0 ;
char *arg3 = (char *) 0 ;
void *argp1 = 0 ; void *argp1 = 0 ;
int res1 = 0 ; int res1 = 0 ;
int res2 ; int res3 ;
char *buf2 = 0 ; char *buf3 = 0 ;
int alloc2 = 0 ; int alloc3 = 0 ;
PyObject * obj0 = 0 ; PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ; PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
char * kwnames[] = { char * kwnames[] = {
(char *) "self",(char *) "filename", NULL (char *) "self",(char *) "ic",(char *) "filename", NULL
}; };
WERROR result; WERROR result;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:reg_diff_apply",kwnames,&obj0,&obj1)) SWIG_fail; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:reg_diff_apply",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_registry_context, 0 | 0 ); res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_registry_context, 0 | 0 );
if (!SWIG_IsOK(res1)) { if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "reg_diff_apply" "', argument " "1"" of type '" "reg *""'"); SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "reg_diff_apply" "', argument " "1"" of type '" "reg *""'");
} }
arg1 = (reg *)(argp1); arg1 = (reg *)(argp1);
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); arg2 = py_iconv_convenience(NULL);
if (!SWIG_IsOK(res2)) { res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "reg_diff_apply" "', argument " "2"" of type '" "char const *""'"); if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "reg_diff_apply" "', argument " "3"" of type '" "char const *""'");
} }
arg2 = (char *)(buf2); arg3 = (char *)(buf3);
result = reg_diff_apply(arg1,(char const *)arg2); result = reg_diff_apply(arg1,arg2,(char const *)arg3);
if (!W_ERROR_IS_OK(result)) { if (!W_ERROR_IS_OK(result)) {
PyErr_SetWERROR(result); PyErr_SetWERROR(result);
SWIG_fail; SWIG_fail;
} else if (resultobj == NULL) { } else if (resultobj == NULL) {
resultobj = Py_None; resultobj = Py_None;
} }
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); talloc_free(arg2);
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
return resultobj; return resultobj;
fail: fail:
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2); talloc_free(arg2);
if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
return NULL; return NULL;
} }
@ -3849,6 +3856,7 @@ static swig_type_info _swigt__p_registry_context = {"_p_registry_context", "stru
static swig_type_info _swigt__p_registry_key = {"_p_registry_key", "struct registry_key *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_registry_key = {"_p_registry_key", "struct registry_key *", 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_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_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_smb_iconv_convenience = {"_p_smb_iconv_convenience", "struct smb_iconv_convenience *", 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_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_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_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
@ -3877,6 +3885,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_registry_key, &_swigt__p_registry_key,
&_swigt__p_short, &_swigt__p_short,
&_swigt__p_signed_char, &_swigt__p_signed_char,
&_swigt__p_smb_iconv_convenience,
&_swigt__p_unsigned_char, &_swigt__p_unsigned_char,
&_swigt__p_unsigned_int, &_swigt__p_unsigned_int,
&_swigt__p_unsigned_long_long, &_swigt__p_unsigned_long_long,
@ -3905,6 +3914,7 @@ static swig_cast_info _swigc__p_registry_context[] = { {&_swigt__p_registry_con
static swig_cast_info _swigc__p_registry_key[] = { {&_swigt__p_registry_key, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_registry_key[] = { {&_swigt__p_registry_key, 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_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_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_smb_iconv_convenience[] = { {&_swigt__p_smb_iconv_convenience, 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_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_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_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
@ -3933,6 +3943,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_registry_key, _swigc__p_registry_key,
_swigc__p_short, _swigc__p_short,
_swigc__p_signed_char, _swigc__p_signed_char,
_swigc__p_smb_iconv_convenience,
_swigc__p_unsigned_char, _swigc__p_unsigned_char,
_swigc__p_unsigned_int, _swigc__p_unsigned_int,
_swigc__p_unsigned_long_long, _swigc__p_unsigned_long_long,

View File

@ -71,7 +71,7 @@ static bool test_diff_apply(struct torture_context *tctx, void *tcase_data)
struct registry_key *key; struct registry_key *key;
WERROR error; WERROR error;
error = reg_diff_apply(td->r1_ctx, td->filename); error = reg_diff_apply(td->r1_ctx, lp_iconv_convenience(tctx->lp_ctx), td->filename);
torture_assert_werr_ok(tctx, error, "reg_diff_apply"); torture_assert_werr_ok(tctx, error, "reg_diff_apply");
error = td->r1_ctx->ops->get_predefined_key(td->r1_ctx, HKEY_LOCAL_MACHINE, &key); error = td->r1_ctx->ops->get_predefined_key(td->r1_ctx, HKEY_LOCAL_MACHINE, &key);

View File

@ -68,7 +68,7 @@ int main(int argc, char **argv)
poptFreeContext(pc); poptFreeContext(pc);
reg_diff_apply(h, patch); reg_diff_apply(h, lp_iconv_convenience(cmdline_lp_ctx), patch);
return 0; return 0;
} }

View File

@ -260,7 +260,7 @@ static NTSTATUS session_setup_nt1(struct composite_context *c,
{ {
NTSTATUS nt_status = NT_STATUS_INTERNAL_ERROR; NTSTATUS nt_status = NT_STATUS_INTERNAL_ERROR;
struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state); struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state);
DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, lp_workgroup(global_loadparm)); DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, cli_credentials_get_domain(io->in.credentials));
DATA_BLOB session_key = data_blob(NULL, 0); DATA_BLOB session_key = data_blob(NULL, 0);
int flags = CLI_CRED_NTLM_AUTH; int flags = CLI_CRED_NTLM_AUTH;
@ -334,7 +334,7 @@ static NTSTATUS session_setup_old(struct composite_context *c,
NTSTATUS nt_status; NTSTATUS nt_status;
struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state); struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state);
const char *password = cli_credentials_get_password(io->in.credentials); const char *password = cli_credentials_get_password(io->in.credentials);
DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, lp_workgroup(global_loadparm)); DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, cli_credentials_get_domain(io->in.credentials));
DATA_BLOB session_key; DATA_BLOB session_key;
int flags = 0; int flags = 0;
if (session->options.lanman_auth) { if (session->options.lanman_auth) {