summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-17 09:22:33 +0200
committerAndrew Bartlett <abartlet@samba.org>2011-10-18 13:13:33 +1100
commite7d5f0a357c42593a015b80390dedf920117a7e2 (patch)
treea4fa1a53f0294607b4abeb6f389ce719502fe849 /auth
parent0f2b27e7d428e75b8e6079ee5f36a0cccd4d1785 (diff)
downloadsamba-e7d5f0a357c42593a015b80390dedf920117a7e2.tar.gz
samba-e7d5f0a357c42593a015b80390dedf920117a7e2.tar.bz2
samba-e7d5f0a357c42593a015b80390dedf920117a7e2.zip
gensec: move event context from gensec_*_init() to gensec_update()
This avoids keeping the event context around on a the gensec_security context structure long term. In the Samba3 server, the event context we either supply is a NULL pointer as no server-side modules currently use the event context. Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'auth')
-rw-r--r--auth/gensec/gensec.c7
-rw-r--r--auth/gensec/gensec.h5
-rw-r--r--auth/gensec/gensec_start.c9
3 files changed, 8 insertions, 13 deletions
diff --git a/auth/gensec/gensec.c b/auth/gensec/gensec.c
index b7f89f1d56..cdc7c670ab 100644
--- a/auth/gensec/gensec.c
+++ b/auth/gensec/gensec.c
@@ -197,12 +197,13 @@ _PUBLIC_ NTSTATUS gensec_session_info(struct gensec_security *gensec_security,
*/
_PUBLIC_ NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
- const DATA_BLOB in, DATA_BLOB *out)
+ struct tevent_context *ev,
+ const DATA_BLOB in, DATA_BLOB *out)
{
NTSTATUS status;
status = gensec_security->ops->update(gensec_security, out_mem_ctx,
- in, out);
+ ev, in, out);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -305,7 +306,7 @@ static void gensec_update_async_trigger(struct tevent_context *ctx,
tevent_req_data(req, struct gensec_update_state);
NTSTATUS status;
- status = gensec_update(state->gensec_security, state,
+ status = gensec_update(state->gensec_security, state, ctx,
state->in, &state->out);
if (tevent_req_nterror(req, status)) {
return;
diff --git a/auth/gensec/gensec.h b/auth/gensec/gensec.h
index ee87a4da79..acfc54926c 100644
--- a/auth/gensec/gensec.h
+++ b/auth/gensec/gensec.h
@@ -92,6 +92,7 @@ struct gensec_security_ops {
NTSTATUS (*magic)(struct gensec_security *gensec_security,
const DATA_BLOB *first_packet);
NTSTATUS (*update)(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
+ struct tevent_context *ev,
const DATA_BLOB in, DATA_BLOB *out);
NTSTATUS (*seal_packet)(struct gensec_security *gensec_security, TALLOC_CTX *sig_mem_ctx,
uint8_t *data, size_t length,
@@ -161,7 +162,6 @@ struct gensec_security {
bool subcontext;
uint32_t want_features;
uint8_t dcerpc_auth_level;
- struct tevent_context *event_ctx;
struct tsocket_address *local_addr, *remote_addr;
struct gensec_settings *settings;
@@ -212,13 +212,13 @@ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security);
NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security,
- struct tevent_context *ev,
struct gensec_settings *settings);
NTSTATUS gensec_start_mech_by_ops(struct gensec_security *gensec_security,
const struct gensec_security_ops *ops);
NTSTATUS gensec_start_mech_by_sasl_list(struct gensec_security *gensec_security,
const char **sasl_names);
NTSTATUS gensec_update(struct gensec_security *gensec_security, TALLOC_CTX *out_mem_ctx,
+ struct tevent_context *ev,
const DATA_BLOB in, DATA_BLOB *out);
struct tevent_req *gensec_update_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
@@ -267,7 +267,6 @@ NTSTATUS gensec_start_mech_by_authtype(struct gensec_security *gensec_security,
uint8_t auth_type, uint8_t auth_level);
const char *gensec_get_name_by_authtype(struct gensec_security *gensec_security, uint8_t authtype);
NTSTATUS gensec_server_start(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct gensec_settings *settings,
struct auth4_context *auth_context,
struct gensec_security **gensec_security);
diff --git a/auth/gensec/gensec_start.c b/auth/gensec/gensec_start.c
index aa609c9b6f..d5a5dc83bb 100644
--- a/auth/gensec/gensec_start.c
+++ b/auth/gensec/gensec_start.c
@@ -506,7 +506,6 @@ const char **gensec_security_oids(struct gensec_security *gensec_security,
@ gensec_security return
*/
static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct gensec_settings *settings,
struct auth4_context *auth_context,
struct gensec_security **gensec_security)
@@ -514,7 +513,6 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
(*gensec_security) = talloc_zero(mem_ctx, struct gensec_security);
NT_STATUS_HAVE_NO_MEMORY(*gensec_security);
- (*gensec_security)->event_ctx = ev;
SMB_ASSERT(settings->lp_ctx != NULL);
(*gensec_security)->settings = talloc_reference(*gensec_security, settings);
@@ -548,7 +546,6 @@ _PUBLIC_ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx,
(*gensec_security)->subcontext = true;
(*gensec_security)->want_features = parent->want_features;
(*gensec_security)->dcerpc_auth_level = parent->dcerpc_auth_level;
- (*gensec_security)->event_ctx = parent->event_ctx;
(*gensec_security)->auth_context = talloc_reference(*gensec_security, parent->auth_context);
(*gensec_security)->settings = talloc_reference(*gensec_security, parent->settings);
(*gensec_security)->auth_context = talloc_reference(*gensec_security, parent->auth_context);
@@ -564,7 +561,6 @@ _PUBLIC_ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx,
*/
_PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
struct gensec_security **gensec_security,
- struct tevent_context *ev,
struct gensec_settings *settings)
{
NTSTATUS status;
@@ -574,7 +570,7 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_ERROR;
}
- status = gensec_start(mem_ctx, ev, settings, NULL, gensec_security);
+ status = gensec_start(mem_ctx, settings, NULL, gensec_security);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -592,7 +588,6 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
@note The mem_ctx is only a parent and may be NULL.
*/
_PUBLIC_ NTSTATUS gensec_server_start(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
struct gensec_settings *settings,
struct auth4_context *auth_context,
struct gensec_security **gensec_security)
@@ -604,7 +599,7 @@ _PUBLIC_ NTSTATUS gensec_server_start(TALLOC_CTX *mem_ctx,
return NT_STATUS_INTERNAL_ERROR;
}
- status = gensec_start(mem_ctx, ev, settings, auth_context, gensec_security);
+ status = gensec_start(mem_ctx, settings, auth_context, gensec_security);
if (!NT_STATUS_IS_OK(status)) {
return status;
}