diff options
-rw-r--r-- | source3/auth/auth_samba4.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/source3/auth/auth_samba4.c b/source3/auth/auth_samba4.c index 6692f187be..1bf4227b9e 100644 --- a/source3/auth/auth_samba4.c +++ b/source3/auth/auth_samba4.c @@ -107,6 +107,7 @@ static NTSTATUS prepare_gensec(TALLOC_CTX *mem_ctx, struct gensec_security *gensec_ctx; struct imessaging_context *msg_ctx; struct cli_credentials *server_credentials; + struct server_id *server_id; lp_ctx = loadparm_init_s3(frame, loadparm_s3_context()); if (lp_ctx == NULL) { @@ -121,15 +122,25 @@ static NTSTATUS prepare_gensec(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_SERVER_STATE; } - msg_ctx = imessaging_client_init(frame, - lp_ctx, - event_ctx); + server_id = new_server_id_task(frame); + if (server_id == NULL) { + DEBUG(1, ("new_server_id_task failed\n")); + TALLOC_FREE(frame); + return NT_STATUS_INVALID_SERVER_STATE; + } + + msg_ctx = imessaging_init(frame, + lp_ctx, + *server_id, + event_ctx, true); if (msg_ctx == NULL) { DEBUG(1, ("imessaging_init failed\n")); TALLOC_FREE(frame); return NT_STATUS_INVALID_SERVER_STATE; } + talloc_reparent(frame, msg_ctx, server_id); + server_credentials = cli_credentials_init(frame); if (!server_credentials) { @@ -179,6 +190,7 @@ static NTSTATUS make_auth4_context_s4(TALLOC_CTX *mem_ctx, struct tevent_context *event_ctx; TALLOC_CTX *frame = talloc_stackframe(); struct imessaging_context *msg_ctx; + struct server_id *server_id; lp_ctx = loadparm_init_s3(frame, loadparm_s3_context()); if (lp_ctx == NULL) { @@ -193,14 +205,23 @@ static NTSTATUS make_auth4_context_s4(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_SERVER_STATE; } - msg_ctx = imessaging_client_init(frame, - lp_ctx, - event_ctx); + server_id = new_server_id_task(frame); + if (server_id == NULL) { + DEBUG(1, ("new_server_id_task failed\n")); + TALLOC_FREE(frame); + return NT_STATUS_INVALID_SERVER_STATE; + } + + msg_ctx = imessaging_init(frame, + lp_ctx, + *server_id, + event_ctx, true); if (msg_ctx == NULL) { DEBUG(1, ("imessaging_init failed\n")); TALLOC_FREE(frame); return NT_STATUS_INVALID_SERVER_STATE; } + talloc_reparent(frame, msg_ctx, server_id); status = auth_context_create(mem_ctx, event_ctx, |