tevent_abort_nesting crash in idmap_ad
Jeremy Allison
jra at samba.org
Mon Jun 27 17:48:49 UTC 2016
On Mon, Jun 27, 2016 at 10:50:56AM +0200, Ralph Boehme wrote:
> On Mon, Jun 27, 2016 at 09:00:59AM +0200, Stefan Metzmacher wrote:
> > Am 24.06.2016 um 20:45 schrieb Jeremy Allison:
> > > Ralph, can you see if this fixes the problem
> > > in your test case ?
> >
> > I'd prefer this change + making tldap_gensec_bind_send/recv static.
>
> ack.
OK, here's the code change. Can I get a +1 please ?
Cheers,
Jeremy.
-------------- next part --------------
From 6cc40a9633552b7dd2f3372558b1373f64071b1b Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 24 Jun 2016 11:40:10 -0700
Subject: [PATCH 1/2] s3: tldap: Remove asynchronous calls to
gensec_update_send()/_recv() as for the spnego backend they're synchronous
anyway.
This should prevent nested event loops, and won't make the
code performance worse anyway.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/lib/tldap_gensec_bind.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/source3/lib/tldap_gensec_bind.c b/source3/lib/tldap_gensec_bind.c
index 07f7956..9f6e8ae 100644
--- a/source3/lib/tldap_gensec_bind.c
+++ b/source3/lib/tldap_gensec_bind.c
@@ -45,7 +45,8 @@ struct tldap_gensec_bind_state {
};
static void tldap_gensec_bind_got_mechs(struct tevent_req *subreq);
-static void tldap_gensec_update_done(struct tevent_req *subreq);
+static void tldap_gensec_update_done(struct tldap_gensec_bind_state *state,
+ struct tevent_req *subreq);
static void tldap_gensec_bind_done(struct tevent_req *subreq);
struct tevent_req *tldap_gensec_bind_send(
@@ -215,25 +216,16 @@ static void tldap_gensec_bind_got_mechs(struct tevent_req *subreq)
return;
}
- subreq = gensec_update_send(state, state->ev, state->gensec,
- data_blob_null);
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
- tevent_req_set_callback(subreq, tldap_gensec_update_done, req);
+ state->gensec_status = gensec_update(state->gensec, state,
+ data_blob_null,
+ &state->gensec_output);
+ tldap_gensec_update_done(state, req);
}
-static void tldap_gensec_update_done(struct tevent_req *subreq)
+static void tldap_gensec_update_done(struct tldap_gensec_bind_state *state,
+ struct tevent_req *req)
{
- struct tevent_req *req = tevent_req_callback_data(
- subreq, struct tevent_req);
- struct tldap_gensec_bind_state *state = tevent_req_data(
- req, struct tldap_gensec_bind_state);
-
- state->gensec_status = gensec_update_recv(
- subreq, state, &state->gensec_output);
-
- TALLOC_FREE(subreq);
+ struct tevent_req *subreq;
if (!NT_STATUS_IS_OK(state->gensec_status) &&
!NT_STATUS_EQUAL(state->gensec_status,
@@ -289,11 +281,10 @@ static void tldap_gensec_bind_done(struct tevent_req *subreq)
return;
}
- subreq = gensec_update_send(state, state->ev, state->gensec, input);
- if (tevent_req_nomem(subreq, req)) {
- return;
- }
- tevent_req_set_callback(subreq, tldap_gensec_update_done, req);
+ state->gensec_status = gensec_update(state->gensec, state,
+ input,
+ &state->gensec_output);
+ tldap_gensec_update_done(state, req);
}
TLDAPRC tldap_gensec_bind_recv(struct tevent_req *req)
--
2.8.0.rc3.226.g39d4020
From 03c3571d5f275eb85c14bebead8a5916bfabe75c Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Mon, 27 Jun 2016 10:39:02 -0700
Subject: [PATCH 2/2] s3: tldap: Make
tldap_gensec_bind_send()/tldap_gensec_bind_recv() static.
Only expose a synchronous tldap_gensec_bind() call, as it can't
really be async anyway.
Signed-off-by: Jeremy Allison <jra at samba.org>
---
source3/lib/tldap_gensec_bind.c | 4 ++--
source3/lib/tldap_gensec_bind.h | 7 -------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/source3/lib/tldap_gensec_bind.c b/source3/lib/tldap_gensec_bind.c
index 9f6e8ae..c409213 100644
--- a/source3/lib/tldap_gensec_bind.c
+++ b/source3/lib/tldap_gensec_bind.c
@@ -49,7 +49,7 @@ static void tldap_gensec_update_done(struct tldap_gensec_bind_state *state,
struct tevent_req *subreq);
static void tldap_gensec_bind_done(struct tevent_req *subreq);
-struct tevent_req *tldap_gensec_bind_send(
+static struct tevent_req *tldap_gensec_bind_send(
TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct tldap_context *ctx, struct cli_credentials *creds,
const char *target_service, const char *target_hostname,
@@ -287,7 +287,7 @@ static void tldap_gensec_bind_done(struct tevent_req *subreq)
tldap_gensec_update_done(state, req);
}
-TLDAPRC tldap_gensec_bind_recv(struct tevent_req *req)
+static TLDAPRC tldap_gensec_bind_recv(struct tevent_req *req)
{
struct tldap_gensec_bind_state *state = tevent_req_data(
req, struct tldap_gensec_bind_state);
diff --git a/source3/lib/tldap_gensec_bind.h b/source3/lib/tldap_gensec_bind.h
index deddc23..cb6b8e6 100644
--- a/source3/lib/tldap_gensec_bind.h
+++ b/source3/lib/tldap_gensec_bind.h
@@ -24,13 +24,6 @@
#include "tldap.h"
#include "auth/credentials/credentials.h"
-struct tevent_req *tldap_gensec_bind_send(
- TALLOC_CTX *mem_ctx, struct tevent_context *ev,
- struct tldap_context *ctx, struct cli_credentials *creds,
- const char *target_service, const char *target_hostname,
- const char *target_principal, struct loadparm_context *lp_ctx,
- uint32_t gensec_features);
-TLDAPRC tldap_gensec_bind_recv(struct tevent_req *req);
TLDAPRC tldap_gensec_bind(
struct tldap_context *ctx, struct cli_credentials *creds,
const char *target_service, const char *target_hostname,
--
2.8.0.rc3.226.g39d4020
More information about the samba-technical
mailing list