The branch, master has been updated
       via  b05d28e s4:winbind: let wb_update_rodc_dns_send/recv use 
netlogon_queue (bug #9097)
       via  6460129 s4:winbind: let wb_sam_logon_send/recv() use the 
netlogon_queue (bug #9097)
       via  19daec6 s4:winbind: add a netlogon_queue (tevent_queue)
       via  d4aa897 s4:winbind: convert wb_update_rodc_dns_send/recv to 
tevent_req
       via  0ccdaa9 s4:winbind: convert wb_sam_logon_send/recv to tevent_req
       via  d3756d8 s4:winbind: convert wb_sid2domain to tevent_req internally
       via  89a5a71 s4:librpc/rpc: don't do async requests if gensec doesn't 
support async replies (bug #9097)
       via  0bd0ad9 s4:librpc/rpc: also call dcerpc_schedule_io_trigger() after 
bind and alter_context responses
       via  e44b5bd s4:librpc/rpc: use dcerpc_req_dequeue() in 
dcerpc_request_recv_data()
       via  81bc57d s4:librpc/rpc: use talloc_zero for 'struct rpc_request'
       via  28350ae libcli/smb: split out a smb_transport private library
       via  5eec19b libcli/smb: wscript_build => wscript
      from  aca444c Remove useless bool "upper_case_domain" parameter from 
ntv2_owf_gen().

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b05d28ebddb7ebd4f8e28a80489fceb8703a9868
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 17:42:18 2012 +0200

    s4:winbind: let wb_update_rodc_dns_send/recv use netlogon_queue (bug #9097)
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <[email protected]>
    Autobuild-Date(master): Sat Aug 25 05:06:18 CEST 2012 on sn-devel-104

commit 646012954c4704375912ba2c049266f122c76f97
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 13:40:13 2012 +0200

    s4:winbind: let wb_sam_logon_send/recv() use the netlogon_queue (bug #9097)
    
    metze

commit 19daec6a95fd89b34f126118fcd3d3c4e7db72e6
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 13:39:14 2012 +0200

    s4:winbind: add a netlogon_queue (tevent_queue)
    
    This will protect the netlogon_creds later.
    
    metze

commit d4aa8978ccecc40e3fd4fb89e76199b82ddf87ff
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 17:39:58 2012 +0200

    s4:winbind: convert wb_update_rodc_dns_send/recv to tevent_req
    
    metze

commit 0ccdaa940a80181d1f263386324668a0a715dbf9
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 13:15:42 2012 +0200

    s4:winbind: convert wb_sam_logon_send/recv to tevent_req
    
    metze

commit d3756d87389fb7111c35e1e01f23abfb13f814a7
Author: Stefan Metzmacher <[email protected]>
Date:   Thu Aug 23 13:14:17 2012 +0200

    s4:winbind: convert wb_sid2domain to tevent_req internally
    
    The public wrapper still uses composite_context, because I don't
    have time to fix all the callers...
    
    metze

commit 89a5a7165469da35f0f6c87c4c34579aa4f75531
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 08:29:21 2012 +0200

    s4:librpc/rpc: don't do async requests if gensec doesn't support async 
replies (bug #9097)
    
    metze

commit 0bd0ad967d1b5f82cbbd2df8fcb8a54d1ed5db40
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 08:27:47 2012 +0200

    s4:librpc/rpc: also call dcerpc_schedule_io_trigger() after bind and 
alter_context responses
    
    metze

commit e44b5bdb2cc756620517a7341e1ad81d606e359d
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 08:26:53 2012 +0200

    s4:librpc/rpc: use dcerpc_req_dequeue() in dcerpc_request_recv_data()
    
    metze

commit 81bc57d39536516d64fd59978e300d64eac1d97c
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 24 13:17:23 2012 +0200

    s4:librpc/rpc: use talloc_zero for 'struct rpc_request'
    
    metze

commit 28350aeaa19d419bfc8f2fef69b136f42a0234ae
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 10 12:34:59 2012 +0200

    libcli/smb: split out a smb_transport private library
    
    metze

commit 5eec19bc838a276eeea10ddedc50d5f0697f120e
Author: Stefan Metzmacher <[email protected]>
Date:   Fri Aug 10 12:38:41 2012 +0200

    libcli/smb: wscript_build => wscript
    
    We'll need some configure checks in future.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 libcli/smb/{wscript_build => wscript} |   21 +++-
 source4/librpc/rpc/dcerpc.c           |   53 ++++++--
 source4/winbind/wb_init_domain.c      |   10 ++
 source4/winbind/wb_irpc.c             |   48 ++++---
 source4/winbind/wb_pam_auth.c         |   21 ++--
 source4/winbind/wb_sam_logon.c        |  220 +++++++++++++++++++----------
 source4/winbind/wb_server.h           |    2 +
 source4/winbind/wb_sid2domain.c       |  248 +++++++++++++++++++++++----------
 source4/winbind/wb_update_rodc_dns.c  |  206 ++++++++++++++++++---------
 9 files changed, 564 insertions(+), 265 deletions(-)
 rename libcli/smb/{wscript_build => wscript} (58%)


Changeset truncated at 500 lines:

diff --git a/libcli/smb/wscript_build b/libcli/smb/wscript
similarity index 58%
rename from libcli/smb/wscript_build
rename to libcli/smb/wscript
index 40c3c17..ae65d68 100755
--- a/libcli/smb/wscript_build
+++ b/libcli/smb/wscript
@@ -1,11 +1,24 @@
 #!/usr/bin/env python
 
 
-bld.SAMBA_LIBRARY('cli_smb_common',
+def build(bld):
+    bld.SAMBA_LIBRARY('smb_transport',
+        source='''
+            read_smb.c
+        ''',
+        deps='errors LIBASYNC_REQ',
+        public_deps='talloc tevent samba-util',
+        private_library=True,
+        public_headers='''
+            read_smb.h
+        ''',
+        )
+
+    bld.SAMBA_LIBRARY('cli_smb_common',
        source='''
                smb_signing.c smb_seal.c
                smb2_create_blob.c smb2_signing.c
-               util.c read_smb.c
+               util.c
                smbXcli_base.c
                smb1cli_trans.c
                smb2cli_session.c
@@ -19,14 +32,14 @@ bld.SAMBA_LIBRARY('cli_smb_common',
                smb2cli_query_directory.c
                smb2cli_ioctl.c
        ''',
-       deps='LIBCRYPTO errors gensec krb5samba LIBASYNC_REQ',
+       deps='LIBCRYPTO errors gensec krb5samba smb_transport',
        public_deps='talloc samba-util',
        private_library=True,
        public_headers='''
                smb_common.h smb2_constants.h smb_constants.h
                smb_signing.h smb_seal.h
                smb2_create_blob.h smb2_signing.h
-               smb_util.h read_smb.h
+               smb_util.h
                smb_unix_ext.h
        ''',
        )
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index 4cec4b5..4440395 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -60,6 +60,7 @@ struct rpc_request {
        uint16_t opnum;
        DATA_BLOB request_data;
        bool ignore_timeout;
+       bool wait_for_sync;
 
        /* use by the ndr level async recv call */
        struct {
@@ -1395,6 +1396,13 @@ static void dcerpc_request_recv_data(struct 
dcecli_connection *c,
        if (req->recv_handler != NULL) {
                dcerpc_req_dequeue(req);
                req->state = RPC_REQUEST_DONE;
+
+               /*
+                * We have to look at shipping further requests before calling
+                * the async function, that one might close the pipe
+                */
+               dcerpc_schedule_io_trigger(c);
+
                req->recv_handler(req, raw_packet, pkt);
                return;
        }
@@ -1451,8 +1459,8 @@ static void dcerpc_request_recv_data(struct 
dcecli_connection *c,
 
 req_done:
        /* we've got the full payload */
+       dcerpc_req_dequeue(req);
        req->state = RPC_REQUEST_DONE;
-       DLIST_REMOVE(c->pending, req);
 
        /*
         * We have to look at shipping further requests before calling
@@ -1478,22 +1486,14 @@ static struct rpc_request 
*dcerpc_request_send(TALLOC_CTX *mem_ctx,
 
        p->conn->transport.recv_data = dcerpc_recv_data;
 
-       req = talloc(mem_ctx, struct rpc_request);
+       req = talloc_zero(mem_ctx, struct rpc_request);
        if (req == NULL) {
                return NULL;
        }
 
        req->p = p;
        req->call_id = next_call_id(p->conn);
-       req->status = NT_STATUS_OK;
        req->state = RPC_REQUEST_QUEUED;
-       req->payload = data_blob(NULL, 0);
-       req->flags = 0;
-       req->fault_code = 0;
-       req->ignore_timeout = false;
-       req->async.callback = NULL;
-       req->async.private_data = NULL;
-       req->recv_handler = NULL;
 
        if (object != NULL) {
                req->object = (struct GUID *)talloc_memdup(req, (const void 
*)object, sizeof(*object));
@@ -1501,8 +1501,6 @@ static struct rpc_request *dcerpc_request_send(TALLOC_CTX 
*mem_ctx,
                        talloc_free(req);
                        return NULL;
                }
-       } else {
-               req->object = NULL;
        }
 
        req->opnum = opnum;
@@ -1538,6 +1536,7 @@ static void dcerpc_ship_next_request(struct 
dcecli_connection *c)
        bool first_packet = true;
        size_t sig_size = 0;
        bool need_async = false;
+       bool can_async = true;
 
        req = c->request_queue;
        if (req == NULL) {
@@ -1551,6 +1550,32 @@ static void dcerpc_ship_next_request(struct 
dcecli_connection *c)
                need_async = true;
        }
 
+       if (c->security_state.auth_info &&
+           c->security_state.generic_state)
+       {
+               struct gensec_security *gensec = 
c->security_state.generic_state;
+
+               switch (c->security_state.auth_info->auth_level) {
+               case DCERPC_AUTH_LEVEL_PRIVACY:
+               case DCERPC_AUTH_LEVEL_INTEGRITY:
+                       can_async = gensec_have_feature(gensec,
+                                               GENSEC_FEATURE_ASYNC_REPLIES);
+                       break;
+               case DCERPC_AUTH_LEVEL_CONNECT:
+               case DCERPC_AUTH_LEVEL_NONE:
+                       can_async = true;
+                       break;
+               default:
+                       can_async = false;
+                       break;
+               }
+       }
+
+       if (need_async && !can_async) {
+               req->wait_for_sync = true;
+               return;
+       }
+
        DLIST_REMOVE(c->request_queue, req);
        DLIST_ADD(c->pending, req);
        req->state = RPC_REQUEST_PENDING;
@@ -1665,6 +1690,10 @@ static void dcerpc_schedule_io_trigger(struct 
dcecli_connection *c)
                return;
        }
 
+       if (c->request_queue->wait_for_sync && c->pending) {
+               return;
+       }
+
        if (c->io_trigger_pending) {
                return;
        }
diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c
index 45a4b98..5e2aa47 100644
--- a/source4/winbind/wb_init_domain.c
+++ b/source4/winbind/wb_init_domain.c
@@ -160,6 +160,13 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX 
*mem_ctx,
 
        state->domain->netlogon_pipe = NULL;
 
+       state->domain->netlogon_queue = tevent_queue_create(state->domain,
+                                                           "netlogon_queue");
+       if (state->domain->netlogon_queue == NULL) goto failed;
+
+       /* We start the queue when the connection is usable */
+       tevent_queue_stop(state->domain->netlogon_queue);
+
        if ((!cli_credentials_is_anonymous(state->domain->libnet_ctx->cred)) &&
            ((lpcfg_server_role(service->task->lp_ctx) == ROLE_DOMAIN_MEMBER) ||
             (lpcfg_server_role(service->task->lp_ctx) == 
ROLE_ACTIVE_DIRECTORY_DC)) &&
@@ -211,6 +218,9 @@ static void init_domain_recv_netlogonpipe(struct 
composite_context *ctx)
        }
        talloc_reparent(state, state->domain->netlogon_pipe, 
state->domain->netlogon_binding);
 
+       /* the netlogon connection is ready */
+       tevent_queue_start(state->domain->netlogon_queue);
+
        state->domain->lsa_binding = init_domain_binding(state, 
&ndr_table_lsarpc);
 
        /* For debugging, it can be a real pain if all the traffic is encrypted 
*/
diff --git a/source4/winbind/wb_irpc.c b/source4/winbind/wb_irpc.c
index 2f2b078..628114e 100644
--- a/source4/winbind/wb_irpc.c
+++ b/source4/winbind/wb_irpc.c
@@ -30,7 +30,7 @@ struct wb_irpc_SamLogon_state {
        struct winbind_SamLogon *req;
 };
 
-static void wb_irpc_SamLogon_callback(struct composite_context *ctx);
+static void wb_irpc_SamLogon_callback(struct tevent_req *subreq);
 
 static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg, 
                                 struct winbind_SamLogon *req)
@@ -38,7 +38,7 @@ static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg,
        struct wbsrv_service *service = talloc_get_type(msg->private_data,
                                        struct wbsrv_service);
        struct wb_irpc_SamLogon_state *s;
-       struct composite_context *ctx;
+       struct tevent_req *subreq;
 
        DEBUG(5, ("wb_irpc_SamLogon called\n"));
 
@@ -48,25 +48,28 @@ static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg,
        s->msg = msg;
        s->req = req;
 
-       ctx = wb_sam_logon_send(msg, service, req);
-       NT_STATUS_HAVE_NO_MEMORY(ctx);
+       subreq = wb_sam_logon_send(s,
+                                  service->task->event_ctx,
+                                  service, req);
+       NT_STATUS_HAVE_NO_MEMORY(subreq);
 
-       ctx->async.fn = wb_irpc_SamLogon_callback;
-       ctx->async.private_data = s;
+       tevent_req_set_callback(subreq, wb_irpc_SamLogon_callback, s);
 
        msg->defer_reply = true;
        return NT_STATUS_OK;
 }
 
-static void wb_irpc_SamLogon_callback(struct composite_context *ctx)
+static void wb_irpc_SamLogon_callback(struct tevent_req *subreq)
 {
-       struct wb_irpc_SamLogon_state *s = 
talloc_get_type(ctx->async.private_data,
-                                          struct wb_irpc_SamLogon_state);
+       struct wb_irpc_SamLogon_state *s =
+               tevent_req_callback_data(subreq,
+               struct wb_irpc_SamLogon_state);
        NTSTATUS status;
 
        DEBUG(5, ("wb_irpc_SamLogon_callback called\n"));
 
-       status = wb_sam_logon_recv(ctx, s, s->req);
+       status = wb_sam_logon_recv(subreq, s, s->req);
+       TALLOC_FREE(subreq);
 
        irpc_send_reply(s->msg, status);
 }
@@ -76,7 +79,7 @@ struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state {
        struct winbind_DsrUpdateReadOnlyServerDnsRecords *req;
 };
 
-static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback(struct 
composite_context *ctx);
+static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback(struct 
tevent_req *subreq);
 
 static NTSTATUS wb_irpc_DsrUpdateReadOnlyServerDnsRecords(struct irpc_message 
*msg,
                                 struct 
winbind_DsrUpdateReadOnlyServerDnsRecords *req)
@@ -84,7 +87,7 @@ static NTSTATUS 
wb_irpc_DsrUpdateReadOnlyServerDnsRecords(struct irpc_message *m
        struct wbsrv_service *service = talloc_get_type(msg->private_data,
                                        struct wbsrv_service);
        struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state *s;
-       struct composite_context *ctx;
+       struct tevent_req *subreq;
 
        DEBUG(5, ("wb_irpc_DsrUpdateReadOnlyServerDnsRecords called\n"));
 
@@ -94,25 +97,30 @@ static NTSTATUS 
wb_irpc_DsrUpdateReadOnlyServerDnsRecords(struct irpc_message *m
        s->msg = msg;
        s->req = req;
 
-       ctx = wb_update_rodc_dns_send(msg, service, req);
-       NT_STATUS_HAVE_NO_MEMORY(ctx);
+       subreq = wb_update_rodc_dns_send(s,
+                                        service->task->event_ctx,
+                                        service, req);
+       NT_STATUS_HAVE_NO_MEMORY(subreq);
 
-       ctx->async.fn = wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback;
-       ctx->async.private_data = s;
+       tevent_req_set_callback(subreq,
+                               
wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback,
+                               s);
 
        msg->defer_reply = true;
        return NT_STATUS_OK;
 }
 
-static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback(struct 
composite_context *ctx)
+static void wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback(struct 
tevent_req *subreq)
 {
-       struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state *s = 
talloc_get_type(ctx->async.private_data,
-                                          struct 
wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state);
+       struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state *s =
+               tevent_req_callback_data(subreq,
+               struct wb_irpc_DsrUpdateReadOnlyServerDnsRecords_state);
        NTSTATUS status;
 
        DEBUG(5, ("wb_irpc_DsrUpdateReadOnlyServerDnsRecords_callback 
called\n"));
 
-       status = wb_update_rodc_dns_recv(ctx, s, s->req);
+       status = wb_update_rodc_dns_recv(subreq, s, s->req);
+       TALLOC_FREE(subreq);
 
        irpc_send_reply(s->msg, status);
 }
diff --git a/source4/winbind/wb_pam_auth.c b/source4/winbind/wb_pam_auth.c
index bcbc628..c84b51f 100644
--- a/source4/winbind/wb_pam_auth.c
+++ b/source4/winbind/wb_pam_auth.c
@@ -54,7 +54,7 @@ struct pam_auth_crap_state {
  * NTLM authentication.
 */
 
-static void pam_auth_crap_recv_logon(struct composite_context *ctx);
+static void pam_auth_crap_recv_logon(struct tevent_req *subreq);
 
 struct composite_context *wb_cmd_pam_auth_crap_send(TALLOC_CTX *mem_ctx,
                                                    struct wbsrv_service 
*service,
@@ -66,10 +66,11 @@ struct composite_context 
*wb_cmd_pam_auth_crap_send(TALLOC_CTX *mem_ctx,
                                                    DATA_BLOB nt_resp,
                                                    DATA_BLOB lm_resp)
 {
-       struct composite_context *result, *ctx;
+       struct composite_context *result;
        struct pam_auth_crap_state *state;
        struct netr_NetworkInfo *ninfo;
        DATA_BLOB tmp_nt_resp, tmp_lm_resp;
+       struct tevent_req *subreq;
 
        result = composite_create(mem_ctx, service->task->event_ctx);
        if (result == NULL) goto failed;
@@ -113,10 +114,11 @@ struct composite_context 
*wb_cmd_pam_auth_crap_send(TALLOC_CTX *mem_ctx,
 
        state->unix_username = NULL;
 
-       ctx = wb_sam_logon_send(mem_ctx, service, state->req);
-       if (ctx == NULL) goto failed;
-
-       composite_continue(result, ctx, pam_auth_crap_recv_logon, state);
+       subreq = wb_sam_logon_send(state,
+                                  service->task->event_ctx,
+                                  service, state->req);
+       if (subreq == NULL) goto failed;
+       tevent_req_set_callback(subreq, pam_auth_crap_recv_logon, state);
        return result;
 
  failed:
@@ -129,16 +131,17 @@ struct composite_context 
*wb_cmd_pam_auth_crap_send(TALLOC_CTX *mem_ctx,
 
     Send of a SamLogon request to authenticate a user.
 */
-static void pam_auth_crap_recv_logon(struct composite_context *ctx)
+static void pam_auth_crap_recv_logon(struct tevent_req *subreq)
 {
        DATA_BLOB tmp_blob;
        enum ndr_err_code ndr_err;
        struct netr_SamBaseInfo *base;
        struct pam_auth_crap_state *state =
-               talloc_get_type(ctx->async.private_data,
+               tevent_req_callback_data(subreq,
                                struct pam_auth_crap_state);
 
-       state->ctx->status = wb_sam_logon_recv(ctx, state, state->req);
+       state->ctx->status = wb_sam_logon_recv(subreq, state, state->req);
+       TALLOC_FREE(subreq);
        if (!composite_is_ok(state->ctx)) return;
 
        ndr_err = ndr_push_struct_blob(
diff --git a/source4/winbind/wb_sam_logon.c b/source4/winbind/wb_sam_logon.c
index 028871a..32fddd2 100644
--- a/source4/winbind/wb_sam_logon.c
+++ b/source4/winbind/wb_sam_logon.c
@@ -22,6 +22,8 @@
 */
 
 #include "includes.h"
+#include <tevent.h>
+#include "../lib/util/tevent_ntstatus.h"
 #include "libcli/composite/composite.h"
 #include "winbind/wb_server.h"
 #include "smbd/service_task.h"
@@ -31,10 +33,12 @@
 #include "librpc/gen_ndr/winbind.h"
 
 struct wb_sam_logon_state {
-       struct composite_context *ctx;
+       struct tevent_context *ev;
 
        struct winbind_SamLogon *req;
 
+       struct wbsrv_domain *domain;
+       struct tevent_queue_entry *queue_entry;
         struct netlogon_creds_CredentialState *creds_state;
         struct netr_Authenticator auth1, auth2;
 
@@ -43,82 +47,123 @@ struct wb_sam_logon_state {
 };
 
 static void wb_sam_logon_recv_domain(struct composite_context *ctx);
+static void wb_sam_logon_queue_trigger(struct tevent_req *req, void *priv);
 static void wb_sam_logon_recv_samlogon(struct tevent_req *subreq);
 
 /*
     Find the connection to the DC (or find an existing connection)
 */
-struct composite_context *wb_sam_logon_send(TALLOC_CTX *mem_ctx,
-                                           struct wbsrv_service *service,
-                                           struct winbind_SamLogon *req)
+struct tevent_req *wb_sam_logon_send(TALLOC_CTX *mem_ctx,
+                                    struct tevent_context *ev,
+                                    struct wbsrv_service *service,
+                                    struct winbind_SamLogon *_req)
 {
-       struct composite_context *c, *creq;
-       struct wb_sam_logon_state *s;
-
-       c = composite_create(mem_ctx, service->task->event_ctx);
-       if (!c) return NULL;
-
-       s = talloc_zero(c, struct wb_sam_logon_state);
-       if (composite_nomem(s, c)) return c;
-       s->ctx = c;
-       s->req = req;
+       struct tevent_req *req;
+       struct wb_sam_logon_state *state;
+       struct composite_context *csubreq;
+
+       req = tevent_req_create(mem_ctx, &state,
+                               struct wb_sam_logon_state);
+       if (req == NULL) {
+               return NULL;
+       }
+       state->ev = ev;
+       state->req = _req;
 
-       c->private_data = s;
+       csubreq = wb_sid2domain_send(state, service, service->primary_sid);
+       if (tevent_req_nomem(csubreq, req)) {
+               return tevent_req_post(req, ev);
+       }
+       csubreq->async.fn = wb_sam_logon_recv_domain;
+       csubreq->async.private_data = req;
 
-       creq = wb_sid2domain_send(s, service, service->primary_sid);
-       composite_continue(c, creq, wb_sam_logon_recv_domain, s);
-       return c;
+       return req;
 }
 
 /*
     Having finished making the connection to the DC
     Send of a SamLogon request to authenticate a user.
 */
-static void wb_sam_logon_recv_domain(struct composite_context *creq)
+static void wb_sam_logon_recv_domain(struct composite_context *csubreq)
 {
-       struct wb_sam_logon_state *s = talloc_get_type(creq->async.private_data,
-                                      struct wb_sam_logon_state);
-       struct wbsrv_domain *domain;
-       struct tevent_req *subreq;
+       struct tevent_req *req =
+               talloc_get_type_abort(csubreq->async.private_data,
+               struct tevent_req);
+       struct wb_sam_logon_state *state =
+               tevent_req_data(req,
+               struct wb_sam_logon_state);
+       NTSTATUS status;
+       struct tevent_queue_entry *e;
+
+       status = wb_sid2domain_recv(csubreq, &state->domain);
+       if (tevent_req_nterror(req, status)) {
+               return;
+       }
 
-       s->ctx->status = wb_sid2domain_recv(creq, &domain);
-       if (!composite_is_ok(s->ctx)) return;
+       /*
+        * Because of the netlogon_creds behavior we have to
+        * queue the netr_LogonSamLogon() calls
+        */
+       e = tevent_queue_add_entry(state->domain->netlogon_queue,
+                                  state->ev,
+                                  req,
+                                  wb_sam_logon_queue_trigger,
+                                  NULL);
+       state->queue_entry = e;
+}
 
-       s->creds_state = 
cli_credentials_get_netlogon_creds(domain->libnet_ctx->cred);


-- 
Samba Shared Repository

Reply via email to