summaryrefslogtreecommitdiff
path: root/source4/winbind
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-24 13:40:13 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-25 01:39:42 +0200
commit646012954c4704375912ba2c049266f122c76f97 (patch)
tree827681024d5eb349f3eb998209a20f28741ecffd /source4/winbind
parent19daec6a95fd89b34f126118fcd3d3c4e7db72e6 (diff)
downloadsamba-646012954c4704375912ba2c049266f122c76f97.tar.gz
s4:winbind: let wb_sam_logon_send/recv() use the netlogon_queue (bug #9097)
metze
Diffstat (limited to 'source4/winbind')
-rw-r--r--source4/winbind/wb_sam_logon.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/source4/winbind/wb_sam_logon.c b/source4/winbind/wb_sam_logon.c
index 39c2254ff8e..32fddd2e0a6 100644
--- a/source4/winbind/wb_sam_logon.c
+++ b/source4/winbind/wb_sam_logon.c
@@ -37,6 +37,8 @@ struct wb_sam_logon_state {
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;
@@ -45,6 +47,7 @@ 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);
/*
@@ -89,15 +92,34 @@ static void wb_sam_logon_recv_domain(struct composite_context *csubreq)
struct wb_sam_logon_state *state =
tevent_req_data(req,
struct wb_sam_logon_state);
- struct wbsrv_domain *domain;
- struct tevent_req *subreq;
NTSTATUS status;
+ struct tevent_queue_entry *e;
- status = wb_sid2domain_recv(csubreq, &domain);
+ status = wb_sid2domain_recv(csubreq, &state->domain);
if (tevent_req_nterror(req, status)) {
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;
+}
+
+static void wb_sam_logon_queue_trigger(struct tevent_req *req, void *priv)
+{
+ struct wb_sam_logon_state *state =
+ tevent_req_data(req,
+ struct wb_sam_logon_state);
+ struct wbsrv_domain *domain = state->domain;
+ struct tevent_req *subreq;
+
state->creds_state = cli_credentials_get_netlogon_creds(domain->libnet_ctx->cred);
netlogon_creds_client_authenticator(state->creds_state, &state->auth1);
@@ -190,6 +212,11 @@ static void wb_sam_logon_recv_samlogon(struct tevent_req *subreq)
state->r.in.validation_level,
state->r.out.validation);
+ /*
+ * we do not need the netlogon_creds lock anymore
+ */
+ TALLOC_FREE(state->queue_entry);
+
tevent_req_done(req);
}