1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

r7633: this patch started as an attempt to make the dcerpc code use a given

event_context for the socket_connect() call, so that when things that
use dcerpc are running alongside anything else it doesn't block the
whole process during a connect.

Then of course I needed to change any code that created a dcerpc
connection (such as the auth code) to also take an event context, and
anything that called that and so on .... thus the size of the patch.

There were 3 places where I punted:

  - abartlet wanted me to add a gensec_set_event_context() call
    instead of adding it to the gensec init calls. Andrew, my
    apologies for not doing this. I didn't do it as adding a new
    parameter allowed me to catch all the callers with the
    compiler. Now that its done, we could go back and use
    gensec_set_event_context()

  - the ejs code calls auth initialisation, which means it should pass
    in the event context from the web server. I punted on that. Needs fixing.

  - I used a NULL event context in dcom_get_pipe(). This is equivalent
    to what we did already, but should be fixed to use a callers event
    context. Jelmer, can you think of a clean way to do that?

I also cleaned up a couple of things:

 - libnet_context_destroy() makes no sense. I removed it.

 - removed some unused vars in various places
(This used to be commit 3a3025485b)
This commit is contained in:
Andrew Tridgell 2005-06-16 11:36:09 +00:00 committed by Gerald (Jerry) Carter
parent 3b9dfb0da3
commit af237084ec
65 changed files with 221 additions and 160 deletions

View File

@ -22,6 +22,7 @@
#include "includes.h"
#include "dlinklist.h"
#include "auth/auth.h"
#include "lib/events/events.h"
/***************************************************************************
Set a fixed challenge
@ -199,7 +200,9 @@ NTSTATUS auth_check_password(struct auth_context *auth_ctx,
/***************************************************************************
Make a auth_info struct for the auth subsystem
***************************************************************************/
NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, const char **methods, struct auth_context **auth_ctx)
NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, const char **methods,
struct auth_context **auth_ctx,
struct event_context *ev)
{
int i;
struct auth_context *ctx;
@ -215,6 +218,16 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, const char **methods, struct a
ctx->challenge.may_be_modified = False;
ctx->challenge.data = data_blob(NULL, 0);
ctx->methods = NULL;
if (ev == NULL) {
ev = event_context_init(ctx);
if (ev == NULL) {
talloc_free(ctx);
return NT_STATUS_NO_MEMORY;
}
}
ctx->event_ctx = ev;
for (i=0; methods[i] ; i++) {
struct auth_method_context *method;

View File

@ -144,6 +144,9 @@ struct auth_context {
/* methods, in the order they should be called */
struct auth_method_context *methods;
/* the event context to use for calls that can block */
struct event_context *event_ctx;
};
/* this structure is used by backends to determine the size of some critical types */

View File

@ -84,7 +84,7 @@ static NTSTATUS domain_check_password(struct auth_method_context *ctx,
status = dcerpc_pipe_connect_b(mem_ctx, &p, b,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
credentials);
credentials, ctx->auth_ctx->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
return status;

View File

@ -23,6 +23,7 @@
#include "includes.h"
#include "auth/auth.h"
#include "lib/events/events.h"
/* the list of currently registered GENSEC backends */
const static struct gensec_security_ops **generic_security_ops;
@ -228,12 +229,12 @@ const char **gensec_security_oids(TALLOC_CTX *mem_ctx, const char *skip)
@param gensec_security Returned GENSEC context pointer.
@note The mem_ctx is only a parent and may be NULL.
*/
static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, struct gensec_security **gensec_security)
static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security,
struct event_context *ev)
{
(*gensec_security) = talloc(mem_ctx, struct gensec_security);
if (!(*gensec_security)) {
return NT_STATUS_NO_MEMORY;
}
NT_STATUS_HAVE_NO_MEMORY(*gensec_security);
(*gensec_security)->ops = NULL;
@ -241,6 +242,17 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, struct gensec_security **gense
(*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;
return NT_STATUS_OK;
}
@ -257,15 +269,14 @@ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security)
{
(*gensec_security) = talloc(mem_ctx, struct gensec_security);
if (!(*gensec_security)) {
return NT_STATUS_NO_MEMORY;
}
NT_STATUS_HAVE_NO_MEMORY(*gensec_security);
(**gensec_security) = *parent;
(*gensec_security)->ops = NULL;
(*gensec_security)->private_data = NULL;
(*gensec_security)->subcontext = True;
(*gensec_security)->event_ctx = parent->event_ctx;
return NT_STATUS_OK;
}
@ -276,10 +287,12 @@ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx,
@param gensec_security Returned GENSEC context pointer.
@note The mem_ctx is only a parent and may be NULL.
*/
NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, struct gensec_security **gensec_security)
NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security,
struct event_context *ev)
{
NTSTATUS status;
status = gensec_start(mem_ctx, gensec_security);
status = gensec_start(mem_ctx, gensec_security, ev);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@ -295,10 +308,12 @@ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, struct gensec_security **gense
@param gensec_security Returned GENSEC context pointer.
@note The mem_ctx is only a parent and may be NULL.
*/
NTSTATUS gensec_server_start(TALLOC_CTX *mem_ctx, struct gensec_security **gensec_security)
NTSTATUS gensec_server_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security,
struct event_context *ev)
{
NTSTATUS status;
status = gensec_start(mem_ctx, gensec_security);
status = gensec_start(mem_ctx, gensec_security, ev);
if (!NT_STATUS_IS_OK(status)) {
return status;
}

View File

@ -109,6 +109,7 @@ struct gensec_security {
enum gensec_role gensec_role;
BOOL subcontext;
uint32_t want_features;
struct event_context *event_ctx;
};
/* this structure is used by backends to determine the size of some critical types */

View File

@ -800,7 +800,9 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_SEAL;
}
nt_status = auth_context_create(gensec_ntlmssp_state, lp_auth_methods(), &gensec_ntlmssp_state->auth_context);
nt_status = auth_context_create(gensec_ntlmssp_state, lp_auth_methods(),
&gensec_ntlmssp_state->auth_context,
gensec_security->event_ctx);
NT_STATUS_NOT_OK_RETURN(nt_status);
gensec_ntlmssp_state->get_challenge = auth_ntlmssp_get_challenge;

View File

@ -2730,7 +2730,7 @@ static BOOL browse_host(const char *query_host)
status = dcerpc_pipe_connect(mem_ctx, &p, binding,
DCERPC_SRVSVC_UUID,
DCERPC_SRVSVC_VERSION,
cmdline_credentials);
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
binding, nt_errstr(status));
@ -3220,7 +3220,7 @@ static struct smbcli_state *do_connect(const char *server, const char *share, st
}
status = smbcli_full_connection(NULL, &c, server,
share, NULL, cred);
share, NULL, cred, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
server, share, nt_errstr(status));

View File

@ -280,7 +280,7 @@ smb_connect(const char *workgroup, /* I - Workgroup */
myname = get_myname();
nt_status = smbcli_full_connection(NULL, &c, myname, server, 0, share, NULL,
username, workgroup, password);
username, workgroup, password, NULL);
free(myname);
if (!NT_STATUS_IS_OK(nt_status)) {

View File

@ -197,7 +197,7 @@ static void on_connect_clicked(GtkButton *btn, gpointer user_data)
status = dcerpc_pipe_connect(talloc_autofree_context(), &epmapper_pipe, bs,
DCERPC_EPMAPPER_UUID, DCERPC_EPMAPPER_VERSION,
credentials);
credentials, NULL);
if (NT_STATUS_IS_ERR(status)) {
gtk_show_ntstatus(mainwin, "Error connecting to endpoint mapper", status);

View File

@ -412,8 +412,9 @@ static void on_open_remote_activate(GtkMenuItem *menuitem, gpointer user_data)
cli_credentials_set_gtk_callbacks(creds);
error = reg_open_remote(&registry,
creds,
gtk_rpc_binding_dialog_get_binding_string(GTK_RPC_BINDING_DIALOG(rpcwin), mem_ctx));
creds,
gtk_rpc_binding_dialog_get_binding_string(GTK_RPC_BINDING_DIALOG(rpcwin), mem_ctx),
NULL);
if(!W_ERROR_IS_OK(error)) {
gtk_show_werror(mainwin, "Error while opening remote registry", error);

View File

@ -109,7 +109,7 @@ static void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data)
gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
DCERPC_ATSVC_UUID,
DCERPC_ATSVC_VERSION,
credentials);
credentials, NULL);
if(!NT_STATUS_IS_OK(status)) {
gtk_show_ntstatus(mainwin, "Error while connecting to at service", status);

View File

@ -131,7 +131,7 @@ static void connect_sam(void)
/* If connected, get list of jobs */
status = dcerpc_pipe_connect_b(mem_ctx, &sam_pipe,
gtk_rpc_binding_dialog_get_binding(d, mem_ctx),
DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION, cred );
DCERPC_SAMR_UUID, DCERPC_SAMR_VERSION, cred, NULL);
if(!NT_STATUS_IS_OK(status)) {
gtk_show_ntstatus(mainwin, "While connecting to SAMR interface", status);

View File

@ -22,6 +22,7 @@
#include "ldap_server/ldap_server.h"
#include "auth/auth.h"
#include "libcli/ldap/ldap.h"
#include "smbd/service_stream.h"
static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
{
@ -63,7 +64,8 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
if (!call->conn->gensec) {
call->conn->session_info = NULL;
status = gensec_server_start(call->conn, &call->conn->gensec);
status = gensec_server_start(call->conn, &call->conn->gensec,
call->conn->connection->event.ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
return status;

View File

@ -26,6 +26,7 @@ struct IUnknown_vtable;
struct com_context
{
struct dcom_client_context *dcom;
struct event_context *event_ctx;
};
typedef struct IUnknown *(*get_class_object_function) (const struct GUID *clsid);

View File

@ -84,7 +84,7 @@ static NTSTATUS dcom_connect_host(struct com_context *ctx, struct dcerpc_pipe **
return dcerpc_pipe_connect(ctx, p, "ncalrpc",
DCERPC_IREMOTEACTIVATION_UUID,
DCERPC_IREMOTEACTIVATION_VERSION,
ctx->dcom->credentials);
ctx->dcom->credentials, ctx->event_ctx);
}
/* Allow server name to contain a binding string */
@ -92,7 +92,7 @@ static NTSTATUS dcom_connect_host(struct com_context *ctx, struct dcerpc_pipe **
status = dcerpc_pipe_connect_b(ctx, p, bd,
DCERPC_IREMOTEACTIVATION_UUID,
DCERPC_IREMOTEACTIVATION_VERSION,
ctx->dcom->credentials);
ctx->dcom->credentials, ctx->event_ctx);
talloc_free(mem_ctx);
return status;
@ -109,7 +109,7 @@ static NTSTATUS dcom_connect_host(struct com_context *ctx, struct dcerpc_pipe **
status = dcerpc_pipe_connect(ctx, p, binding,
DCERPC_IREMOTEACTIVATION_UUID,
DCERPC_IREMOTEACTIVATION_VERSION,
ctx->dcom->credentials);
ctx->dcom->credentials, ctx->event_ctx);
if (NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
@ -256,7 +256,7 @@ WERROR dcom_get_class_object(struct com_context *ctx, struct GUID *clsid, const
return WERR_OK;
}
NTSTATUS dcom_get_pipe (struct IUnknown *iface, struct dcerpc_pipe **pp)
NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp)
{
struct dcerpc_binding *binding;
struct GUID iid;
@ -301,9 +301,13 @@ NTSTATUS dcom_get_pipe (struct IUnknown *iface, struct dcerpc_pipe **pp)
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Error parsing string binding"));
} else {
/* TODO: jelmer, please look at this. The
"NULL" here should be a real event
context */
status = dcerpc_pipe_connect_b(NULL, &p, binding,
uuid, 0.0,
iface->ctx->dcom->credentials);
iface->ctx->dcom->credentials,
NULL);
}
talloc_free(binding);
i++;

View File

@ -21,11 +21,16 @@
#include "includes.h"
#include "dlinklist.h"
#include "lib/com/com.h"
#include "lib/events/events.h"
#include "librpc/gen_ndr/com_dcom.h"
WERROR com_init(struct com_context **ctx)
WERROR com_init(struct com_context **ctx, struct event_context *event_ctx)
{
*ctx = talloc(NULL, struct com_context);
if (event_ctx == NULL) {
event_ctx = event_context_init(*ctx);
}
(*ctx)->event_ctx = event_ctx;
return WERR_OK;
}

View File

@ -362,7 +362,8 @@ static struct hive_operations reg_backend_rpc = {
.num_values = rpc_num_values,
};
WERROR reg_open_remote (struct registry_context **ctx, struct cli_credentials *credentials, const char *location)
WERROR reg_open_remote(struct registry_context **ctx, struct cli_credentials *credentials,
const char *location, struct event_context *ev)
{
NTSTATUS status;
struct dcerpc_pipe *p;
@ -378,7 +379,7 @@ WERROR reg_open_remote (struct registry_context **ctx, struct cli_credentials *c
&p, location,
DCERPC_WINREG_UUID,
DCERPC_WINREG_VERSION,
credentials);
credentials, ev);
(*ctx)->backend_data = p;
if(NT_STATUS_IS_ERR(status)) {

View File

@ -144,8 +144,10 @@ static void writediff(struct registry_key *oldkey, struct registry_key *newkey,
break;
case 'R':
if (!h1 && !from_null)
error = reg_open_remote(&h1, cmdline_credentials, poptGetOptArg(pc));
else if (!h2) error = reg_open_remote(&h2, cmdline_credentials, poptGetOptArg(pc));
error = reg_open_remote(&h1, cmdline_credentials,
poptGetOptArg(pc), NULL);
else if (!h2) error = reg_open_remote(&h2, cmdline_credentials,
poptGetOptArg(pc), NULL);
break;
}

View File

@ -763,7 +763,7 @@ static int nt_apply_reg_command_file(struct registry_context *r, const char *cmd
}
if (remote) {
error = reg_open_remote (&h, cmdline_credentials, remote);
error = reg_open_remote (&h, cmdline_credentials, remote, NULL);
} else {
error = reg_open_local (&h);
}

View File

@ -390,7 +390,7 @@ static char **reg_completion(const char *text, int start, int end)
}
if (remote) {
error = reg_open_remote (&h, cmdline_credentials, remote);
error = reg_open_remote (&h, cmdline_credentials, remote, NULL);
} else if (backend) {
error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, &curkey);
} else {

View File

@ -99,7 +99,7 @@ static void print_tree(int l, struct registry_key *p, int fullpath, int novals)
}
if (remote) {
error = reg_open_remote(&h, cmdline_credentials, remote);
error = reg_open_remote(&h, cmdline_credentials, remote, NULL);
} else if (backend) {
error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, &root);
} else {

View File

@ -134,7 +134,8 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
const char *host,
const char *sharename,
const char *devtype,
struct cli_credentials *credentials)
struct cli_credentials *credentials,
struct event_context *ev)
{
struct smbcli_tree *tree;
NTSTATUS status;
@ -143,7 +144,7 @@ NTSTATUS smbcli_full_connection(TALLOC_CTX *parent_ctx,
status = smbcli_tree_full_connection(parent_ctx,
&tree, host, 0, sharename, devtype,
credentials);
credentials, ev);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}

View File

@ -382,8 +382,9 @@ NTSTATUS smb_composite_connect_recv(struct composite_context *c, TALLOC_CTX *mem
/*
sync version of smb_composite_connect
*/
NTSTATUS smb_composite_connect(struct smb_composite_connect *io, TALLOC_CTX *mem_ctx)
NTSTATUS smb_composite_connect(struct smb_composite_connect *io, TALLOC_CTX *mem_ctx,
struct event_context *ev)
{
struct composite_context *c = smb_composite_connect_send(io, NULL);
struct composite_context *c = smb_composite_connect_send(io, ev);
return smb_composite_connect_recv(c, mem_ctx);
}

View File

@ -263,7 +263,7 @@ static struct smbcli_request *session_setup_spnego(struct composite_context *c,
smbcli_temp_set_signing(session->transport);
status = gensec_client_start(session, &session->gensec);
status = gensec_client_start(session, &session->gensec, c->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to start GENSEC client mode: %s\n", nt_errstr(status)));
return NULL;

View File

@ -144,7 +144,7 @@ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, struct cli_credentials *cr
DATA_BLOB input = data_blob(NULL, 0);
DATA_BLOB output = data_blob(NULL, 0);
status = gensec_client_start(conn, &conn->gensec);
status = gensec_client_start(conn, &conn->gensec, NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status)));
goto failed;

View File

@ -166,7 +166,8 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
struct smbcli_tree **ret_tree,
const char *dest_host, int port,
const char *service, const char *service_type,
struct cli_credentials *credentials)
struct cli_credentials *credentials,
struct event_context *ev)
{
struct smb_composite_connect io;
NTSTATUS status;
@ -179,7 +180,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx,
io.in.credentials = credentials;
io.in.workgroup = lp_workgroup();
status = smb_composite_connect(&io, parent_ctx);
status = smb_composite_connect(&io, parent_ctx, ev);
if (NT_STATUS_IS_OK(status)) {
*ret_tree = io.out.tree;
}

View File

@ -76,7 +76,7 @@ static NTSTATUS smblsa_connect(struct smbcli_state *cli)
}
lsa->ipc_tree->tid = tcon.tconx.out.tid;
lsa->pipe = dcerpc_pipe_init(lsa);
lsa->pipe = dcerpc_pipe_init(lsa, cli->transport->socket->event.ctx);
if (lsa->pipe == NULL) {
talloc_free(lsa);
return NT_STATUS_NO_MEMORY;

View File

@ -20,27 +20,26 @@
#include "includes.h"
#include "libnet/libnet.h"
#include "lib/events/events.h"
struct libnet_context *libnet_context_init(void)
struct libnet_context *libnet_context_init(struct event_context *ev)
{
TALLOC_CTX *mem_ctx;
struct libnet_context *ctx;
mem_ctx = talloc_init("libnet_context");
ctx = talloc(mem_ctx, struct libnet_context);
ctx = talloc(NULL, struct libnet_context);
if (!ctx) {
return NULL;
}
ctx->mem_ctx = mem_ctx;
if (ev == NULL) {
ev = event_context_init(ctx);
if (ev == NULL) {
talloc_free(ctx);
return NULL;
}
}
ctx->event_ctx = ev;
return ctx;
}
void libnet_context_destroy(struct libnet_context **libnetctx)
{
talloc_free((*libnetctx)->mem_ctx);
(*libnetctx) = NULL;
}

View File

@ -19,8 +19,6 @@
*/
struct libnet_context {
TALLOC_CTX *mem_ctx;
/* here we need:
* a client env context
* a user env context
@ -33,6 +31,8 @@ struct libnet_context {
/* opened handles */
struct policy_handle domain_handle;
struct policy_handle user_handle;
struct event_context *event_ctx;
};

View File

@ -100,7 +100,7 @@ static NTSTATUS libnet_rpc_connect_standard(struct libnet_context *ctx, TALLOC_C
binding,
r->standard.in.dcerpc_iface_uuid,
r->standard.in.dcerpc_iface_version,
ctx->cred);
ctx->cred, ctx->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
r->standard.out.error_string = talloc_asprintf(mem_ctx,

View File

@ -221,7 +221,7 @@ static NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *
nt_status = dcerpc_pipe_connect_b(mem_ctx, &p, b,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
machine_account);
machine_account, ctx->event_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
return nt_status;

View File

@ -67,8 +67,11 @@ static int dcerpc_connection_destructor(void *ptr)
}
/* initialise a dcerpc connection. */
struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx)
/* initialise a dcerpc connection.
the event context is optional
*/
struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx,
struct event_context *ev)
{
struct dcerpc_connection *c;
@ -77,6 +80,15 @@ 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->event_ctx = ev;
c->call_id = 1;
c->security_state.auth_info = NULL;
c->security_state.session_key = dcerpc_generic_session_key;
@ -93,7 +105,7 @@ struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx)
}
/* initialise a dcerpc pipe. */
struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx)
struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *ev)
{
struct dcerpc_pipe *p;
@ -102,7 +114,7 @@ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx)
return NULL;
}
p->conn = dcerpc_connection_init(p);
p->conn = dcerpc_connection_init(p, ev);
if (p->conn == NULL) {
talloc_free(p);
return NULL;
@ -559,13 +571,12 @@ static NTSTATUS full_request(struct dcerpc_connection *c,
return status;
}
event_add_timed(c->transport.event_context(c), state,
event_add_timed(c->event_ctx, state,
timeval_current_ofs(DCERPC_REQUEST_TIMEOUT, 0),
dcerpc_full_timeout_handler, state);
while (NT_STATUS_IS_OK(state->status) && state->reply_blob) {
struct event_context *ctx = c->transport.event_context(c);
if (event_loop_once(ctx) != 0) {
if (event_loop_once(c->event_ctx) != 0) {
return NT_STATUS_CONNECTION_DISCONNECTED;
}
}
@ -850,7 +861,7 @@ static void dcerpc_request_recv_data(struct dcerpc_connection *c,
handle timeouts of individual dcerpc requests
*/
static void dcerpc_timeout_handler(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private)
struct timeval t, void *private)
{
struct rpc_request *req = talloc_get_type(private, struct rpc_request);
@ -985,7 +996,7 @@ struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p,
*/
struct event_context *dcerpc_event_context(struct dcerpc_pipe *p)
{
return p->conn->transport.event_context(p->conn);
return p->conn->event_ctx;
}

View File

@ -48,6 +48,7 @@ struct dcerpc_connection {
uint_t flags;
struct dcerpc_security security_state;
const char *binding_string;
struct event_context *event_ctx;
struct dcerpc_transport {
enum dcerpc_transport_t transport;
@ -63,9 +64,6 @@ struct dcerpc_connection {
/* send a read request to the server */
NTSTATUS (*send_read)(struct dcerpc_connection *);
/* get an event context for the connection */
struct event_context *(*event_context)(struct dcerpc_connection *);
/* a callback to the dcerpc code when a full fragment
has been received */
void (*recv_data)(struct dcerpc_connection *, DATA_BLOB *, NTSTATUS status);

View File

@ -51,7 +51,8 @@ NTSTATUS dcerpc_bind_auth(struct dcerpc_pipe *p, uint8_t auth_type, uint8_t auth
DATA_BLOB null_data_blob = data_blob(NULL, 0);
if (!p->conn->security_state.generic_state) {
status = gensec_client_start(p, &p->conn->security_state.generic_state);
status = gensec_client_start(p, &p->conn->security_state.generic_state,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) goto done;
status = gensec_start_mech_by_authtype(p->conn->security_state.generic_state,
@ -153,7 +154,8 @@ NTSTATUS dcerpc_bind_auth_password(struct dcerpc_pipe *p,
p->conn->flags |= DCERPC_CONNECT;
}
status = gensec_client_start(p, &p->conn->security_state.generic_state);
status = gensec_client_start(p, &p->conn->security_state.generic_state,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to start GENSEC client mode: %s\n", nt_errstr(status)));
return status;

View File

@ -64,7 +64,9 @@ static NTSTATUS dcerpc_schannel_key(TALLOC_CTX *tmp_ctx,
}
/* Make binding string for netlogon, not the other pipe */
status = dcerpc_epm_map_binding(tmp_ctx, b, DCERPC_NETLOGON_UUID, DCERPC_NETLOGON_VERSION);
status = dcerpc_epm_map_binding(tmp_ctx, b,
DCERPC_NETLOGON_UUID, DCERPC_NETLOGON_VERSION,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
DCERPC_NETLOGON_UUID, nt_errstr(status)));

View File

@ -309,18 +309,6 @@ static NTSTATUS smb_send_request(struct dcerpc_connection *c, DATA_BLOB *blob, B
return NT_STATUS_OK;
}
/*
return the event context for the pipe, so the caller can wait
for events asynchronously
*/
static struct event_context *smb_event_context(struct dcerpc_connection *c)
{
struct smb_private *smb = c->transport.private;
return smb->tree->session->transport->socket->event.ctx;
}
/*
shutdown SMB pipe connection
*/
@ -426,7 +414,6 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_connection *c,
c->transport.send_request = smb_send_request;
c->transport.send_read = send_read_request;
c->transport.event_context = smb_event_context;
c->transport.recv_data = NULL;
/* Over-ride the default session key with the SMB session key */

View File

@ -36,7 +36,6 @@ struct sock_blob {
/* transport private information used by general socket pipe transports */
struct sock_private {
struct event_context *event_ctx;
struct fd_event *fde;
struct socket_context *sock;
char *server_name;
@ -259,16 +258,6 @@ static NTSTATUS sock_send_request(struct dcerpc_connection *p, DATA_BLOB *data,
return NT_STATUS_OK;
}
/*
return the event context so the caller can process asynchronously
*/
static struct event_context *sock_event_context(struct dcerpc_connection *p)
{
struct sock_private *sock = p->transport.private;
return sock->event_ctx;
}
/*
shutdown sock pipe connection
*/
@ -331,7 +320,6 @@ static NTSTATUS dcerpc_pipe_open_socket(struct dcerpc_connection *c,
c->transport.send_request = sock_send_request;
c->transport.send_read = sock_send_read;
c->transport.event_context = sock_event_context;
c->transport.recv_data = NULL;
c->transport.shutdown_pipe = sock_shutdown_pipe;
@ -339,13 +327,12 @@ static NTSTATUS dcerpc_pipe_open_socket(struct dcerpc_connection *c,
sock->sock = socket_ctx;
sock->server_name = strupper_talloc(sock, server);
sock->event_ctx = event_context_init(sock);
sock->pending_send = NULL;
sock->recv.received = 0;
sock->recv.data = data_blob(NULL, 0);
sock->recv.pending_count = 0;
sock->fde = event_add_fd(sock->event_ctx, sock, socket_get_fd(sock->sock),
sock->fde = event_add_fd(c->event_ctx, sock, socket_get_fd(sock->sock),
0, sock_io_handler, c);
c->transport.private = sock;

View File

@ -792,7 +792,7 @@ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *
}
NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding,
const char *uuid, uint_t version)
const char *uuid, uint_t version, struct event_context *ev)
{
struct dcerpc_pipe *p;
NTSTATUS status;
@ -850,7 +850,7 @@ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *bind
epmapper_binding,
DCERPC_EPMAPPER_UUID,
DCERPC_EPMAPPER_VERSION,
anon_creds);
anon_creds, ev);
if (!NT_STATUS_IS_OK(status)) {
return status;
@ -994,12 +994,12 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
status = smbcli_full_connection(p->conn, &cli,
binding->host,
"IPC$", NULL,
anon_creds);
anon_creds, p->conn->event_ctx);
} else {
status = smbcli_full_connection(p->conn, &cli,
binding->host,
"IPC$", NULL,
credentials);
credentials, p->conn->event_ctx);
}
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to connect to %s - %s\n", binding->host, nt_errstr(status)));
@ -1008,7 +1008,9 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(TALLOC_CTX *tmp_ctx,
/* Look up identifier using the epmapper */
if (!binding->endpoint) {
status = dcerpc_epm_map_binding(tmp_ctx, binding, pipe_uuid, pipe_version);
status = dcerpc_epm_map_binding(tmp_ctx, binding,
pipe_uuid, pipe_version,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
pipe_uuid, nt_errstr(status)));
@ -1040,7 +1042,9 @@ static NTSTATUS dcerpc_pipe_connect_ncalrpc(TALLOC_CTX *tmp_ctx,
/* Look up identifier using the epmapper */
if (!binding->endpoint) {
status = dcerpc_epm_map_binding(tmp_ctx, binding, pipe_uuid, pipe_version);
status = dcerpc_epm_map_binding(tmp_ctx, binding,
pipe_uuid, pipe_version,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCALRPC identifier for '%s' - %s\n",
pipe_uuid, nt_errstr(status)));
@ -1100,7 +1104,8 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_ip_tcp(TALLOC_CTX *tmp_ctx,
if (!binding->endpoint) {
status = dcerpc_epm_map_binding(tmp_ctx, binding,
pipe_uuid, pipe_version);
pipe_uuid, pipe_version,
p->conn->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP port for '%s' - %s\n",
pipe_uuid, nt_errstr(status)));
@ -1129,7 +1134,8 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
struct dcerpc_binding *binding,
const char *pipe_uuid,
uint32_t pipe_version,
struct cli_credentials *credentials)
struct cli_credentials *credentials,
struct event_context *ev)
{
NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
struct dcerpc_pipe *p;
@ -1138,7 +1144,7 @@ NTSTATUS dcerpc_pipe_connect_b(TALLOC_CTX *parent_ctx,
(*pp) = NULL;
p = dcerpc_pipe_init(parent_ctx);
p = dcerpc_pipe_init(parent_ctx, ev);
if (p == NULL) {
return NT_STATUS_NO_MEMORY;
}
@ -1189,7 +1195,8 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
const char *binding,
const char *pipe_uuid,
uint32_t pipe_version,
struct cli_credentials *credentials)
struct cli_credentials *credentials,
struct event_context *ev)
{
struct dcerpc_binding *b;
NTSTATUS status;
@ -1210,7 +1217,8 @@ NTSTATUS dcerpc_pipe_connect(TALLOC_CTX *parent_ctx,
DEBUG(3,("Using binding %s\n", dcerpc_binding_string(tmp_ctx, b)));
status = dcerpc_pipe_connect_b(tmp_ctx,
pp, b, pipe_uuid, pipe_version, credentials);
pp, b, pipe_uuid, pipe_version,
credentials, ev);
if (NT_STATUS_IS_OK(status)) {
*pp = talloc_reference(parent_ctx, *pp);
@ -1235,7 +1243,7 @@ NTSTATUS dcerpc_secondary_connection(struct dcerpc_pipe *p, struct dcerpc_pipe *
struct smbcli_tree *tree;
NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
(*p2) = dcerpc_pipe_init(p);
(*p2) = dcerpc_pipe_init(p, p->conn->event_ctx);
if (*p2 == NULL) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -54,7 +54,7 @@ BOOL dcesrv_auth_bind(struct dcesrv_call_state *call)
return False;
}
status = gensec_server_start(dce_conn, &auth->gensec_security);
status = gensec_server_start(dce_conn, &auth->gensec_security, call->event_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
return False;

View File

@ -460,7 +460,8 @@ static NTSTATUS netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call, TALLOC_
}
/* TODO: we need to deny anonymous access here */
nt_status = auth_context_create(mem_ctx, lp_auth_methods(), &auth_context);
nt_status = auth_context_create(mem_ctx, lp_auth_methods(), &auth_context,
dce_call->event_ctx);
NT_STATUS_NOT_OK_RETURN(nt_status);
nt_status = auth_get_challenge(auth_context, &chal);
@ -479,7 +480,8 @@ static NTSTATUS netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call, TALLOC_
case 2:
case 6:
/* TODO: we need to deny anonymous access here */
nt_status = auth_context_create(mem_ctx, lp_auth_methods(), &auth_context);
nt_status = auth_context_create(mem_ctx, lp_auth_methods(), &auth_context,
dce_call->event_ctx);
NT_STATUS_NOT_OK_RETURN(nt_status);
nt_status = auth_context_set_challenge(auth_context, r->in.logon.network->challenge, "netr_LogonSamLogonWithFlags");

View File

@ -53,7 +53,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct
status = dcerpc_pipe_connect(private,
&(private->c_pipe), binding,
iface->uuid, iface->if_version,
credentials);
credentials, dce_call->event_ctx);
talloc_free(credentials);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -81,7 +81,10 @@ static int ejs_systemAuth(TALLOC_CTX *tmp_ctx, struct MprVar *auth, const char *
NTSTATUS nt_status;
DATA_BLOB pw_blob;
nt_status = auth_context_create(tmp_ctx, auth_unix, &auth_context);
/*
darn, we need some way to get the right event_context here
*/
nt_status = auth_context_create(tmp_ctx, auth_unix, &auth_context, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
mprSetPropertyValue(auth, "result", mprCreateBoolVar(False));
mprSetPropertyValue(auth, "report", mprCreateStringVar("Auth System Failure", 1));

View File

@ -232,7 +232,7 @@ static int ejs_cli_tree_connect(MprVarHandle eid, int argc, MprVar **argv)
union smb_tcon tcon;
TALLOC_CTX *mem_ctx;
NTSTATUS status;
char *password = "";
const char *password = "";
/* Argument parsing */

View File

@ -38,7 +38,9 @@ static NTSTATUS get_challenge(struct smbsrv_connection *smb_conn, uint8_t buff[8
DEBUG(10, ("get challenge: creating negprot_global_auth_context\n"));
nt_status = auth_context_create(smb_conn, lp_auth_methods(), &smb_conn->negotiate.auth_context);
nt_status = auth_context_create(smb_conn, lp_auth_methods(),
&smb_conn->negotiate.auth_context,
smb_conn->connection->event.ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("auth_context_create() returned %s", nt_errstr(nt_status)));
return nt_status;
@ -327,7 +329,9 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
struct gensec_security *gensec_security;
DATA_BLOB null_data_blob = data_blob(NULL, 0);
DATA_BLOB blob;
NTSTATUS nt_status = gensec_server_start(req->smb_conn, &gensec_security);
NTSTATUS nt_status = gensec_server_start(req->smb_conn,
&gensec_security,
req->smb_conn->connection->event.ctx);
if (req->smb_conn->negotiate.auth_context) {
smbsrv_terminate_connection(req->smb_conn, "reply_nt1: is this a secondary negprot? auth_context is non-NULL!\n");

View File

@ -149,7 +149,9 @@ static NTSTATUS sesssetup_nt1(struct smbsrv_request *req, union smb_sesssetup *s
}
/* TODO: should we use just "anonymous" here? */
status = auth_context_create(req->smb_conn, lp_auth_methods(), &auth_context);
status = auth_context_create(req->smb_conn, lp_auth_methods(),
&auth_context,
req->smb_conn->connection->event.ctx);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(mem_ctx);
return status;
@ -268,7 +270,8 @@ static NTSTATUS sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup
gensec_ctx = smb_sess->gensec_ctx;
status = gensec_update(gensec_ctx, req, sess->spnego.in.secblob, &sess->spnego.out.secblob);
} else {
status = gensec_server_start(req->smb_conn, &gensec_ctx);
status = gensec_server_start(req->smb_conn, &gensec_ctx,
req->smb_conn->connection->event.ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
return status;

View File

@ -31,7 +31,7 @@ BOOL torture_ntlmssp_self_check(void)
DATA_BLOB sig, expected_sig;
NTSTATUS status;
status = gensec_client_start(NULL, &gensec_security);
status = gensec_client_start(NULL, &gensec_security, NULL);
if (!NT_STATUS_IS_OK(status)) {
return False;
@ -83,7 +83,7 @@ BOOL torture_ntlmssp_self_check(void)
talloc_free(gensec_security);
status = gensec_client_start(NULL, &gensec_security);
status = gensec_client_start(NULL, &gensec_security, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to start GENSEC for NTLMSSP\n");

View File

@ -38,7 +38,7 @@ static BOOL test_readwrite(TALLOC_CTX *mem_ctx, const char *host)
char test_data[5];
int i;
com_init(&ctx);
com_init(&ctx, NULL);
dcom_client_init(ctx, cmdline_credentials);
GUID_from_string(COM_ISTREAM_UUID, &IID[0]);

View File

@ -183,7 +183,7 @@ static BOOL connect_servers(void)
status = smbcli_full_connection(NULL, &servers[i].cli[j],
servers[i].server_name,
servers[i].share_name, NULL,
servers[i].credentials);
servers[i].credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to \\\\%s\\%s - %s\n",
servers[i].server_name, servers[i].share_name,

View File

@ -106,7 +106,7 @@ BOOL torture_createuser(void)
mem_ctx = talloc_init("test_createuser");
binding = lp_parm_string(-1, "torture", "binding");
ctx = libnet_context_init();
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
req.in.user_name = TEST_USERNAME;

View File

@ -122,7 +122,7 @@ static struct smbcli_state *connect_one(char *share, int snum)
status = smbcli_full_connection(NULL, &c,
server,
share, NULL,
servers[snum]);
servers[snum], NULL);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}

View File

@ -165,7 +165,7 @@ static struct smbcli_state *connect_one(char *share)
nt_status = smbcli_full_connection(NULL,
&c, myname, server_n, 0, share, NULL,
username, lp_workgroup(), password);
username, lp_workgroup(), password, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
return NULL;

View File

@ -82,7 +82,7 @@ static struct smbcli_state *connect_one(char *share)
status = smbcli_full_connection(NULL, &c,
server,
share, NULL,
credentials);
credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
return NULL;

View File

@ -212,7 +212,7 @@ BOOL torture_rpc_mgmt(void)
if (b->transport == NCACN_IP_TCP) {
status = dcerpc_epm_map_binding(loop_ctx, b,
l->table->uuid,
l->table->if_version);
l->table->if_version, NULL);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
printf("Failed to map port for uuid %s\n", l->table->uuid);

View File

@ -1363,7 +1363,7 @@ BOOL torture_rpc_samlogon(void)
status = dcerpc_pipe_connect_b(mem_ctx, &p, b,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
credentials);
credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status));

View File

@ -1505,7 +1505,7 @@ BOOL torture_rpc_samsync(void)
&samsync_state->p, b,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
credentials);
credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@ -1545,7 +1545,7 @@ BOOL torture_rpc_samsync(void)
b_netlogon_wksta,
DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION,
credentials_wksta);
credentials_wksta, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status));

View File

@ -168,7 +168,7 @@ BOOL torture_rpc_scanner(void)
if (b->transport == NCACN_IP_TCP) {
status = dcerpc_epm_map_binding(mem_ctx, b,
l->table->uuid,
l->table->if_version);
l->table->if_version, NULL);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(loop_ctx);
printf("Failed to map port for uuid %s\n", l->table->uuid);

View File

@ -171,7 +171,7 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx,
&p, b,
DCERPC_SAMR_UUID,
DCERPC_SAMR_VERSION,
credentials);
credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect with schannel: %s\n", nt_errstr(status));
goto failed;
@ -193,7 +193,7 @@ static BOOL test_schannel(TALLOC_CTX *mem_ctx,
/* Swap the binding details from SAMR to NETLOGON */
status = dcerpc_epm_map_binding(test_ctx, b, DCERPC_NETLOGON_UUID,
DCERPC_NETLOGON_VERSION);
DCERPC_NETLOGON_VERSION, NULL);
if (!NT_STATUS_IS_OK(status)) {
goto failed;
}

View File

@ -208,7 +208,8 @@ static NTSTATUS connect_to_pipe(struct dcerpc_pipe **pp,
/* Look up identifier using the epmapper */
if (!b->endpoint) {
status = dcerpc_epm_map_binding(tmp_ctx, b, pipe_uuid, pipe_version);
status = dcerpc_epm_map_binding(tmp_ctx, b, pipe_uuid, pipe_version,
NULL);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to map DCERPC/TCP NCACN_NP pipe for '%s' - %s\n",
pipe_uuid, nt_errstr(status)));

View File

@ -82,7 +82,7 @@ BOOL torture_open_connection_share(struct smbcli_state **c,
status = smbcli_full_connection(NULL,
c, hostname,
sharename, NULL,
cmdline_credentials);
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to open connection - %s\n", nt_errstr(status));
return False;
@ -133,7 +133,7 @@ NTSTATUS torture_rpc_connection(TALLOC_CTX *parent_ctx,
status = dcerpc_pipe_connect(parent_ctx,
p, binding, pipe_uuid, pipe_version,
cmdline_credentials);
cmdline_credentials, NULL);
return status;
}
@ -167,7 +167,7 @@ NTSTATUS torture_rpc_connection_transport(TALLOC_CTX *parent_ctx,
b->transport = transport;
status = dcerpc_pipe_connect_b(mem_ctx, p, b, pipe_uuid, pipe_version,
cmdline_credentials);
cmdline_credentials, NULL);
if (NT_STATUS_IS_OK(status)) {
*p = talloc_reference(parent_ctx, *p);
@ -612,7 +612,7 @@ static BOOL run_tcon_devtype_test(void)
status = smbcli_full_connection(NULL,
&cli1, host,
share, NULL,
cmdline_credentials);
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
printf("could not open connection\n");

View File

@ -57,7 +57,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
domain_name = tmp;
libnetctx = libnet_context_init();
libnetctx = libnet_context_init(NULL);
if (!libnetctx) {
return -1;
}
@ -78,7 +78,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
return -1;
}
libnet_context_destroy(&libnetctx);
talloc_free(libnetctx);
return 0;
}

View File

@ -53,7 +53,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
new_password = getpass(password_prompt);
}
libnetctx = libnet_context_init();
libnetctx = libnet_context_init(NULL);
if (!libnetctx) {
return -1;
}
@ -73,7 +73,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
return -1;
}
libnet_context_destroy(&libnetctx);
talloc_free(libnetctx);
return 0;
}
@ -128,7 +128,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
new_password = getpass(password_prompt);
}
libnetctx = libnet_context_init();
libnetctx = libnet_context_init(NULL);
if (!libnetctx) {
return -1;
}
@ -147,7 +147,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
return -1;
}
libnet_context_destroy(&libnetctx);
talloc_free(libnetctx);
return 0;
}

View File

@ -43,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
return net_time_usage(ctx, argc, argv);
}
libnetctx = libnet_context_init();
libnetctx = libnet_context_init(NULL);
if (!libnetctx) {
return -1;
}
@ -66,7 +66,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
printf("%s\n",timestr);
libnet_context_destroy(&libnetctx);
talloc_free(libnetctx);
return 0;
}

View File

@ -44,7 +44,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv)
}
/* libnet context init and its params */
lnet_ctx = libnet_context_init();
lnet_ctx = libnet_context_init(NULL);
if (!lnet_ctx) return -1;
lnet_ctx->cred = ctx->credentials;
@ -61,7 +61,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv)
return -1;
}
libnet_context_destroy(&lnet_ctx);
talloc_free(lnet_ctx);
return 0;
}

View File

@ -31,7 +31,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv)
struct libnet_context *libnetctx;
union libnet_SamDump r;
libnetctx = libnet_context_init();
libnetctx = libnet_context_init(NULL);
if (!libnetctx) {
return -1;
}
@ -50,7 +50,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv)
return -1;
}
libnet_context_destroy(&libnetctx);
talloc_free(libnetctx);
return 0;
}

View File

@ -341,8 +341,9 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
case GSS_SPNEGO_CLIENT:
case NTLMSSP_CLIENT_1:
/* setup the client side */
if (!NT_STATUS_IS_OK(gensec_client_start(NULL, gensec_state))) {
nt_status = gensec_client_start(NULL, gensec_state, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
exit(1);
}
@ -367,7 +368,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
break;
case GSS_SPNEGO_SERVER:
case SQUID_2_5_NTLMSSP:
if (!NT_STATUS_IS_OK(gensec_server_start(NULL, gensec_state))) {
if (!NT_STATUS_IS_OK(gensec_server_start(NULL, gensec_state, NULL))) {
exit(1);
}
break;