From 7a845bcb0141a895d5685afcef1ffe7f93428d0f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 31 Jul 2006 14:05:08 +0000 Subject: r17341: pass a messaging context to auth_context_create() and gensec_server_start(). calling them with NULL for event context or messaging context is no longer allowed! metze (This used to be commit 679ac74e71b111344f1097ab389c0b83a9247710) --- source4/auth/gensec/gensec.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'source4/auth/gensec/gensec.c') diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c index c0aba3924c..ecdac8564a 100644 --- a/source4/auth/gensec/gensec.c +++ b/source4/auth/gensec/gensec.c @@ -465,8 +465,9 @@ const char **gensec_security_oids(struct gensec_security *gensec_security, @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, - struct event_context *ev) + struct event_context *ev, + struct messaging_context *msg, + struct gensec_security **gensec_security) { (*gensec_security) = talloc(mem_ctx, struct gensec_security); NT_STATUS_HAVE_NO_MEMORY(*gensec_security); @@ -489,6 +490,7 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx, } (*gensec_security)->event_ctx = ev; + (*gensec_security)->msg_ctx = msg; return NT_STATUS_OK; } @@ -514,6 +516,7 @@ _PUBLIC_ NTSTATUS gensec_subcontext_start(TALLOC_CTX *mem_ctx, (*gensec_security)->subcontext = True; (*gensec_security)->event_ctx = parent->event_ctx; + (*gensec_security)->msg_ctx = parent->msg_ctx; return NT_STATUS_OK; } @@ -529,10 +532,20 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, struct event_context *ev) { NTSTATUS status; - status = gensec_start(mem_ctx, gensec_security, ev); + 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, 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; @@ -545,11 +558,23 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx, @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, - struct event_context *ev) + struct event_context *ev, + struct messaging_context *msg, + struct gensec_security **gensec_security) { NTSTATUS status; - status = gensec_start(mem_ctx, gensec_security, ev); + + if (!ev) { + DEBUG(0,("gensec_server_start: no event context given!\n")); + return NT_STATUS_INTERNAL_ERROR; + } + + if (!msg) { + DEBUG(0,("gensec_server_start: no messaging context given!\n")); + return NT_STATUS_INTERNAL_ERROR; + } + + status = gensec_start(mem_ctx, ev, msg, gensec_security); if (!NT_STATUS_IS_OK(status)) { return status; } -- cgit