r17341: pass a messaging context to auth_context_create()
authorStefan Metzmacher <metze@samba.org>
Mon, 31 Jul 2006 14:05:08 +0000 (14:05 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:15:17 +0000 (14:15 -0500)
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)

17 files changed:
source4/auth/auth.c
source4/auth/auth.h
source4/auth/auth_simple.c
source4/auth/gensec/gensec.c
source4/auth/gensec/gensec.h
source4/auth/ntlmssp/ntlmssp_server.c
source4/kdc/kpasswdd.c
source4/ldap_server/ldap_bind.c
source4/rpc_server/dcesrv_auth.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/scripting/ejs/smbcalls_auth.c
source4/smb_server/smb/negprot.c
source4/smb_server/smb/sesssetup.c
source4/smb_server/smb2/negprot.c
source4/smb_server/smb2/sesssetup.c
source4/utils/config.mk
source4/utils/ntlm_auth.c

index d3b9e28f7bb086f4cb2be1274623ad82a5037d22..e478ac250b62cc1e3340377a26df0d4b68f52793 100644 (file)
@@ -360,8 +360,9 @@ NTSTATUS auth_check_password_recv(struct auth_check_password_request *req,
  Make a auth_info struct for the auth subsystem
 ***************************************************************************/
 NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, const char **methods, 
  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,
-                            struct event_context *ev) 
+                            struct event_context *ev,
+                            struct messaging_context *msg,
+                            struct auth_context **auth_ctx)
 {
        int i;
        struct auth_context *ctx;
 {
        int i;
        struct auth_context *ctx;
@@ -371,22 +372,24 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, const char **methods,
                return NT_STATUS_INTERNAL_ERROR;
        }
 
                return NT_STATUS_INTERNAL_ERROR;
        }
 
+       if (!ev) {
+               DEBUG(0,("auth_context_create: called with out event context\n"));
+               return NT_STATUS_INTERNAL_ERROR;
+       }
+
+       if (!msg) {
+               DEBUG(0,("auth_context_create: called with out messaging context\n"));
+               return NT_STATUS_INTERNAL_ERROR;
+       }
+
        ctx = talloc(mem_ctx, struct auth_context);
        NT_STATUS_HAVE_NO_MEMORY(ctx);
        ctx->challenge.set_by           = NULL;
        ctx->challenge.may_be_modified  = False;
        ctx->challenge.data             = data_blob(NULL, 0);
        ctx->methods                    = NULL;
        ctx = talloc(mem_ctx, struct auth_context);
        NT_STATUS_HAVE_NO_MEMORY(ctx);
        ctx->challenge.set_by           = NULL;
        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;
+       ctx->event_ctx                  = ev;
+       ctx->msg_ctx                    = msg;
 
        for (i=0; methods[i] ; i++) {
                struct auth_method_context *method;
 
        for (i=0; methods[i] ; i++) {
                struct auth_method_context *method;
index 7ebab9c8e14090593f7d259c82426cc1ff20f1f6..badfe147626554ab873c98c85a2c3e8f7baf4de2 100644 (file)
@@ -171,6 +171,9 @@ struct auth_context {
 
        /* the event context to use for calls that can block */
        struct event_context *event_ctx;
 
        /* the event context to use for calls that can block */
        struct event_context *event_ctx;
+
+       /* the messaging context which can be used by backends */
+       struct messaging_context *msg_ctx;
 };
 
 /* this structure is used by backends to determine the size of some critical types */
 };
 
 /* this structure is used by backends to determine the size of some critical types */
index 4448e227e780cb56d220d2e2bb66b3353a00abe6..a0bb636bb6ffa9cf9218098e836cf15a37e7e8b3 100644 (file)
 #include "auth/auth.h"
 #include "lib/events/events.h"
 
 #include "auth/auth.h"
 #include "lib/events/events.h"
 
-_PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx, 
-                                 const char *nt4_domain, 
-                                 const char *nt4_username, 
-                                 const char *password, 
-                                 struct auth_session_info **session_info) 
+_PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
+                                          struct event_context *ev,
+                                          struct messaging_context *msg,
+                                          const char *nt4_domain,
+                                          const char *nt4_username,
+                                          const char *password,
+                                          struct auth_session_info **session_info) 
 {
        struct auth_context *auth_context;
        struct auth_usersupplied_info *user_info;
 {
        struct auth_context *auth_context;
        struct auth_usersupplied_info *user_info;
@@ -42,8 +44,9 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
                return NT_STATUS_NO_MEMORY;
        }
 
-       nt_status = auth_context_create(tmp_ctx, lp_auth_methods(), &auth_context, 
-                                       event_context_find(mem_ctx));
+       nt_status = auth_context_create(tmp_ctx, lp_auth_methods(),
+                                       ev, msg,
+                                       &auth_context);
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(tmp_ctx);
                return nt_status;
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(tmp_ctx);
                return nt_status;
index c0aba3924cef0d047c06fd1b833135f0c994f93b..ecdac8564a7651943908bdf0470a5b9103b83010 100644 (file)
@@ -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, 
   @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);
 {
        (*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)->event_ctx = ev;
+       (*gensec_security)->msg_ctx = msg;
 
        return NT_STATUS_OK;
 }
 
        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)->subcontext = True;
        (*gensec_security)->event_ctx = parent->event_ctx;
+       (*gensec_security)->msg_ctx = parent->msg_ctx;
 
        return NT_STATUS_OK;
 }
 
        return NT_STATUS_OK;
 }
@@ -529,10 +532,20 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
                             struct event_context *ev)
 {
        NTSTATUS status;
                             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)) {
        if (!NT_STATUS_IS_OK(status)) {
+               talloc_free(new_ev);
                return status;
        }
                return status;
        }
+       talloc_steal((*gensec_security), new_ev);
        (*gensec_security)->gensec_role = GENSEC_CLIENT;
 
        return status;
        (*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, 
   @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;
 {
        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;
        }
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index be5e9001889ecdb637b24a151c486957ca16455f..ce015086f6bf79a7d2b6bebecabe242ce6ae2e9b 100644 (file)
@@ -122,6 +122,7 @@ struct gensec_security {
        BOOL subcontext;
        uint32_t want_features;
        struct event_context *event_ctx;
        BOOL subcontext;
        uint32_t want_features;
        struct event_context *event_ctx;
+       struct messaging_context *msg_ctx; /* only valid as server */
        struct socket_address *my_addr, *peer_addr;
 };
 
        struct socket_address *my_addr, *peer_addr;
 };
 
index b574622bbeaa39022d070c161286fa9f4291e50f..eab583811379bf2c1b5495173693301a1afd94bb 100644 (file)
@@ -830,8 +830,9 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security)
        }
 
        nt_status = auth_context_create(gensec_ntlmssp_state, lp_auth_methods(), 
        }
 
        nt_status = auth_context_create(gensec_ntlmssp_state, lp_auth_methods(), 
-                                       &gensec_ntlmssp_state->auth_context,
-                                       gensec_security->event_ctx);
+                                       gensec_security->event_ctx,
+                                       gensec_security->msg_ctx,
+                                       &gensec_ntlmssp_state->auth_context);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
        gensec_ntlmssp_state->get_challenge = auth_ntlmssp_get_challenge;
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
        gensec_ntlmssp_state->get_challenge = auth_ntlmssp_get_challenge;
index 48955e2ca7fff1f40b604d732ad78c7716e70c33..65e7ac1c0040a44eae8f8cd23e3fb84780f365fa 100644 (file)
@@ -451,14 +451,13 @@ BOOL kpasswdd_process(struct kdc_server *kdc,
        ap_req = data_blob_const(&input->data[header_len], ap_req_len);
        krb_priv_req = data_blob_const(&input->data[header_len + ap_req_len], krb_priv_len);
        
        ap_req = data_blob_const(&input->data[header_len], ap_req_len);
        krb_priv_req = data_blob_const(&input->data[header_len + ap_req_len], krb_priv_len);
        
-       nt_status = gensec_server_start(tmp_ctx, &gensec_security, kdc->task->event_ctx);
+       nt_status = gensec_server_start(tmp_ctx, kdc->task->event_ctx, kdc->task->msg_ctx, &gensec_security);
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(tmp_ctx);
                return False;
        }
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(tmp_ctx);
                return False;
        }
 
-       server_credentials 
-               = cli_credentials_init(tmp_ctx);
+       server_credentials = cli_credentials_init(tmp_ctx);
        if (!server_credentials) {
                DEBUG(1, ("Failed to init server credentials\n"));
                return False;
        if (!server_credentials) {
                DEBUG(1, ("Failed to init server credentials\n"));
                return False;
index 60783df4df849c464a71666b3e0f45fe7b735506..fe23d55d1d06cf8db09ff95f715b4b434989f29f 100644 (file)
@@ -46,8 +46,12 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
 
        status = crack_dn_to_nt4_name(call, req->dn, &nt4_domain, &nt4_account);
        if (NT_STATUS_IS_OK(status)) {
 
        status = crack_dn_to_nt4_name(call, req->dn, &nt4_domain, &nt4_account);
        if (NT_STATUS_IS_OK(status)) {
-               status = authenticate_username_pw(call, nt4_domain, nt4_account, 
-                                                 req->creds.password, &session_info);
+               status = authenticate_username_pw(call,
+                                                 call->conn->connection->event.ctx,
+                                                 call->conn->connection->msg_ctx,
+                                                 nt4_domain, nt4_account, 
+                                                 req->creds.password,
+                                                 &session_info);
        }
 
        reply = ldapsrv_init_reply(call, LDAP_TAG_BindResponse);
        }
 
        reply = ldapsrv_init_reply(call, LDAP_TAG_BindResponse);
@@ -135,8 +139,10 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
        if (!conn->gensec) {
                conn->session_info = NULL;
 
        if (!conn->gensec) {
                conn->session_info = NULL;
 
-               status = gensec_server_start(conn, &conn->gensec,
-                                            conn->connection->event.ctx);
+               status = gensec_server_start(conn,
+                                            conn->connection->event.ctx,
+                                            conn->connection->msg_ctx,
+                                            &conn->gensec);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
                        result = LDAP_OPERATIONS_ERROR;
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
                        result = LDAP_OPERATIONS_ERROR;
index a054c5fad94d2df40fabdee4d5c46f68bae69c2d..3f848ca38199ee25d001f569eb52b011118667e7 100644 (file)
@@ -57,7 +57,7 @@ BOOL dcesrv_auth_bind(struct dcesrv_call_state *call)
                return False;
        }
 
                return False;
        }
 
-       status = gensec_server_start(dce_conn, &auth->gensec_security, call->event_ctx);
+       status = gensec_server_start(dce_conn, call->event_ctx, call->msg_ctx, &auth->gensec_security);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("Failed to start GENSEC for DCERPC server: %s\n", nt_errstr(status)));
                return False;
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("Failed to start GENSEC for DCERPC server: %s\n", nt_errstr(status)));
                return False;
index 93ae7a18ed4a772b69f5cb3680d95a9910e43381..569ec9f2b3eafca07188c53e5ab97f0d88611a17 100644 (file)
@@ -431,8 +431,9 @@ static NTSTATUS netr_LogonSamLogon_base(struct dcesrv_call_state *dce_call, TALL
                }
 
                /* TODO: we need to deny anonymous access here */
                }
 
                /* TODO: we need to deny anonymous access here */
-               nt_status = auth_context_create(mem_ctx, lp_auth_methods(), &auth_context,
-                                               dce_call->event_ctx);
+               nt_status = auth_context_create(mem_ctx, lp_auth_methods(),
+                                               dce_call->event_ctx, dce_call->msg_ctx,
+                                               &auth_context);
                NT_STATUS_NOT_OK_RETURN(nt_status);
 
                user_info->logon_parameters = r->in.logon.password->identity_info.parameter_control;
                NT_STATUS_NOT_OK_RETURN(nt_status);
 
                user_info->logon_parameters = r->in.logon.password->identity_info.parameter_control;
@@ -456,8 +457,9 @@ static NTSTATUS netr_LogonSamLogon_base(struct dcesrv_call_state *dce_call, TALL
        case 6:
 
                /* TODO: we need to deny anonymous access here */
        case 6:
 
                /* TODO: we need to deny anonymous access here */
-               nt_status = auth_context_create(mem_ctx, lp_auth_methods(), &auth_context,
-                                               dce_call->event_ctx);
+               nt_status = auth_context_create(mem_ctx, lp_auth_methods(),
+                                               dce_call->event_ctx, dce_call->msg_ctx,
+                                               &auth_context);
                NT_STATUS_NOT_OK_RETURN(nt_status);
 
                nt_status = auth_context_set_challenge(auth_context, r->in.logon.network->challenge, "netr_LogonSamLogonWithFlags");
                NT_STATUS_NOT_OK_RETURN(nt_status);
 
                nt_status = auth_context_set_challenge(auth_context, r->in.logon.network->challenge, "netr_LogonSamLogonWithFlags");
index 678d3c6a7ffabee1a53be5df4cd811db63565846..281f35bb2072c3f831b25af5f6f71dad3166d17d 100644 (file)
@@ -26,6 +26,7 @@
 #include "auth/auth.h"
 #include "scripting/ejs/smbcalls.h"
 #include "lib/events/events.h"
 #include "auth/auth.h"
 #include "scripting/ejs/smbcalls.h"
 #include "lib/events/events.h"
+#include "lib/messaging/irpc.h"
 
 static int ejs_doauth(MprVarHandle eid,
                      TALLOC_CTX *tmp_ctx, struct MprVar *auth, const char *username, 
 
 static int ejs_doauth(MprVarHandle eid,
                      TALLOC_CTX *tmp_ctx, struct MprVar *auth, const char *username, 
@@ -41,17 +42,20 @@ static int ejs_doauth(MprVarHandle eid,
 
        struct smbcalls_context *c;
        struct event_context *ev;
 
        struct smbcalls_context *c;
        struct event_context *ev;
+       struct messaging_context *msg;
 
        /* Hope we can find an smbcalls_context somewhere up there... */
        c = talloc_find_parent_bytype(tmp_ctx, struct smbcalls_context);
        if (c) {
                ev = c->event_ctx;
 
        /* Hope we can find an smbcalls_context somewhere up there... */
        c = talloc_find_parent_bytype(tmp_ctx, struct smbcalls_context);
        if (c) {
                ev = c->event_ctx;
+               msg = c->msg_ctx;
        } else {
                /* Hope we can find the event context somewhere up there... */
                ev = event_context_find(tmp_ctx);
        } else {
                /* Hope we can find the event context somewhere up there... */
                ev = event_context_find(tmp_ctx);
+               msg = messaging_client_init(tmp_ctx, ev);
        }
 
        }
 
-       nt_status = auth_context_create(tmp_ctx, auth_types, &auth_context, ev);
+       nt_status = auth_context_create(tmp_ctx, auth_types, ev, msg, &auth_context);
        if (!NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(auth, "result", mprCreateBoolVar(False));
                mprSetPropertyValue(auth, "report", mprString("Auth System Failure"));
        if (!NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(auth, "result", mprCreateBoolVar(False));
                mprSetPropertyValue(auth, "report", mprString("Auth System Failure"));
index 0f55aaeae76ef2763ef0edacadfd1c77a9117964..25684bee276210af1f315053dde51c17efee6262 100644 (file)
@@ -43,8 +43,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(), 
        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,
-                                       smb_conn->connection->event.ctx);
+                                       smb_conn->connection->event.ctx,
+                                       smb_conn->connection->msg_ctx,
+                                       &smb_conn->negotiate.auth_context);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("auth_context_create() returned %s", nt_errstr(nt_status)));
                return nt_status;
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("auth_context_create() returned %s", nt_errstr(nt_status)));
                return nt_status;
@@ -340,10 +341,12 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
                DATA_BLOB null_data_blob = data_blob(NULL, 0);
                DATA_BLOB blob;
                const char *oid;
                DATA_BLOB null_data_blob = data_blob(NULL, 0);
                DATA_BLOB blob;
                const char *oid;
-               NTSTATUS nt_status = gensec_server_start(req->smb_conn, 
-                                                        &gensec_security,
-                                                        req->smb_conn->connection->event.ctx);
-               
+               NTSTATUS nt_status;
+
+               nt_status = gensec_server_start(req->smb_conn,
+                                               req->smb_conn->connection->event.ctx,
+                                               req->smb_conn->connection->msg_ctx,
+                                               &gensec_security);
                if (!NT_STATUS_IS_OK(nt_status)) {
                        DEBUG(0, ("Failed to start GENSEC: %s\n", nt_errstr(nt_status)));
                        smbsrv_terminate_connection(req->smb_conn, "Failed to start GENSEC\n");
                if (!NT_STATUS_IS_OK(nt_status)) {
                        DEBUG(0, ("Failed to start GENSEC: %s\n", nt_errstr(nt_status)));
                        smbsrv_terminate_connection(req->smb_conn, "Failed to start GENSEC\n");
index fe75cce17ed621eae6998c8eee506c6e019035fb..25655fc14f05c0afa33e6094091d8a575bd2f0e0 100644 (file)
@@ -240,8 +240,9 @@ static void sesssetup_nt1(struct smbsrv_request *req, union smb_sesssetup *sess)
 
                /* TODO: should we use just "anonymous" here? */
                status = auth_context_create(req, lp_auth_methods(), 
 
                /* TODO: should we use just "anonymous" here? */
                status = auth_context_create(req, lp_auth_methods(), 
-                                            &auth_context,
-                                            req->smb_conn->connection->event.ctx);
+                                            req->smb_conn->connection->event.ctx,
+                                            req->smb_conn->connection->msg_ctx,
+                                            &auth_context);
                if (!NT_STATUS_IS_OK(status)) goto failed;
        } else {
                auth_context = req->smb_conn->negotiate.auth_context;
                if (!NT_STATUS_IS_OK(status)) goto failed;
        } else {
                auth_context = req->smb_conn->negotiate.auth_context;
@@ -368,8 +369,10 @@ static void sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup *se
        if (!smb_sess) {
                struct gensec_security *gensec_ctx;
 
        if (!smb_sess) {
                struct gensec_security *gensec_ctx;
 
-               status = gensec_server_start(req, &gensec_ctx,
-                                            req->smb_conn->connection->event.ctx);
+               status = gensec_server_start(req,
+                                            req->smb_conn->connection->event.ctx,
+                                            req->smb_conn->connection->msg_ctx,
+                                            &gensec_ctx);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
                        goto failed;
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
                        goto failed;
index 957bb9204af96a8f4f196ff0e5c73a6e8436dd13..8e3f6156ea41f6ca8a693fc21c07a0d418c28a15 100644 (file)
@@ -36,8 +36,10 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB *
        NTSTATUS nt_status;
        struct cli_credentials *server_credentials;
 
        NTSTATUS nt_status;
        struct cli_credentials *server_credentials;
 
-       nt_status = gensec_server_start(req, &gensec_security,
-                                       req->smb_conn->connection->event.ctx);
+       nt_status = gensec_server_start(req,
+                                       req->smb_conn->connection->event.ctx,
+                                       req->smb_conn->connection->msg_ctx,
+                                       &gensec_security);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Failed to start GENSEC: %s\n", nt_errstr(nt_status)));
                smbsrv_terminate_connection(req->smb_conn, "Failed to start GENSEC\n");
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("Failed to start GENSEC: %s\n", nt_errstr(nt_status)));
                smbsrv_terminate_connection(req->smb_conn, "Failed to start GENSEC\n");
index 44425b90702fb876d9e1e093e08c654b8f8fffb2..2615eed6833a701d13c28f662a904fa2b0fb7f63 100644 (file)
@@ -114,8 +114,10 @@ static void smb2srv_sesssetup_backend(struct smb2srv_request *req, union smb_ses
        if (vuid == 0) {
                struct gensec_security *gensec_ctx;
 
        if (vuid == 0) {
                struct gensec_security *gensec_ctx;
 
-               status = gensec_server_start(req, &gensec_ctx,
-                                            req->smb_conn->connection->event.ctx);
+               status = gensec_server_start(req,
+                                            req->smb_conn->connection->event.ctx,
+                                            req->smb_conn->connection->msg_ctx,
+                                            &gensec_ctx);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
                        goto failed;
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("Failed to start GENSEC server code: %s\n", nt_errstr(status)));
                        goto failed;
index 2dbf26940e564afc27c4dff46d426ef0d55e7fee..69d5a3b77f695ea090dd7694bfc3b99310eace66 100644 (file)
@@ -31,7 +31,9 @@ PRIVATE_DEPENDENCIES = \
                POPT_CREDENTIALS \
                gensec \
                LIBCLI_RESOLVE \
                POPT_CREDENTIALS \
                gensec \
                LIBCLI_RESOLVE \
-               auth
+               auth \
+               MESSAGING \
+               LIBEVENTS
 MANPAGE = man/ntlm_auth.1
 # End BINARY ntlm_auth
 #################################
 MANPAGE = man/ntlm_auth.1
 # End BINARY ntlm_auth
 #################################
index 55aa4e65a97f6a0c760bcf1f5cdd9e1f3fc11b1a..9609ce59daab0218e8a7dedc0884ce6b5d81806f 100644 (file)
@@ -31,6 +31,9 @@
 #include "libcli/auth/libcli_auth.h"
 #include "libcli/security/security.h"
 #include "lib/ldb/include/ldb.h"
 #include "libcli/auth/libcli_auth.h"
 #include "libcli/security/security.h"
 #include "lib/ldb/include/ldb.h"
+#include "lib/events/events.h"
+#include "lib/messaging/messaging.h"
+#include "lib/messaging/irpc.h"
 
 #define SQUID_BUFFER_SIZE 2010
 
 
 #define SQUID_BUFFER_SIZE 2010
 
@@ -329,6 +332,8 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                const char *set_password;
        };
        struct gensec_ntlm_state *state;
                const char *set_password;
        };
        struct gensec_ntlm_state *state;
+       struct event_context *ev;
+       struct messaging_context *msg;
 
        NTSTATUS nt_status;
        BOOL first = False;
 
        NTSTATUS nt_status;
        BOOL first = False;
@@ -399,7 +404,15 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                        break;
                case GSS_SPNEGO_SERVER:
                case SQUID_2_5_NTLMSSP:
                        break;
                case GSS_SPNEGO_SERVER:
                case SQUID_2_5_NTLMSSP:
-                       if (!NT_STATUS_IS_OK(gensec_server_start(NULL, &state->gensec_state, NULL))) {
+                       ev = event_context_init(state);
+                       if (!ev) {
+                               exit(1);
+                       }
+                       msg = messaging_client_init(state, ev);
+                       if (!msg) {
+                               exit(1);
+                       }
+                       if (!NT_STATUS_IS_OK(gensec_server_start(state, ev, msg, &state->gensec_state))) {
                                exit(1);
                        }
                        break;
                                exit(1);
                        }
                        break;