1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

Remove more event_context_init() uses from function calls within deep down the code.

Make sure we pass around the event_context where we need it instead.
All test but a few python ones fail. Jelmer promised to fix them.
This commit is contained in:
Simo Sorce 2008-04-21 17:58:23 -04:00
parent ca7e4d9166
commit 3045d39162
60 changed files with 275 additions and 247 deletions

View File

@ -482,6 +482,11 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
struct messaging_context *msg,
struct gensec_security **gensec_security)
{
if (ev == NULL) {
DEBUG(0, ("No event context available!\n"));
return NT_STATUS_INTERNAL_ERROR;
}
(*gensec_security) = talloc(mem_ctx, struct gensec_security);
NT_STATUS_HAVE_NO_MEMORY(*gensec_security);
@ -493,14 +498,6 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
(*gensec_security)->subcontext = false;
(*gensec_security)->want_features = 0;
if (ev == NULL) {
ev = event_context_init(*gensec_security);
if (ev == NULL) {
talloc_free(*gensec_security);
return NT_STATUS_NO_MEMORY;
}
}
(*gensec_security)->event_ctx = ev;
(*gensec_security)->msg_ctx = msg;
@ -548,20 +545,11 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx)
{
NTSTATUS status;
struct event_context *new_ev = NULL;
if (ev == NULL) {
new_ev = event_context_init(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(new_ev);
ev = new_ev;
}
status = gensec_start(mem_ctx, ev, lp_ctx, NULL, gensec_security);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(new_ev);
return status;
}
talloc_steal((*gensec_security), new_ev);
(*gensec_security)->gensec_role = GENSEC_CLIENT;
return status;

View File

@ -24,6 +24,7 @@
#include "lib/cmdline/popt_common.h"
#include "libcli/resolve/resolve.h"
#include "libcli/raw/libcliraw.h"
#include "lib/events/events.h"
#include "cifsdd.h"
#include "param/param.h"
@ -354,6 +355,7 @@ static void print_transfer_stats(void)
}
static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * which, const char **ports,
struct smbcli_options *smb_options)
{
@ -375,13 +377,13 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
if (strcmp(which, "if") == 0) {
path = check_arg_pathname("if");
handle = dd_open_path(resolve_ctx, path, ports,
handle = dd_open_path(resolve_ctx, ev, path, ports,
check_arg_numeric("ibs"), options,
smb_options);
} else if (strcmp(which, "of") == 0) {
options |= DD_WRITE;
path = check_arg_pathname("of");
handle = dd_open_path(resolve_ctx, path, ports,
handle = dd_open_path(resolve_ctx, ev, path, ports,
check_arg_numeric("obs"), options,
smb_options);
} else {
@ -396,7 +398,7 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
return(handle);
}
static int copy_files(struct loadparm_context *lp_ctx)
static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
{
uint8_t * iobuf; /* IO buffer. */
uint64_t iomax; /* Size of the IO buffer. */
@ -433,12 +435,12 @@ static int copy_files(struct loadparm_context *lp_ctx)
DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
(unsigned long long)iomax, options.max_xmit));
if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if",
if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if",
lp_smb_ports(lp_ctx), &options))) {
return(FILESYS_EXIT_CODE);
}
if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of",
if (!(ofile = open_file(lp_resolve_context(lp_ctx), ev, "of",
lp_smb_ports(lp_ctx), &options))) {
return(FILESYS_EXIT_CODE);
}
@ -528,6 +530,7 @@ int main(int argc, const char ** argv)
{
int i;
const char ** dd_args;
struct event_context *ev;
poptContext pctx;
struct poptOption poptions[] = {
@ -578,6 +581,8 @@ int main(int argc, const char ** argv)
}
}
ev = event_context_init(talloc_autofree_context());
gensec_init(cmdline_lp_ctx);
dump_args();
@ -599,7 +604,7 @@ int main(int argc, const char ** argv)
CatchSignal(SIGINT, dd_handle_signal);
CatchSignal(SIGUSR1, dd_handle_signal);
return(copy_files(cmdline_lp_ctx));
return(copy_files(ev, cmdline_lp_ctx));
}
/* vim: set sw=8 sts=8 ts=8 tw=79 : */

View File

@ -89,8 +89,10 @@ struct dd_iohandle
#define DD_OPLOCK 0x00000008
struct smbcli_options;
struct event_context;
struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * path,
const char **ports,
uint64_t io_size, int options,

View File

@ -221,6 +221,7 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
}
static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * host,
const char **ports,
const char * share,
@ -233,8 +234,9 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
* each connection, but for now, we just use the same one for both.
*/
ret = smbcli_full_connection(NULL, &cli, host, ports, share,
NULL /* devtype */, cmdline_credentials, resolve_ctx,
NULL /* events */, options);
NULL /* devtype */,
cmdline_credentials, resolve_ctx,
ev, options);
if (!NT_STATUS_IS_OK(ret)) {
fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@ -293,6 +295,7 @@ static int open_smb_file(struct smbcli_state * cli,
}
static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * host,
const char **ports,
const char * share,
@ -319,7 +322,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
smbh->h.io_write = smb_write_func;
smbh->h.io_seek = smb_seek_func;
if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share,
if ((smbh->cli = init_smb_session(resolve_ctx, ev, host, ports, share,
smb_options)) == NULL) {
return(NULL);
}
@ -336,6 +339,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
/* ------------------------------------------------------------------------- */
struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * path,
const char **ports,
uint64_t io_size,
@ -355,7 +359,7 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
/* Skip over leading directory separators. */
while (*remain == '/' || *remain == '\\') { remain++; }
return(open_cifs_handle(resolve_ctx, host, ports,
return(open_cifs_handle(resolve_ctx, ev, host, ports,
share, remain,
io_size, options, smb_options));
}

View File

@ -2546,7 +2546,9 @@ static void display_share_result(struct srvsvc_NetShareCtr1 *ctr1)
/****************************************************************************
try and browse available shares on a host
****************************************************************************/
static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host)
static bool browse_host(struct loadparm_context *lp_ctx,
struct event_context *ev_ctx,
const char *query_host)
{
struct dcerpc_pipe *p;
char *binding;
@ -2560,7 +2562,7 @@ static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host)
status = dcerpc_pipe_connect(mem_ctx, &p, binding,
&ndr_table_srvsvc,
cmdline_credentials, NULL,
cmdline_credentials, ev_ctx,
lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
@ -3022,6 +3024,7 @@ static int process_stdin(struct smbclient_context *ctx)
return a connection to a server
*******************************************************/
static bool do_connect(struct smbclient_context *ctx,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
const char *specified_server, const char **ports,
const char *specified_share,
@ -3045,8 +3048,7 @@ static bool do_connect(struct smbclient_context *ctx,
status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
share, NULL, cred, resolve_ctx,
event_context_init(NULL),
options);
ev_ctx, options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
server, share, nt_errstr(status));
@ -3060,9 +3062,12 @@ static bool do_connect(struct smbclient_context *ctx,
/****************************************************************************
handle a -L query
****************************************************************************/
static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host, const char *workgroup)
static int do_host_query(struct loadparm_context *lp_ctx,
struct event_context *ev_ctx,
const char *query_host,
const char *workgroup)
{
browse_host(lp_ctx, query_host);
browse_host(lp_ctx, ev_ctx, query_host);
list_servers(workgroup);
return(0);
}
@ -3071,7 +3076,12 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host
/****************************************************************************
handle a message operation
****************************************************************************/
static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, struct smbcli_options *options)
static int do_message_op(const char *netbios_name, const char *desthost,
const char **destports, const char *destip,
int name_type,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options)
{
struct nbt_name called, calling;
const char *server_name;
@ -3083,7 +3093,9 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
server_name = destip ? destip : desthost;
if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, options)) {
if (!(cli = smbcli_state_init(NULL)) ||
!smbcli_socket_connect(cli, server_name, destports,
ev_ctx, resolve_ctx, options)) {
d_printf("Connection to %s failed\n", server_name);
return 1;
}
@ -3124,6 +3136,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
int rc = 0;
int name_type = 0x20;
TALLOC_CTX *mem_ctx;
struct event_context *ev_ctx;
struct smbclient_context *ctx;
const char *cmdstr = NULL;
struct smbcli_options smb_options;
@ -3221,6 +3234,8 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
lp_smbcli_options(cmdline_lp_ctx, &smb_options);
ev_ctx = event_context_init(talloc_autofree_context());
DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) );
if (query_host && (p=strchr_m(query_host,'#'))) {
@ -3230,14 +3245,23 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
}
if (query_host) {
return do_host_query(cmdline_lp_ctx, query_host, lp_workgroup(cmdline_lp_ctx));
rc = do_host_query(cmdline_lp_ctx, ev_ctx, query_host,
lp_workgroup(cmdline_lp_ctx));
return rc;
}
if (message) {
return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), &smb_options);
rc = do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost,
lp_smb_ports(cmdline_lp_ctx), dest_ip,
name_type, ev_ctx,
lp_resolve_context(cmdline_lp_ctx),
&smb_options);
return rc;
}
if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials, &smb_options))
if (!do_connect(ctx, ev_ctx, lp_resolve_context(cmdline_lp_ctx),
desthost, lp_smb_ports(cmdline_lp_ctx), service,
cmdline_credentials, &smb_options))
return 1;
if (base_directory)

View File

@ -207,6 +207,8 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char
*/
struct event_context *event_context_init(TALLOC_CTX *mem_ctx)
{
DEBUG(0, ("New event context requested. Parent: [%s:%p]\n",
mem_ctx?talloc_get_name(mem_ctx):"NULL", mem_ctx));
return event_context_init_byname(mem_ctx, NULL);
}

View File

@ -737,6 +737,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
struct ildb_private *ildb;
NTSTATUS status;
struct cli_credentials *creds;
struct event_context *event_ctx;
module = talloc(ldb, struct ldb_module);
if (!module) {
@ -756,8 +757,19 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
}
module->private_data = ildb;
ildb->module = module;
ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"),
ldb_get_opaque(ldb, "EventContext"));
event_ctx = ldb_get_opaque(ldb, "EventContext");
/* FIXME: We must make the event context an explicit parameter, but we
* need to build the events library separately first. Hack a new event
* context so that CMD line utilities work until we have libevents for
* standalone builds ready */
if (event_ctx == NULL) {
event_ctx = event_context_init(NULL);
}
ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"),
event_ctx);
if (!ildb->ldap) {
ldb_oom(ldb);
goto failed;

View File

@ -116,7 +116,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
if (ev == NULL) {
ev = event_context_find(mem_ctx);
return NULL;
}
if (ldb_set_opaque(ldb, "EventContext", ev)) {

View File

@ -544,6 +544,10 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
NTSTATUS status;
struct socket_address *path;
if (ev == NULL) {
return NULL;
}
msg = talloc_zero(mem_ctx, struct messaging_context);
if (msg == NULL) {
return NULL;
@ -556,10 +560,6 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
return NULL;
}
if (ev == NULL) {
ev = event_context_init(msg);
}
/* create the messaging directory if needed */
mkdir(dir, 0700);

View File

@ -124,7 +124,7 @@ static bool test_tcp(struct torture_context *tctx)
DATA_BLOB blob, blob2;
size_t sent, nread;
TALLOC_CTX *mem_ctx = tctx;
struct event_context *ev = event_context_init(mem_ctx);
struct event_context *ev = tctx->ev;
struct interface *ifaces;
status = socket_create("ip", SOCKET_TYPE_STREAM, &sock1, 0);

View File

@ -250,11 +250,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
cldap = talloc(mem_ctx, struct cldap_socket);
if (cldap == NULL) goto failed;
if (event_ctx == NULL) {
cldap->event_ctx = event_context_init(cldap);
} else {
cldap->event_ctx = talloc_reference(cldap, event_ctx);
}
cldap->event_ctx = talloc_reference(cldap, event_ctx);
if (cldap->event_ctx == NULL) goto failed;
cldap->idr = idr_init(cldap);

View File

@ -33,13 +33,14 @@
*/
bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
const char **ports,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options)
{
struct smbcli_socket *sock;
sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx,
NULL);
sock = smbcli_sock_connect_byname(server, ports, NULL,
resolve_ctx, ev_ctx);
if (sock == NULL) return false;

View File

@ -42,7 +42,11 @@ _PUBLIC_ struct composite_context *composite_create(TALLOC_CTX *mem_ctx,
c = talloc_zero(mem_ctx, struct composite_context);
if (!c) return NULL;
c->state = COMPOSITE_STATE_IN_PROGRESS;
c->event_ctx = ev;
c->event_ctx = talloc_reference(c, ev);
if (!c->event_ctx) {
talloc_free(c);
return NULL;
}
return c;
}

View File

@ -167,11 +167,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx,
dgmsock = talloc(mem_ctx, struct nbt_dgram_socket);
if (dgmsock == NULL) goto failed;
if (event_ctx == NULL) {
dgmsock->event_ctx = event_context_init(dgmsock);
} else {
dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
}
dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
if (dgmsock->event_ctx == NULL) goto failed;
status = socket_create("ip", SOCKET_TYPE_DGRAM, &dgmsock->sock, 0);

View File

@ -200,7 +200,7 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn,
/*
perform a sasl bind using the given credentials
*/
_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
struct cli_credentials *creds,
struct loadparm_context *lp_ctx)
{
@ -223,7 +223,8 @@ _PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
gensec_init(lp_ctx);
status = gensec_client_start(conn, &conn->gensec, NULL, lp_ctx);
status = gensec_client_start(conn, &conn->gensec,
conn->event.event_ctx, lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status)));
goto failed;

View File

@ -48,17 +48,13 @@ _PUBLIC_ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
{
struct ldap_connection *conn;
conn = talloc_zero(mem_ctx, struct ldap_connection);
if (conn == NULL) {
if (ev == NULL) {
return NULL;
}
if (ev == NULL) {
ev = event_context_init(conn);
if (ev == NULL) {
talloc_free(conn);
return NULL;
}
conn = talloc_zero(mem_ctx, struct ldap_connection);
if (conn == NULL) {
return NULL;
}
conn->next_messageid = 1;

View File

@ -318,11 +318,7 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
nbtsock = talloc(mem_ctx, struct nbt_name_socket);
if (nbtsock == NULL) goto failed;
if (event_ctx == NULL) {
nbtsock->event_ctx = event_context_init(nbtsock);
} else {
nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx);
}
nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx);
if (nbtsock->event_ctx == NULL) goto failed;
status = socket_create("ip", SOCKET_TYPE_DGRAM, &nbtsock->sock, 0);

View File

@ -59,12 +59,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
if (result == NULL) goto failed;
result->state = COMPOSITE_STATE_IN_PROGRESS;
if (event_ctx != NULL) {
result->event_ctx = talloc_reference(result, event_ctx);
} else {
result->event_ctx = event_context_init(result);
}
result->event_ctx = talloc_reference(result, event_ctx);
if (result->event_ctx == NULL) goto failed;
state = talloc(result, struct sock_connect_state);
@ -202,6 +197,11 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
struct smbcli_socket *result;
if (event_ctx == NULL) {
DEBUG(0, ("Invalid NULL event context passed in as parameter\n"));
return NULL;
}
if (tmp_ctx == NULL) {
DEBUG(0, ("talloc_new failed\n"));
return NULL;
@ -214,16 +214,6 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons
return NULL;
}
if (event_ctx == NULL) {
event_ctx = event_context_init(mem_ctx);
}
if (event_ctx == NULL) {
DEBUG(0, ("event_context_init failed\n"));
talloc_free(tmp_ctx);
return NULL;
}
/* allow hostnames of the form NAME#xx and do a netbios lookup */
if ((p = strchr(name, '#'))) {
name_type = strtol(p+1, NULL, 16);

View File

@ -135,7 +135,6 @@ struct composite_context *resolve_name_host_send(TALLOC_CTX *mem_ctx,
c = composite_create(mem_ctx, event_ctx);
if (c == NULL) return NULL;
c->event_ctx = talloc_reference(c, event_ctx);
if (composite_nomem(c->event_ctx, c)) return c;
state = talloc(c, struct host_state);

View File

@ -110,10 +110,9 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
struct nbtlist_state *state;
int i;
c = composite_create(event_ctx, event_ctx);
c = composite_create(mem_ctx, event_ctx);
if (c == NULL) return NULL;
c->event_ctx = talloc_reference(c, event_ctx);
if (composite_nomem(c->event_ctx, c)) return c;
state = talloc(c, struct nbtlist_state);

View File

@ -136,19 +136,14 @@ struct composite_context *resolve_name_send(struct resolve_context *ctx,
struct composite_context *c;
struct resolve_state *state;
c = composite_create(event_ctx, event_ctx);
if (c == NULL) return NULL;
if (ctx == NULL) {
if (ctx == NULL || event_ctx == NULL) {
composite_error(c, NT_STATUS_INVALID_PARAMETER);
return c;
}
if (event_ctx == NULL) {
c->event_ctx = event_context_init(c);
} else {
c->event_ctx = talloc_reference(c, event_ctx);
}
c = composite_create(ctx, event_ctx);
if (c == NULL) return NULL;
if (composite_nomem(c->event_ctx, c)) return c;
state = talloc(c, struct resolve_state);

View File

@ -451,17 +451,15 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
c = talloc_zero(mem_ctx, struct composite_context);
if (c == NULL) goto failed;
c->event_ctx = talloc_reference(c, event_ctx);
if (c->event_ctx == NULL) goto failed;
state = talloc_zero(c, struct connect_state);
if (state == NULL) goto failed;
if (event_ctx == NULL) {
event_ctx = event_context_init(mem_ctx);
}
state->io = io;
c->state = COMPOSITE_STATE_IN_PROGRESS;
c->event_ctx = talloc_reference(c, event_ctx);
c->private_data = state;
state->stage = CONNECT_RESOLVE;

View File

@ -62,7 +62,6 @@ static NTSTATUS fetchfile_connect(struct composite_context *c,
state->creq->async.fn = fetchfile_composite_handler;
state->stage = FETCHFILE_READ;
c->event_ctx = talloc_reference(c, state->creq->event_ctx);
return NT_STATUS_OK;
}
@ -158,7 +157,6 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
c->state = COMPOSITE_STATE_IN_PROGRESS;
state->stage = FETCHFILE_CONNECT;
c->event_ctx = talloc_reference(c, state->creq->event_ctx);
c->private_data = state;
return c;

View File

@ -52,7 +52,6 @@ static NTSTATUS fsinfo_connect(struct composite_context *c,
state->req->async.fn = fsinfo_raw_handler;
state->stage = FSINFO_QUERY;
c->event_ctx = talloc_reference(c, state->req->session->transport->socket->event.ctx);
return NT_STATUS_OK;
}
@ -158,7 +157,6 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
c->state = COMPOSITE_STATE_IN_PROGRESS;
state->stage = FSINFO_CONNECT;
c->event_ctx = talloc_reference(c, tree->session->transport->socket->event.ctx);
c->private_data = state;
state->creq = smb_composite_connect_send(state->connect, state,

View File

@ -172,11 +172,7 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx,
wrepl_socket = talloc_zero(mem_ctx, struct wrepl_socket);
if (!wrepl_socket) return NULL;
if (event_ctx == NULL) {
wrepl_socket->event.ctx = event_context_init(wrepl_socket);
} else {
wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx);
}
wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx);
if (!wrepl_socket->event.ctx) goto failed;
wrepl_socket->iconv_convenience = iconv_convenience;

View File

@ -30,7 +30,7 @@
* 1. Setup a CLDAP socket.
* 2. Lookup the default Site-Name.
*/
NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_context *lctx, struct libnet_JoinSite *r)
{
NTSTATUS status;
TALLOC_CTX *tmp_ctx;
@ -55,7 +55,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
search.in.acct_control = -1;
search.in.version = 6;
cldap = cldap_socket_init(tmp_ctx, NULL, lp_iconv_convenience(global_loadparm));
cldap = cldap_socket_init(tmp_ctx, lctx->event_ctx, lp_iconv_convenience(global_loadparm));
status = cldap_netlogon(cldap, tmp_ctx, &search);
if (!NT_STATUS_IS_OK(status)) {
/*
@ -148,7 +148,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
}
make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, NULL);
status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
libnet_r->out.error_string = NULL;
talloc_free(tmp_ctx);
@ -161,7 +161,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
r->in.domain_dn_str = libnet_r->out.domain_dn_str;
r->in.cldap_port = lp_cldap_port(ctx->lp_ctx);
status = libnet_FindSite(tmp_ctx, r);
status = libnet_FindSite(tmp_ctx, ctx, r);
if (!NT_STATUS_IS_OK(status)) {
libnet_r->out.error_string =
talloc_steal(libnet_r, r->out.error_string);

View File

@ -67,22 +67,15 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx,
return NULL;
}
if (ev == NULL) {
ev = event_context_init(c);
if (ev == NULL) {
talloc_free(c);
return NULL;
}
}
c->iconv_convenience = talloc_reference(c, ic);
c->event_ctx = ev;
if (!talloc_reference(c, ev)) {
c->event_ctx = talloc_reference(c, ev);
if (c->event_ctx == NULL) {
talloc_free(c);
return NULL;
}
c->call_id = 1;
c->security_state.auth_info = NULL;
c->security_state.session_key = dcerpc_generic_session_key;

View File

@ -717,12 +717,6 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent
struct pipe_connect_state *s;
struct event_context *new_ev = NULL;
if (ev == NULL) {
new_ev = event_context_init(parent_ctx);
if (new_ev == NULL) return NULL;
ev = new_ev;
}
/* composite context allocation and setup */
c = composite_create(parent_ctx, ev);
if (c == NULL) {
@ -844,21 +838,12 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_c
struct pipe_conn_state *s;
struct dcerpc_binding *b;
struct composite_context *pipe_conn_req;
struct event_context *new_ev = NULL;
if (ev == NULL) {
new_ev = event_context_init(parent_ctx);
if (new_ev == NULL) return NULL;
ev = new_ev;
}
/* composite context allocation and setup */
c = composite_create(parent_ctx, ev);
if (c == NULL) {
talloc_free(new_ev);
return NULL;
}
talloc_steal(c, new_ev);
s = talloc_zero(c, struct pipe_conn_state);
if (composite_nomem(s, c)) return c;

View File

@ -1156,7 +1156,8 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_
creds = cli_credentials_init_anon(mem_ctx); /* FIXME: Use machine credentials instead ? */
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_spoolss,
creds, NULL, dce_call->conn->dce_ctx->lp_ctx);
creds, dce_call->event_ctx,
dce_call->conn->dce_ctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
DEBUG(0, ("unable to call back to %s\n", r->in.str));

View File

@ -33,7 +33,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
TALLOC_CTX *mem_ctx = tctx;
torture_assert_ntstatus_ok(tctx,
gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx),
gensec_client_start(mem_ctx, &gensec_security,
tctx->ev, tctx->lp_ctx),
"gensec client start");
gensec_set_credentials(gensec_security, cmdline_credentials);
@ -87,7 +88,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
talloc_free(gensec_security);
torture_assert_ntstatus_ok(tctx,
gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx),
gensec_client_start(mem_ctx, &gensec_security,
tctx->ev, tctx->lp_ctx),
"Failed to start GENSEC for NTLMSSP");
gensec_set_credentials(gensec_security, cmdline_credentials);

View File

@ -55,7 +55,8 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
lp_smbcli_options(tctx->lp_ctx, &options);
if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), &options)) {
if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), tctx->ev,
lp_resolve_context(tctx->lp_ctx), &options)) {
torture_comment(tctx, "Failed to connect with %s\n", host);
goto failed;
}

View File

@ -19,6 +19,7 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
#include "lib/events/events.h"
#include "system/time.h"
#include "system/filesys.h"
#include "libcli/raw/request.h"
@ -154,7 +155,8 @@ static bool connect_servers_fast(void)
/*****************************************************
connect to the servers
*******************************************************/
static bool connect_servers(struct loadparm_context *lp_ctx)
static bool connect_servers(struct event_context *ev,
struct loadparm_context *lp_ctx)
{
int i, j;
@ -193,7 +195,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
servers[i].share_name, NULL,
servers[i].credentials,
lp_resolve_context(lp_ctx),
NULL, &smb_options);
ev, &smb_options);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name,
@ -1937,11 +1939,11 @@ static struct {
run the test with the current set of op_parms parameters
return the number of operations that completed successfully
*/
static int run_test(struct loadparm_context *lp_ctx)
static int run_test(struct event_context *ev, struct loadparm_context *lp_ctx)
{
int op, i;
if (!connect_servers(lp_ctx)) {
if (!connect_servers(ev, lp_ctx)) {
printf("Failed to connect to servers\n");
exit(1);
}
@ -2018,7 +2020,8 @@ static int run_test(struct loadparm_context *lp_ctx)
perform a backtracking analysis of the minimal set of operations
to generate an error
*/
static void backtrack_analyze(struct loadparm_context *lp_ctx)
static void backtrack_analyze(struct event_context *ev,
struct loadparm_context *lp_ctx)
{
int chunk, ret;
@ -2039,7 +2042,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx)
}
printf("Testing %d ops with %d-%d disabled\n",
options.numops, base, max-1);
ret = run_test(lp_ctx);
ret = run_test(ev, lp_ctx);
printf("Completed %d of %d ops\n", ret, options.numops);
for (i=base;i<max; i++) {
op_parms[i].disabled = false;
@ -2071,7 +2074,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx)
} while (chunk > 0);
printf("Reduced to %d ops\n", options.numops);
ret = run_test(lp_ctx);
ret = run_test(ev, lp_ctx);
if (ret != options.numops - 1) {
printf("Inconsistent result? ret=%d numops=%d\n", ret, options.numops);
}
@ -2080,7 +2083,8 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx)
/*
start the main gentest process
*/
static bool start_gentest(struct loadparm_context *lp_ctx)
static bool start_gentest(struct event_context *ev,
struct loadparm_context *lp_ctx)
{
int op;
int ret;
@ -2116,15 +2120,15 @@ static bool start_gentest(struct loadparm_context *lp_ctx)
}
}
ret = run_test(lp_ctx);
ret = run_test(ev, lp_ctx);
if (ret != options.numops && options.analyze) {
options.numops = ret+1;
backtrack_analyze(lp_ctx);
backtrack_analyze(ev, lp_ctx);
} else if (options.analyze_always) {
backtrack_analyze(lp_ctx);
backtrack_analyze(ev, lp_ctx);
} else if (options.analyze_continuous) {
while (run_test(lp_ctx) == options.numops) ;
while (run_test(ev, lp_ctx) == options.numops) ;
}
return ret == options.numops;
@ -2171,6 +2175,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
int i, username_count=0;
bool ret;
char *ignore_file=NULL;
struct event_context *ev;
struct loadparm_context *lp_ctx;
poptContext pc;
int argc_new;
@ -2278,9 +2283,11 @@ static bool split_unc_name(const char *unc, char **server, char **share)
printf("seed=%u\n", options.seed);
ev = event_context_init(talloc_autofree_context());
gensec_init(lp_ctx);
ret = start_gentest(lp_ctx);
ret = start_gentest(ev, lp_ctx);
if (ret) {
printf("gentest completed - no errors\n");

View File

@ -38,13 +38,15 @@
*/
static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest)
{
struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
struct cldap_socket *cldap;
NTSTATUS status;
struct cldap_netlogon search, empty_search;
union nbt_cldap_netlogon n1;
struct GUID guid;
int i;
cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
ZERO_STRUCT(search);
search.in.dest_address = dest;
search.in.dest_port = lp_cldap_port(tctx->lp_ctx);
@ -244,13 +246,15 @@ 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, lp_iconv_convenience(tctx->lp_ctx));
struct cldap_socket *cldap;
NTSTATUS status;
struct cldap_search search;
const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL };
const char *attrs2[] = { "currentTime", "highestCommittedUSN", "netlogon", NULL };
const char *attrs3[] = { "netlogon", NULL };
cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
ZERO_STRUCT(search);
search.in.dest_address = dest;
search.in.dest_port = lp_cldap_port(tctx->lp_ctx);

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, lp_iconv_convenience(tctx->lp_ctx));
struct cldap_socket *cldap;
int num_sent=0;
struct timeval tv = timeval_current();
bool ret = true;
@ -59,6 +59,8 @@ static bool bench_cldap(struct torture_context *tctx, const char *address)
struct cldap_netlogon search;
struct bench_state *state;
cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
state = talloc_zero(tctx, struct bench_state);
ZERO_STRUCT(search);

View File

@ -65,7 +65,7 @@ NTSTATUS torture_ldap_connection(struct torture_context *tctx,
return NT_STATUS_INVALID_PARAMETER;
}
*conn = ldap4_new_connection(tctx, tctx->lp_ctx, NULL);
*conn = ldap4_new_connection(tctx, tctx->lp_ctx, tctx->ev);
status = ldap_connect(*conn, url);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -201,7 +201,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
mem_ctx = talloc_init("torture_domain_close_lsa");
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc,
cmdline_credentials, NULL, torture->lp_ctx);
cmdline_credentials, torture->ev, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to connect to server: %s\n", nt_errstr(status));
ret = false;
@ -330,7 +330,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
mem_ctx = talloc_init("torture_domain_close_samr");
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr,
ctx->cred, NULL, torture->lp_ctx);
ctx->cred, torture->ev, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to connect to server: %s\n", nt_errstr(status));
ret = false;

View File

@ -19,6 +19,7 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
#include "lib/events/events.h"
#include "system/filesys.h"
#include "system/time.h"
#include "pstring.h"
@ -107,7 +108,8 @@ static struct record *recorded;
/*****************************************************
return a connection to a server
*******************************************************/
static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
static struct smbcli_state *connect_one(struct event_context *ev,
struct loadparm_context *lp_ctx,
char *share, int snum, int conn)
{
struct smbcli_state *c;
@ -162,7 +164,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
share, NULL,
servers[snum],
lp_resolve_context(lp_ctx),
NULL, &options);
ev, &options);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
@ -176,7 +178,8 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
}
static void reconnect(struct loadparm_context *lp_ctx,
static void reconnect(struct event_context *ev,
struct loadparm_context *lp_ctx,
struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
char *share[NSERVERS])
{
@ -193,7 +196,7 @@ static void reconnect(struct loadparm_context *lp_ctx,
}
talloc_free(cli[server][conn]);
}
cli[server][conn] = connect_one(lp_ctx, share[server],
cli[server][conn] = connect_one(ev, lp_ctx, share[server],
server, conn);
if (!cli[server][conn]) {
DEBUG(0,("Failed to connect to %s\n", share[server]));
@ -396,7 +399,9 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
we then do random locking ops in tamdem on the 4 fnums from each
server and ensure that the results match
*/
static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
static int test_locks(struct event_context *ev,
struct loadparm_context *lp_ctx,
char *share[NSERVERS])
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
int fnum[NSERVERS][NCONNECTIONS][NFILES];
@ -447,7 +452,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
#endif
}
reconnect(lp_ctx, cli, fnum, share);
reconnect(ev, lp_ctx, cli, fnum, share);
open_files(cli, fnum);
n = retest(cli, fnum, numops);
@ -465,7 +470,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
n1 = n;
close_files(cli, fnum);
reconnect(lp_ctx, cli, fnum, share);
reconnect(ev, lp_ctx, cli, fnum, share);
open_files(cli, fnum);
for (i=0;i<n-skip;i+=skip) {
@ -503,7 +508,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
}
close_files(cli, fnum);
reconnect(lp_ctx, cli, fnum, share);
reconnect(ev, lp_ctx, cli, fnum, share);
open_files(cli, fnum);
showall = true;
n1 = retest(cli, fnum, n);
@ -543,6 +548,7 @@ static void usage(poptContext pc)
int opt;
int seed, server;
int username_count=0;
struct event_context *ev;
struct loadparm_context *lp_ctx;
poptContext pc;
int argc_new, i;
@ -631,12 +637,14 @@ static void usage(poptContext pc)
servers[1] = servers[0];
}
ev = event_context_init(talloc_autofree_context());
gensec_init(lp_ctx);
DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n",
seed, lock_base, lock_range, min_length));
srandom(seed);
return test_locks(lp_ctx, share);
return test_locks(ev, lp_ctx, share);
}

View File

@ -19,6 +19,7 @@
#include "includes.h"
#include "system/passwd.h"
#include "lib/events/events.h"
static fstring password;
static fstring username;
@ -137,7 +138,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
return a connection to a server
*******************************************************/
static struct smbcli_state *connect_one(char *share, const char **ports,
struct smb_options *options)
struct smb_options *optionsi,
struct event_context *ev)
{
struct smbcli_state *c;
char *server_n;
@ -165,7 +167,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports,
nt_status = smbcli_full_connection(NULL,
&c, myname, server_n, ports, share, NULL,
username, lp_workgroup(), password, NULL,
username, lp_workgroup(), password, ev,
options);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
@ -183,6 +185,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
const char **ports,
struct smbcli_options *options,
struct event_context *ev,
char *share1, char *share2)
{
int server, conn, f, fstype;
@ -201,7 +204,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
smbcli_ulogoff(cli[server][conn]);
talloc_free(cli[server][conn]);
}
cli[server][conn] = connect_one(share[server], ports, options);
cli[server][conn] = connect_one(share[server], ports, options, ev);
if (!cli[server][conn]) {
DEBUG(0,("Failed to connect to %s\n", share[server]));
exit(1);
@ -347,7 +350,11 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
we then do random locking ops in tamdem on the 4 fnums from each
server and ensure that the results match
*/
static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports, struct smbcli_options *options)
static void test_locks(char *share1, char *share2,
char *nfspath1, char *nfspath2,
const char **ports,
struct smbcli_options *options,
struct event_context *ev)
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
char *nfs[NSERVERS];
@ -376,7 +383,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
recorded[n].needed = true;
}
reconnect(cli, nfs, fnum, ports, options, share1, share2);
reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
open_files(cli, nfs, fnum);
n = retest(cli, nfs, fnum, numops);
@ -387,7 +394,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
n1 = n;
close_files(cli, nfs, fnum);
reconnect(cli, nfs, fnum, ports, options, share1, share2);
reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
open_files(cli, nfs, fnum);
for (i=0;i<n-1;i++) {
@ -414,7 +421,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
}
close_files(cli, nfs, fnum);
reconnect(cli, nfs, fnum, ports, options, share1, share2);
reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
open_files(cli, nfs, fnum);
showall = true;
n1 = retest(cli, nfs, fnum, n);
@ -466,6 +473,7 @@ static void usage(void)
char *p;
int seed;
struct loadparm_context *lp_ctx;
struct event_context *ev;
setlinebuf(stdout);
@ -542,10 +550,12 @@ static void usage(void)
DEBUG(0,("seed=%u\n", seed));
srandom(seed);
ev = event_context_init(talloc_autofree_context());
locking_init(1);
lp_smbcli_options(lp_ctx, &options);
test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx),
&options);
&options, ev);
return(0);
}

View File

@ -30,6 +30,7 @@
#include "param/param.h"
#include "dynconfig.h"
#include "libcli/resolve/resolve.h"
#include "lib/events/events.h"
static bool showall = false;
static bool old_list = false;
@ -73,6 +74,7 @@ static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name,
return a connection to a server
*******************************************************/
static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
struct event_context *ev,
char *share, const char **ports,
struct smbcli_options *options)
{
@ -92,7 +94,7 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
server,
ports,
share, NULL,
cmdline_credentials, resolve_ctx, NULL,
cmdline_credentials, resolve_ctx, ev,
options);
if (!NT_STATUS_IS_OK(status)) {
@ -291,6 +293,7 @@ static void usage(poptContext pc)
struct smbcli_state *cli;
int opt;
int seed;
struct event_context *ev;
struct loadparm_context *lp_ctx;
struct smbcli_options options;
poptContext pc;
@ -352,11 +355,13 @@ static void usage(poptContext pc)
lp_ctx = cmdline_lp_ctx;
ev = event_context_init(talloc_autofree_context());
gensec_init(lp_ctx);
lp_smbcli_options(lp_ctx, &options);
cli = connect_one(lp_resolve_context(lp_ctx), share,
cli = connect_one(lp_resolve_context(lp_ctx), ev, share,
lp_smb_ports(lp_ctx), &options);
if (!cli) {
DEBUG(0,("Failed to connect to %s\n", share));

View File

@ -40,7 +40,7 @@ bool torture_nbt_browse(struct torture_context *torture)
name.scope = NULL;
/* do an initial name resolution to find its IP */
status = resolve_name(&name, mem_ctx, &address, NULL);
status = resolve_name(&name, mem_ctx, &address, torture->ev);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to resolve %s - %s\n",
name.name, nt_errstr(status));

View File

@ -64,7 +64,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
static bool nbt_test_netlogon(struct torture_context *tctx)
{
struct dgram_mailslot_handler *dgmslot;
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL,
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
lp_iconv_convenience(tctx->lp_ctx));
struct socket_address *dest;
const char *myaddress;
@ -147,7 +147,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
static bool nbt_test_netlogon2(struct torture_context *tctx)
{
struct dgram_mailslot_handler *dgmslot;
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL,
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
lp_iconv_convenience(tctx->lp_ctx));
struct socket_address *dest;
const char *myaddress;
@ -257,7 +257,7 @@ static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot,
static bool nbt_test_ntlogon(struct torture_context *tctx)
{
struct dgram_mailslot_handler *dgmslot;
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL,
struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
lp_iconv_convenience(tctx->lp_ctx));
struct socket_address *dest;
struct test_join *join_ctx;

View File

@ -34,7 +34,7 @@ bool torture_nbt_get_name(struct torture_context *tctx,
/* do an initial name resolution to find its IP */
torture_assert_ntstatus_ok(tctx,
resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, NULL),
resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, tctx->ev),
talloc_asprintf(tctx,
"Failed to resolve %s", name->name));

View File

@ -47,7 +47,7 @@ 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, tctx->ev,
lp_iconv_convenience(tctx->lp_ctx));
int num_sent=0;
struct result_struct *result;

View File

@ -44,7 +44,7 @@ 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, tctx->ev,
lp_iconv_convenience(tctx->lp_ctx));
struct socket_address *socket_address;
struct nbt_name name;
@ -114,7 +114,7 @@ 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, tctx->ev,
lp_iconv_convenience(tctx->lp_ctx));
const char *myaddress;
struct socket_address *socket_address;

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, lp_iconv_convenience(tctx->lp_ctx));
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, 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, lp_iconv_convenience(tctx->lp_ctx));
struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, 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, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket2 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket1 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket2 = wrepl_socket_init(tctx, tctx->ev, 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), wrepl_best_ip(tctx->lp_ctx, address), 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, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
torture_comment(tctx, "Setup wrepl connections\n");
status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), 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, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
torture_comment(tctx, "Setup wrepl connections\n");
status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), 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, lp_iconv_convenience(tctx->lp_ctx));
ctx->pull = wrepl_socket_init(ctx, tctx->ev, 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, lp_iconv_convenience(tctx->lp_ctx));
ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev, 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, lp_iconv_convenience(tctx->lp_ctx));
ctx->nbtsock_srv = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->nbtsock_srv) return NULL;
/* Make a port 137 version of ctx->myaddr */
@ -645,7 +645,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
}
if (ctx->myaddr2 && ctx->nbtsock_srv) {
ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
ctx->nbtsock2 = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
if (!ctx->nbtsock2) return NULL;
status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0);
@ -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, lp_iconv_convenience(tctx->lp_ctx));
wrepl_socket = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, ctx->address), ctx->address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);

View File

@ -296,7 +296,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct
c[i]->async.private_data = count;
}
event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
event_ctx = tctx->ev;
printf("waiting for completion\n");
while (*count != num_ops) {
event_loop_once(event_ctx);
@ -354,7 +354,7 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx)
printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops);
event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
event_ctx = tctx->ev;
c = talloc_array(tctx, struct composite_context *, torture_numops);
for (i=0; i<torture_numops; i++) {

View File

@ -178,12 +178,11 @@ static bool _test_DsBind(struct torture_context *tctx,
{
NTSTATUS status;
bool ret = true;
struct event_context *event = NULL;
status = dcerpc_pipe_connect_b(ctx,
&b->pipe, ctx->drsuapi_binding,
&ndr_table_drsuapi,
credentials, event, tctx->lp_ctx);
credentials, tctx->ev, tctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@ -254,10 +253,11 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
struct drsuapi_DsCrackNames r;
struct drsuapi_DsNameString names[1];
bool ret = true;
struct cldap_socket *cldap = cldap_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
struct cldap_socket *cldap;
struct cldap_netlogon search;
cldap = cldap_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
r.in.bind_handle = &ctx->admin.drsuapi.bind_handle;
r.in.level = 1;
r.in.req.req1.codepage = 1252; /* western european */

View File

@ -39,7 +39,7 @@ bool torture_rpc_join(struct torture_context *torture)
"IPC$", NULL,
machine_account,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
TORTURE_NETBIOS_NAME));
@ -65,7 +65,7 @@ bool torture_rpc_join(struct torture_context *torture)
"IPC$", NULL,
machine_account,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
TORTURE_NETBIOS_NAME));

View File

@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
status = dcerpc_pipe_connect_b(tctx,
p, binding, table,
cmdline_credentials, NULL, tctx->lp_ctx);
cmdline_credentials, tctx->ev, tctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
printf("Failed to connect to remote server: %s %s\n",
@ -113,7 +113,7 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx,
binding->assoc_group_id = assoc_group_id;
status = dcerpc_pipe_connect_b(tctx, p, binding, table,
cmdline_credentials, NULL, tctx->lp_ctx);
cmdline_credentials, tctx->ev, tctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
*p = NULL;
@ -147,7 +147,7 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx,
&(tcase_data->pipe),
binding,
tcase->table,
tcase_data->credentials, NULL, tctx->lp_ctx);
tcase_data->credentials, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
@ -205,7 +205,7 @@ static bool torture_rpc_setup_anonymous(struct torture_context *tctx,
&(tcase_data->pipe),
binding,
tcase->table,
tcase_data->credentials, NULL, tctx->lp_ctx);
tcase_data->credentials, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");

View File

@ -89,7 +89,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@ -303,7 +303,7 @@ bool torture_bind_samba3(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@ -1220,7 +1220,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, anon_creds,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@ -1307,7 +1307,7 @@ static bool test_join3(struct torture_context *tctx,
lp_smb_ports(tctx->lp_ctx),
"IPC$", NULL, smb_creds,
lp_resolve_context(tctx->lp_ctx),
NULL, &options);
tctx->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("smbcli_full_connection failed: %s\n",
nt_errstr(status));
@ -1682,7 +1682,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, cmdline_credentials,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));
@ -1709,7 +1709,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
lp_smb_ports(torture->lp_ctx),
"IPC$", NULL, anon_creds,
lp_resolve_context(torture->lp_ctx),
NULL, &options);
torture->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) anon smbcli_full_connection failed: %s\n",
__location__, nt_errstr(status));

View File

@ -1602,7 +1602,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
status = dcerpc_pipe_connect_b(mem_ctx, &p, b,
&ndr_table_netlogon,
machine_credentials, NULL, torture->lp_ctx);
machine_credentials, torture->ev, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status));

View File

@ -1560,7 +1560,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
status = dcerpc_pipe_connect_b(samsync_state,
&samsync_state->p, b,
&ndr_table_netlogon,
credentials, NULL, torture->lp_ctx);
credentials, torture->ev, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@ -1598,7 +1598,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
&samsync_state->p_netlogon_wksta,
b_netlogon_wksta,
&ndr_table_netlogon,
credentials_wksta, NULL, torture->lp_ctx);
credentials_wksta, torture->ev, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status));

View File

@ -258,7 +258,7 @@ static bool test_schannel(struct torture_context *tctx,
b->flags |= dcerpc_flags;
status = dcerpc_pipe_connect_b(tctx, &p, b, &ndr_table_samr,
credentials, NULL, tctx->lp_ctx);
credentials, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status,
"Failed to connect with schannel");
@ -328,7 +328,7 @@ static bool test_schannel(struct torture_context *tctx,
b->flags |= dcerpc_flags;
status = dcerpc_pipe_connect_b(tctx, &p_samr2, b, &ndr_table_samr,
credentials, NULL, tctx->lp_ctx);
credentials, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status,
"Failed to connect with schannel");
@ -370,7 +370,7 @@ static bool test_schannel(struct torture_context *tctx,
b->flags &= ~DCERPC_AUTH_OPTIONS;
status = dcerpc_pipe_connect_b(tctx, &p_netlogon3, b, &ndr_table_netlogon,
credentials, NULL, tctx->lp_ctx);
credentials, tctx->ev, tctx->lp_ctx);
torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel");
torture_assert(tctx, !test_netlogon_ex_ops(p_netlogon3, tctx, credentials, creds),
@ -453,12 +453,12 @@ bool torture_rpc_schannel2(struct torture_context *torture)
printf("Opening first connection\n");
status = dcerpc_pipe_connect_b(torture, &p1, b, &ndr_table_netlogon,
credentials1, NULL, torture->lp_ctx);
credentials1, torture->ev, torture->lp_ctx);
torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel");
torture_comment(torture, "Opening second connection\n");
status = dcerpc_pipe_connect_b(torture, &p2, b, &ndr_table_netlogon,
credentials2, NULL, torture->lp_ctx);
credentials2, torture->ev, torture->lp_ctx);
torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel");
credentials1->netlogon_creds = NULL;

View File

@ -158,7 +158,11 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
binding->flags |= settings->bindoptions;
torture_assert_ntstatus_ok(torture,
dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL, torture->lp_ctx),
dcerpc_pipe_connect_b(torture, &p, binding,
&ndr_table_lsarpc,
cmdline_credentials,
torture->ev,
torture->lp_ctx),
"connect");
if (!test_lsa_OpenPolicy2(p, torture, &handle)) {

View File

@ -63,8 +63,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx)
lp_smb_ports(tctx->lp_ctx),
share, NULL,
cmdline_credentials,
lp_resolve_context(tctx->lp_ctx), NULL,
&options);
lp_resolve_context(tctx->lp_ctx),
tctx->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to connect to //%s/%s: %s\n",

View File

@ -84,7 +84,7 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx,
lp_smb_ports(tctx->lp_ctx),
share, NULL,
creds, lp_resolve_context(tctx->lp_ctx),
NULL, &options);
tctx->ev, &options);
if (!NT_STATUS_IS_OK(status)) {
printf("failed to connect to //%s/%s: %s\n",

View File

@ -24,6 +24,7 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
#include "lib/socket/socket.h"
#include "lib/events/events.h"
#include "system/network.h"
#include "system/locale.h"
#include "lib/socket/netif.h"
@ -180,7 +181,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
}
static bool process_one(struct loadparm_context *lp_ctx,
static bool process_one(struct loadparm_context *lp_ctx, struct event_context *ev,
struct interface *ifaces, const char *name, int nbt_port)
{
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
@ -211,7 +212,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, lp_iconv_convenience(lp_ctx));
nbtsock = nbt_name_socket_init(tmp_ctx, ev, lp_iconv_convenience(lp_ctx));
if (options.root_port) {
all_zero_addr = socket_address_from_strings(tmp_ctx, nbtsock->sock->backend_name,
@ -271,6 +272,7 @@ int main(int argc, const char *argv[])
{
bool ret = true;
struct interface *ifaces;
struct event_context *ev;
poptContext pc;
int opt;
enum {
@ -356,13 +358,17 @@ int main(int argc, const char *argv[])
}
load_interfaces(NULL, lp_interfaces(cmdline_lp_ctx), &ifaces);
ev = event_context_init(talloc_autofree_context());
while (poptPeekArg(pc)) {
const char *name = poptGetArg(pc);
ret &= process_one(cmdline_lp_ctx, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
ret &= process_one(cmdline_lp_ctx, ev, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
}
talloc_free(ev);
talloc_free(ifaces);
poptFreeContext(pc);

View File

@ -461,6 +461,10 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
return;
}
ev = event_context_init(state);
if (!ev) {
exit(1);
}
/* setup gensec */
if (!(state->gensec_state)) {
switch (stdio_helper_mode) {
@ -468,7 +472,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
case NTLMSSP_CLIENT_1:
/* setup the client side */
nt_status = gensec_client_start(NULL, &state->gensec_state, NULL, lp_ctx);
nt_status = gensec_client_start(NULL, &state->gensec_state, ev, lp_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
exit(1);
}
@ -476,10 +480,6 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
break;
case GSS_SPNEGO_SERVER:
case SQUID_2_5_NTLMSSP:
ev = event_context_init(state);
if (!ev) {
exit(1);
}
msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx),
lp_iconv_convenience(lp_ctx), ev);
if (!msg) {