s4:winbind: add a netlogon_queue (tevent_queue)
authorStefan Metzmacher <metze@samba.org>
Fri, 24 Aug 2012 11:39:14 +0000 (13:39 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 24 Aug 2012 23:39:41 +0000 (01:39 +0200)
This will protect the netlogon_creds later.

metze

source4/winbind/wb_init_domain.c
source4/winbind/wb_server.h

index 45a4b98f31166e83b3919bf41c723059f21c1011..5e2aa4700546c1d5121f239b78aa7d9ebea9b9ce 100644 (file)
@@ -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 */
index 12dd1888ed1ffdf9bb14d0793a2d04d4d3ec2209..9b03004b28558953fbbd1c55edb72a5995632d5f 100644 (file)
@@ -68,6 +68,8 @@ struct wbsrv_domain {
 
        struct dcerpc_pipe *netlogon_pipe;
        struct dcerpc_binding *netlogon_binding;
+       /* netlogon_creds usage needs to be queued */
+       struct tevent_queue *netlogon_queue;
 };
 
 /*