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

Remove yet more uses of global_loadparm.

(This used to be commit e01c1e87c0)
This commit is contained in:
Jelmer Vernooij
2008-02-21 17:17:37 +01:00
parent d63321a41e
commit c38c2765d1
33 changed files with 127 additions and 72 deletions

View File

@ -92,7 +92,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_
NTSTATUS status;
/* listen for unicasts on the CLDAP port (389) */
cldapsock = cldap_socket_init(cldapd, cldapd->task->event_ctx);
cldapsock = cldap_socket_init(cldapd, cldapd->task->event_ctx, lp_iconv_convenience(cldapd->task->lp_ctx));
NT_STATUS_HAVE_NO_MEMORY(cldapsock);
socket_address = socket_address_from_strings(cldapsock, cldapsock->sock->backend_name,

View File

@ -1168,8 +1168,8 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char *arg)
{
NTSTATUS nt_status;
/* The global kdc_mem_ctx, Disgusting, ugly hack, but it means one less private hook */
nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, global_loadparm,
/* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */
nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx,
context, db, arg);
if (NT_STATUS_IS_OK(nt_status)) {

View File

@ -41,8 +41,10 @@
#include "param/param.h"
/* Disgusting hack to get a mem_ctx into the hdb plugin, when used as a keytab */
/* Disgusting hack to get a mem_ctx and lp_ctx into the hdb plugin, when
* used as a keytab */
TALLOC_CTX *kdc_mem_ctx;
struct loadparm_context *kdc_lp_ctx;
/* hold all the info needed to send a reply */
struct kdc_reply {
@ -648,6 +650,7 @@ static void kdc_task_init(struct task_server *task)
krb5_kdc_windc_init(kdc->smb_krb5_context->krb5_context);
kdc_mem_ctx = kdc->smb_krb5_context;
kdc_lp_ctx = task->lp_ctx;
/* start listening on the configured network interfaces */
status = kdc_startup_interfaces(kdc, task->lp_ctx, ifaces);

View File

@ -30,6 +30,7 @@ struct kdc_server;
struct socket_address;
extern TALLOC_CTX *kdc_mem_ctx;
extern struct loadparm_context *kdc_lp_ctx;
bool kpasswdd_process(struct kdc_server *kdc,
TALLOC_CTX *mem_ctx,

View File

@ -22,6 +22,7 @@
#include "includes.h"
#include "hive.h"
#include "system/filesys.h"
#include "param/param.h"
/** Open a registry file/host/etc */
_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
@ -52,7 +53,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
if (!strncmp(peek, "regf", 4)) {
close(fd);
return reg_open_regf_file(parent_ctx, location, lp_ctx, root);
return reg_open_regf_file(parent_ctx, location, lp_iconv_convenience(lp_ctx), root);
} else if (!strncmp(peek, "TDB file", 8)) {
close(fd);
return reg_open_ldb_file(parent_ctx, location, session_info,

View File

@ -188,7 +188,7 @@ WERROR hive_key_flush(struct hive_key *key);
WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
const char *location, struct hive_key **key);
WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
const char *location, struct loadparm_context *lp_ctx,
const char *location, struct smb_iconv_convenience *iconv_convenience,
struct hive_key **key);
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
@ -200,6 +200,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
const char *location, struct hive_key **key);
WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
struct smb_iconv_convenience *iconv_convenience,
const char *location,
int major_version,
struct hive_key **key);

View File

@ -1863,7 +1863,9 @@ static WERROR regf_save_hbin(struct regf_data *regf)
return WERR_OK;
}
WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
struct smb_iconv_convenience *iconv_convenience,
const char *location,
int minor_version, struct hive_key **key)
{
struct regf_data *regf;
@ -1874,7 +1876,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
regf->iconv_convenience = lp_iconv_convenience(global_loadparm);
regf->iconv_convenience = iconv_convenience;
W_ERROR_HAVE_NO_MEMORY(regf);
@ -1950,7 +1952,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
}
WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
struct loadparm_context *lp_ctx, struct hive_key **key)
struct smb_iconv_convenience *iconv_convenience, struct hive_key **key)
{
struct regf_data *regf;
struct regf_hdr *regf_hdr;
@ -1959,7 +1961,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
regf->iconv_convenience = lp_iconv_convenience(lp_ctx);
regf->iconv_convenience = iconv_convenience;
W_ERROR_HAVE_NO_MEMORY(regf);

View File

@ -25,6 +25,7 @@
#include "torture/torture.h"
#include "librpc/gen_ndr/winreg.h"
#include "system/filesys.h"
#include "param/param.h"
static bool test_del_nonexistant_key(struct torture_context *tctx,
const void *test_data)
@ -349,7 +350,8 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data)
rmdir(dirname);
error = reg_create_regf_file(tctx, dirname, 5, &key);
error = reg_create_regf_file(tctx, lp_iconv_convenience(tctx->lp_ctx),
dirname, 5, &key);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to create new regf file\n");
return false;

View File

@ -241,7 +241,8 @@ static void cldap_socket_handler(struct event_context *ev, struct fd_event *fde,
then operations will use that event context
*/
struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx)
struct event_context *event_ctx,
struct smb_iconv_convenience *iconv_convenience)
{
struct cldap_socket *cldap;
NTSTATUS status;
@ -270,6 +271,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
cldap->send_queue = NULL;
cldap->incoming.handler = NULL;
cldap->iconv_convenience = iconv_convenience;
return cldap;
@ -618,7 +620,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,
lp_iconv_convenience(global_loadparm),
req->cldap->iconv_convenience,
&io->out.netlogon,
io->in.version & 0xF,
(ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
@ -714,7 +716,7 @@ NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
DATA_BLOB blob;
ndr_err = ndr_push_union_blob(&blob, tmp_ctx,
lp_iconv_convenience(global_loadparm),
cldap->iconv_convenience,
netlogon, version & 0xF,
(ndr_push_flags_fn_t)ndr_push_nbt_cldap_netlogon);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {

View File

@ -73,6 +73,7 @@ struct cldap_request {
struct cldap_socket {
struct socket_context *sock;
struct event_context *event_ctx;
struct smb_iconv_convenience *iconv_convenience;
/* the fd event */
struct fd_event *fde;
@ -111,7 +112,8 @@ struct cldap_search {
};
struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx);
struct event_context *event_ctx,
struct smb_iconv_convenience *iconv_convenience);
NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
void (*handler)(struct cldap_socket *, struct ldap_message *,
struct socket_address *),

View File

@ -94,6 +94,7 @@ struct nbt_name_request {
struct nbt_name_socket {
struct socket_context *sock;
struct event_context *event_ctx;
struct smb_iconv_convenience *iconv_convenience;
/* a queue of requests pending to be sent */
struct nbt_name_request *send_queue;

View File

@ -190,7 +190,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
}
/* parse the request */
ndr_err = ndr_pull_struct_blob(&blob, packet, lp_iconv_convenience(global_loadparm), packet,
ndr_err = ndr_pull_struct_blob(&blob, packet, nbtsock->iconv_convenience, packet,
(ndr_pull_flags_fn_t)ndr_pull_nbt_name_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@ -309,7 +309,8 @@ static void nbt_name_socket_handler(struct event_context *ev, struct fd_event *f
then operations will use that event context
*/
_PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx)
struct event_context *event_ctx,
struct smb_iconv_convenience *iconv_convenience)
{
struct nbt_name_socket *nbtsock;
NTSTATUS status;
@ -338,6 +339,7 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
nbtsock->num_pending = 0;
nbtsock->incoming.handler = NULL;
nbtsock->unexpected.handler = NULL;
nbtsock->iconv_convenience = iconv_convenience;
nbtsock->fde = event_add_fd(nbtsock->event_ctx, nbtsock,
socket_get_fd(nbtsock->sock), 0,
@ -395,7 +397,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
talloc_set_destructor(req, nbt_name_request_destructor);
ndr_err = ndr_push_struct_blob(&req->encoded, req,
lp_iconv_convenience(global_loadparm),
req->nbtsock->iconv_convenience,
request,
(ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
@ -444,7 +446,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
}
ndr_err = ndr_push_struct_blob(&req->encoded, req,
lp_iconv_convenience(global_loadparm),
req->nbtsock->iconv_convenience,
request,
(ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {

View File

@ -29,6 +29,7 @@
struct resolve_bcast_data {
struct interface *ifaces;
uint16_t nbt_port;
int nbt_timeout;
};
/**
@ -62,7 +63,7 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
}
address_list[count] = NULL;
c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, true, false);
c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, data->nbt_timeout, true, false);
talloc_free(address_list);
return c;
@ -84,22 +85,25 @@ NTSTATUS resolve_name_bcast(struct nbt_name *name,
TALLOC_CTX *mem_ctx,
struct interface *ifaces,
uint16_t nbt_port,
int nbt_timeout,
const char **reply_addr)
{
struct resolve_bcast_data *data = talloc(mem_ctx, struct resolve_bcast_data);
struct composite_context *c;
data->ifaces = talloc_reference(data, ifaces);
data->nbt_port = nbt_port;
data->nbt_timeout = nbt_timeout;
c = resolve_name_bcast_send(mem_ctx, NULL, data, name);
return resolve_name_bcast_recv(c, mem_ctx, reply_addr);
}
bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port)
bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout)
{
struct resolve_bcast_data *data = talloc(ctx, struct resolve_bcast_data);
data->ifaces = ifaces;
data->nbt_port = nbt_port;
data->nbt_timeout = nbt_timeout;
return resolve_context_add_method(ctx, resolve_name_bcast_send, resolve_name_bcast_recv, data);
}
@ -107,5 +111,5 @@ bool resolve_context_add_bcast_method_lp(struct resolve_context *ctx, struct loa
{
struct interface *ifaces;
load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx));
return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
}

View File

@ -102,6 +102,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
const char **address_list,
struct interface *ifaces,
uint16_t nbt_port,
int nbt_timeout,
bool broadcast,
bool wins_lookup)
{
@ -161,7 +162,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
state->io_queries[i].in.broadcast = broadcast;
state->io_queries[i].in.wins_lookup = wins_lookup;
state->io_queries[i].in.timeout = lp_parm_int(global_loadparm, NULL, "nbt", "timeout", 1);
state->io_queries[i].in.timeout = nbt_timeout;
state->io_queries[i].in.retries = 2;
state->queries[i] = nbt_name_query_send(state->nbtsock, &state->io_queries[i]);
@ -201,12 +202,14 @@ NTSTATUS resolve_name_nbtlist(struct nbt_name *name,
const char **address_list,
struct interface *ifaces,
uint16_t nbt_port,
int nbt_timeout,
bool broadcast, bool wins_lookup,
const char **reply_addr)
{
struct composite_context *c = resolve_name_nbtlist_send(mem_ctx, NULL,
name, address_list,
ifaces, nbt_port,
nbt_timeout,
broadcast, wins_lookup);
return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr);
}

View File

@ -29,6 +29,7 @@ struct resolve_wins_data {
const char **address_list;
struct interface *ifaces;
uint16_t nbt_port;
int nbt_timeout;
};
/**
@ -42,7 +43,7 @@ struct composite_context *resolve_name_wins_send(
{
struct resolve_wins_data *wins_data = talloc_get_type(userdata, struct resolve_wins_data);
if (wins_data->address_list == NULL) return NULL;
return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, false, true);
return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, wins_data->nbt_timeout, false, true);
}
/*
@ -62,6 +63,7 @@ NTSTATUS resolve_name_wins(struct nbt_name *name,
const char **address_list,
struct interface *ifaces,
uint16_t nbt_port,
int nbt_timeout,
const char **reply_addr)
{
struct composite_context *c;
@ -69,16 +71,18 @@ NTSTATUS resolve_name_wins(struct nbt_name *name,
wins_data->address_list = address_list;
wins_data->ifaces = ifaces;
wins_data->nbt_port = nbt_port;
wins_data->nbt_timeout = nbt_timeout;
c = resolve_name_wins_send(mem_ctx, NULL, wins_data, name);
return resolve_name_wins_recv(c, mem_ctx, reply_addr);
}
bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port)
bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout)
{
struct resolve_wins_data *wins_data = talloc(ctx, struct resolve_wins_data);
wins_data->address_list = str_list_copy(wins_data, address_list);
wins_data->ifaces = talloc_reference(wins_data, ifaces);
wins_data->nbt_port = nbt_port;
wins_data->nbt_timeout = nbt_timeout;
return resolve_context_add_method(ctx, resolve_name_wins_send, resolve_name_wins_recv,
wins_data);
}
@ -87,5 +91,5 @@ bool resolve_context_add_wins_method_lp(struct resolve_context *ctx, struct load
{
struct interface *ifaces;
load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx));
return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
}

View File

@ -46,7 +46,8 @@
/* Function prototypes */
struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx);
struct event_context *event_ctx,
struct smb_iconv_convenience *iconv_convenience);
enum nbt_name_type {
NBT_NAME_CLIENT=0x00,

View File

@ -2469,12 +2469,13 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_p_char swig_types[10]
#define SWIGTYPE_p_short swig_types[11]
#define SWIGTYPE_p_signed_char swig_types[12]
#define SWIGTYPE_p_unsigned_char swig_types[13]
#define SWIGTYPE_p_unsigned_int swig_types[14]
#define SWIGTYPE_p_unsigned_long_long swig_types[15]
#define SWIGTYPE_p_unsigned_short swig_types[16]
static swig_type_info *swig_types[18];
static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
#define SWIGTYPE_p_smb_iconv_convenience swig_types[13]
#define SWIGTYPE_p_unsigned_char swig_types[14]
#define SWIGTYPE_p_unsigned_int swig_types[15]
#define SWIGTYPE_p_unsigned_long_long swig_types[16]
#define SWIGTYPE_p_unsigned_short swig_types[17]
static swig_type_info *swig_types[19];
static swig_module_info swig_module = {swig_types, 18, 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)
@ -2918,17 +2919,21 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self),
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
struct event_context *arg2 = (struct event_context *) 0 ;
struct smb_iconv_convenience *arg3 = (struct smb_iconv_convenience *) 0 ;
struct nbt_name_socket *result = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
void *argp3 = 0 ;
int res3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char * kwnames[] = {
(char *) "event_ctx", NULL
(char *) "event_ctx",(char *) "iconv_convenience", NULL
};
arg2 = event_context_init(NULL);
arg1 = NULL;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:nbt_name_socket_init",kwnames,&obj0)) SWIG_fail;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:nbt_name_socket_init",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res2)) {
@ -2936,7 +2941,14 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self),
}
arg2 = (struct event_context *)(argp2);
}
result = (struct nbt_name_socket *)nbt_name_socket_init(arg1,arg2);
if (obj1) {
res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_smb_iconv_convenience, 0 | 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "nbt_name_socket_init" "', argument " "3"" of type '" "struct smb_iconv_convenience *""'");
}
arg3 = (struct smb_iconv_convenience *)(argp3);
}
result = (struct nbt_name_socket *)nbt_name_socket_init(arg1,arg2,arg3);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_socket, 0 | 0 );
return resultobj;
fail:
@ -4135,6 +4147,7 @@ static swig_type_info _swigt__p_nbt_name_socket = {"_p_nbt_name_socket", "struct
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 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_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_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};
@ -4154,6 +4167,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_p_char,
&_swigt__p_short,
&_swigt__p_signed_char,
&_swigt__p_smb_iconv_convenience,
&_swigt__p_unsigned_char,
&_swigt__p_unsigned_int,
&_swigt__p_unsigned_long_long,
@ -4173,6 +4187,7 @@ static swig_cast_info _swigc__p_nbt_name_socket[] = { {&_swigt__p_nbt_name_sock
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_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_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_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}};
@ -4192,6 +4207,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_p_char,
_swigc__p_short,
_swigc__p_signed_char,
_swigc__p_smb_iconv_convenience,
_swigc__p_unsigned_char,
_swigc__p_unsigned_int,
_swigc__p_unsigned_long_long,

View File

@ -102,7 +102,7 @@ static NTSTATUS wrepl_finish_recv(void *private, DATA_BLOB packet_blob_in)
blob.length = packet_blob_in.length - 4;
/* we have a full request - parse it */
ndr_err = ndr_pull_struct_blob(&blob, req->packet, lp_iconv_convenience(global_loadparm), req->packet,
ndr_err = ndr_pull_struct_blob(&blob, req->packet, wrepl_socket->iconv_convenience, req->packet,
(ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@ -163,7 +163,8 @@ static int wrepl_socket_destructor(struct wrepl_socket *sock)
operations will use that event context
*/
struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx)
struct event_context *event_ctx,
struct smb_iconv_convenience *iconv_convenience)
{
struct wrepl_socket *wrepl_socket;
NTSTATUS status;
@ -178,6 +179,8 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx,
}
if (!wrepl_socket->event.ctx) goto failed;
wrepl_socket->iconv_convenience = iconv_convenience;
status = socket_create("ip", SOCKET_TYPE_STREAM, &wrepl_socket->sock, 0);
if (!NT_STATUS_IS_OK(status)) goto failed;
@ -493,7 +496,7 @@ struct wrepl_request *wrepl_request_send(struct wrepl_socket *wrepl_socket,
}
wrap.packet = *packet;
ndr_err = ndr_push_struct_blob(&blob, req, lp_iconv_convenience(global_loadparm), &wrap,
ndr_err = ndr_push_struct_blob(&blob, req, wrepl_socket->iconv_convenience, &wrap,
(ndr_push_flags_fn_t)ndr_push_wrepl_wrap);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);

View File

@ -49,6 +49,8 @@ struct wrepl_socket {
/* remember if we need to free the wrepl_socket at the end of wrepl_socket_dead() */
bool free_skipped;
struct smb_iconv_convenience *iconv_convenience;
};
struct wrepl_send_ctrl {

View File

@ -130,7 +130,7 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
struct nbt_name_socket *bcast_nbtsock;
/* listen for broadcasts on port 137 */
bcast_nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
bcast_nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx, lp_iconv_convenience(nbtsrv->task->lp_ctx));
if (!bcast_nbtsock) {
talloc_free(iface);
return NT_STATUS_NO_MEMORY;
@ -156,7 +156,8 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
}
/* listen for unicasts on port 137 */
iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx,
lp_iconv_convenience(nbtsrv->task->lp_ctx));
if (!iface->nbtsock) {
talloc_free(iface);
return NT_STATUS_NO_MEMORY;

View File

@ -134,12 +134,12 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx,
resolve a wildcard rename pattern.
*/
static const char *pvfs_resolve_wildcard(TALLOC_CTX *mem_ctx,
struct smb_iconv_convenience *iconv_convenience,
const char *fname,
const char *pattern)
{
const char *base1, *base2;
const char *ext1, *ext2;
struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
char *p;
/* break into base part plus extension */
@ -196,7 +196,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs,
struct odb_lock *lck, *lck2;
/* resolve the wildcard pattern for this name */
fname2 = pvfs_resolve_wildcard(mem_ctx, fname1, fname2);
fname2 = pvfs_resolve_wildcard(mem_ctx, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), fname1, fname2);
if (fname2 == NULL) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -329,14 +329,15 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
reduce a name that contains .. components or repeated \ separators
return NULL if it can't be reduced
*/
static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t flags)
static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx,
struct smb_iconv_convenience *iconv_convenience,
const char **fname, uint_t flags)
{
codepoint_t c;
size_t c_size, len;
int i, num_components, err_count;
char **components;
char *p, *s, *ret;
struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
s = talloc_strdup(mem_ctx, *fname);
if (s == NULL) return NT_STATUS_NO_MEMORY;
@ -471,7 +472,7 @@ NTSTATUS pvfs_resolve_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD)) {
/* it might contain .. components which need to be reduced */
status = pvfs_reduce_name(*name, &cifs_name, flags);
status = pvfs_reduce_name(*name, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), &cifs_name, flags);
if (!NT_STATUS_IS_OK(status)) {
return status;
}

View File

@ -244,11 +244,6 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde,
static NTSTATUS inotify_setup(struct sys_notify_context *ctx)
{
struct inotify_private *in;
if (!lp_parm_bool(global_loadparm, NULL, "notify", "inotify", true)) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
in = talloc(ctx, struct inotify_private);
NT_STATUS_HAVE_NO_MEMORY(in);
in->fd = inotify_init();
@ -339,6 +334,10 @@ static NTSTATUS inotify_watch(struct sys_notify_context *ctx,
/* maybe setup the inotify fd */
if (ctx->private_data == NULL) {
NTSTATUS status;
if (!lp_parm_bool(global_loadparm, NULL, "notify", "inotify", true)) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
status = inotify_setup(ctx);
NT_STATUS_NOT_OK_RETURN(status);
}

View File

@ -38,7 +38,7 @@
*/
static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest)
{
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
NTSTATUS status;
struct cldap_netlogon search, empty_search;
union nbt_cldap_netlogon n1;
@ -244,7 +244,7 @@ static void cldap_dump_results(struct cldap_search *search)
*/
static bool test_cldap_generic(struct torture_context *tctx, const char *dest)
{
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
NTSTATUS status;
struct cldap_search search;
const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL };

View File

@ -51,7 +51,7 @@ static void request_handler(struct cldap_request *req)
*/
static bool bench_cldap(struct torture_context *tctx, const char *address)
{
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
int num_sent=0;
struct timeval tv = timeval_current();
bool ret = true;

View File

@ -47,7 +47,8 @@ static void increment_handler(struct nbt_name_request *req)
*/
static bool bench_namequery(struct torture_context *tctx)
{
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
lp_iconv_convenience(tctx->lp_ctx));
int num_sent=0;
struct result_struct *result;
struct nbt_name_query io;

View File

@ -44,7 +44,8 @@ static bool nbt_register_own(struct torture_context *tctx)
{
struct nbt_name_register io;
NTSTATUS status;
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
lp_iconv_convenience(tctx->lp_ctx));
struct socket_address *socket_address;
struct nbt_name name;
const char *address;
@ -113,7 +114,8 @@ static bool nbt_refresh_own(struct torture_context *tctx)
{
struct nbt_name_refresh io;
NTSTATUS status;
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
lp_iconv_convenience(tctx->lp_ctx));
const char *myaddress;
struct socket_address *socket_address;
struct nbt_name name;

View File

@ -53,7 +53,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
struct nbt_name_refresh_wins refresh;
struct nbt_name_release release;
NTSTATUS status;
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
const char *myaddress;
struct socket_address *socket_address;
struct interface *ifaces;

View File

@ -225,7 +225,7 @@ static void generate_request(struct nbt_name_socket *nbtsock, struct wins_state
*/
static bool bench_wins(struct torture_context *tctx)
{
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
int num_sent=0;
struct timeval tv = timeval_current();
bool ret = true;

View File

@ -103,8 +103,8 @@ static bool test_assoc_ctx1(struct torture_context *tctx)
torture_comment(tctx, "Test if assoc_ctx is only valid on the conection it was created on\n");
wrepl_socket1 = wrepl_socket_init(tctx, NULL);
wrepl_socket2 = wrepl_socket_init(tctx, NULL);
wrepl_socket1 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket2 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
torture_comment(tctx, "Setup 2 wrepl connections\n");
status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), NULL, address);
@ -186,7 +186,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx)
torture_comment(tctx, "Test if we always get back the same assoc_ctx\n");
wrepl_socket = wrepl_socket_init(tctx, NULL);
wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
torture_comment(tctx, "Setup wrepl connections\n");
status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, address);
@ -255,7 +255,7 @@ static bool test_wins_replication(struct torture_context *tctx)
torture_comment(tctx, "Test one pull replication cycle\n");
wrepl_socket = wrepl_socket_init(tctx, NULL);
wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
torture_comment(tctx, "Setup wrepl connections\n");
status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, address);
@ -553,7 +553,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
if (!ctx) return NULL;
ctx->address = address;
ctx->pull = wrepl_socket_init(ctx, NULL);
ctx->pull = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->pull) return NULL;
torture_comment(tctx, "Setup wrepl conflict pull connection\n");
@ -610,7 +610,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
talloc_free(pull_table.out.partners);
ctx->nbtsock = nbt_name_socket_init(ctx, NULL);
ctx->nbtsock = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->nbtsock) return NULL;
load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@ -628,7 +628,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
status = socket_listen(ctx->nbtsock->sock, ctx->myaddr, 0, 0);
if (!NT_STATUS_IS_OK(status)) return NULL;
ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL);
ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->nbtsock_srv) return NULL;
/* Make a port 137 version of ctx->myaddr */
@ -645,13 +645,13 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
}
if (ctx->myaddr2 && ctx->nbtsock_srv) {
ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL);
ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->nbtsock2) return NULL;
status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0);
if (!NT_STATUS_IS_OK(status)) return NULL;
ctx->nbtsock_srv2 = nbt_name_socket_init(ctx, ctx->nbtsock_srv->event_ctx);
ctx->nbtsock_srv2 = nbt_name_socket_init(ctx, ctx->nbtsock_srv->event_ctx, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->nbtsock_srv2) return NULL;
/* Make a port 137 version of ctx->myaddr2 */
@ -722,7 +722,7 @@ static bool test_wrepl_update_one(struct torture_context *tctx,
uint32_t assoc_ctx;
NTSTATUS status;
wrepl_socket = wrepl_socket_init(ctx, NULL);
wrepl_socket = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, ctx->address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);

View File

@ -255,7 +255,7 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
struct drsuapi_DsNameString names[1];
bool ret = true;
struct cldap_socket *cldap = cldap_socket_init(ctx, NULL);
struct cldap_socket *cldap = cldap_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
struct cldap_netlogon search;
r.in.bind_handle = &ctx->admin.drsuapi.bind_handle;

View File

@ -211,7 +211,7 @@ static bool process_one(struct loadparm_context *lp_ctx,
node_name = talloc_strdup(tmp_ctx, name);
}
nbtsock = nbt_name_socket_init(tmp_ctx, NULL);
nbtsock = nbt_name_socket_init(tmp_ctx, NULL, lp_iconv_convenience(lp_ctx));
if (options.root_port) {
all_zero_addr = socket_address_from_strings(tmp_ctx, nbtsock->sock->backend_name,

View File

@ -30,6 +30,7 @@
#include "libcli/composite/composite.h"
#include "libcli/wrepl/winsrepl.h"
#include "libcli/resolve/resolve.h"
#include "param/param.h"
enum wreplsrv_out_connect_stage {
WREPLSRV_OUT_CONNECT_STAGE_WAIT_SOCKET,
@ -186,7 +187,7 @@ static struct composite_context *wreplsrv_out_connect_send(struct wreplsrv_partn
wreplconn->service = service;
wreplconn->partner = partner;
wreplconn->sock = wrepl_socket_init(wreplconn, service->task->event_ctx);
wreplconn->sock = wrepl_socket_init(wreplconn, service->task->event_ctx, lp_iconv_convenience(service->task->lp_ctx));
if (!wreplconn->sock) goto failed;
state->stage = WREPLSRV_OUT_CONNECT_STAGE_WAIT_SOCKET;