The Samba-Bugzilla – Attachment 6607 Details for
Bug 8253
winbindd panics if verify_idpool() fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patchset for v3-6-test
v3-6-test.patch (text/plain), 6.52 KB, created by
Gregor Beck (550 Unknown user)
on 2011-06-22 13:34:06 UTC
(
hide
)
Description:
patchset for v3-6-test
Filename:
MIME Type:
Creator:
Gregor Beck (550 Unknown user)
Created:
2011-06-22 13:34:06 UTC
Size:
6.52 KB
patch
obsolete
>From fbce301aba1c842727a5be89343613c953be7ae0 Mon Sep 17 00:00:00 2001 >From: Gregor Beck <gbeck@sernet.de> >Date: Tue, 21 Jun 2011 07:51:41 +0200 >Subject: [PATCH 1/5] s3:smbldap: use smbldap_state as memory context for idle > event > >ensure the event is canceled if the smbldap_state gets freed >this fixes a panic of winbindd if verify_idpool fails >--- > source3/lib/smbldap.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c >index 0c5ea98..781857f 100644 >--- a/source3/lib/smbldap.c >+++ b/source3/lib/smbldap.c >@@ -1306,7 +1306,7 @@ static int smbldap_open(struct smbldap_state *ldap_state) > > if (ldap_state->event_context != NULL) { > ldap_state->idle_event = event_add_timed( >- ldap_state->event_context, NULL, >+ ldap_state->event_context, ldap_state, > timeval_current_ofs(SMBLDAP_IDLE_TIME, 0), > smbldap_idle_fn, ldap_state); > } >@@ -1819,7 +1819,7 @@ static void smbldap_idle_fn(struct event_context *event_ctx, > > /* this needs to be made monotonic clock aware inside tevent: */ > state->idle_event = event_add_timed( >- event_ctx, NULL, >+ event_ctx, state, > timeval_add(&now_abs, SMBLDAP_IDLE_TIME, 0), > smbldap_idle_fn, > private_data); >-- >1.7.5.4 > > >From 1767eee5b5e56f5163cd9f4c50bda72fae688ac5 Mon Sep 17 00:00:00 2001 >From: Gregor Beck <gbeck@sernet.de> >Date: Tue, 21 Jun 2011 08:00:59 +0200 >Subject: [PATCH 2/5] s3:smbldap: free the idle event scheduled in > smbldap_open in smbldap_close > >--- > source3/lib/smbldap.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > >diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c >index 781857f..7cd1484 100644 >--- a/source3/lib/smbldap.c >+++ b/source3/lib/smbldap.c >@@ -1331,6 +1331,8 @@ static NTSTATUS smbldap_close(struct smbldap_state *ldap_state) > > smbldap_delete_state(ldap_state); > >+ TALLOC_FREE(ldap_state->idle_event); >+ > DEBUG(5,("The connection to the LDAP server was closed\n")); > /* maybe free the results here --metze */ > >@@ -1845,7 +1847,6 @@ void smbldap_free_struct(struct smbldap_state **ldap_state) > SAFE_FREE((*ldap_state)->bind_dn); > SAFE_FREE((*ldap_state)->bind_secret); > >- TALLOC_FREE((*ldap_state)->idle_event); > > *ldap_state = NULL; > >-- >1.7.5.4 > > >From d1f11bb4f4823c674cd30184c4a6aedcadc5f49f Mon Sep 17 00:00:00 2001 >From: Gregor Beck <gbeck@sernet.de> >Date: Tue, 21 Jun 2011 08:02:53 +0200 >Subject: [PATCH 3/5] s3:smbldap: let smbldap_free_struct do what it claims to > >--- > source3/lib/smbldap.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > >diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c >index 7cd1484..31a16b6 100644 >--- a/source3/lib/smbldap.c >+++ b/source3/lib/smbldap.c >@@ -1847,8 +1847,7 @@ void smbldap_free_struct(struct smbldap_state **ldap_state) > SAFE_FREE((*ldap_state)->bind_dn); > SAFE_FREE((*ldap_state)->bind_secret); > >- >- *ldap_state = NULL; >+ TALLOC_FREE(*ldap_state); > > /* No need to free any further, as it is talloc()ed */ > } >-- >1.7.5.4 > > >From f2af25cebb5dbc0adc7cba2fcbc62b1319fdd35f Mon Sep 17 00:00:00 2001 >From: Gregor Beck <gbeck@sernet.de> >Date: Tue, 21 Jun 2011 08:06:28 +0200 >Subject: [PATCH 4/5] s3:smbldap: add a destructor to smbldap_state, just in > case > >--- > source3/lib/smbldap.c | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > >diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c >index 31a16b6..76bf7e0 100644 >--- a/source3/lib/smbldap.c >+++ b/source3/lib/smbldap.c >@@ -1852,6 +1852,12 @@ void smbldap_free_struct(struct smbldap_state **ldap_state) > /* No need to free any further, as it is talloc()ed */ > } > >+static int smbldap_state_destructor(struct smbldap_state *state) >+{ >+ smbldap_free_struct(&state); >+ return 0; >+} >+ > > /********************************************************************** > Intitalise the 'general' ldap structures, on which ldap operations may be conducted >@@ -1875,6 +1881,7 @@ NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, > > (*smbldap_state)->event_context = event_ctx; > >+ talloc_set_destructor(*smbldap_state, smbldap_state_destructor); > return NT_STATUS_OK; > } > >-- >1.7.5.4 > > >From b10e4810ff987f843d409d345a09fd5023025d6c Mon Sep 17 00:00:00 2001 >From: Gregor Beck <gbeck@sernet.de> >Date: Tue, 21 Jun 2011 08:16:56 +0200 >Subject: [PATCH 5/5] s3:smbldap: make smbldap_connect_system self contained > >--- > source3/lib/smbldap.c | 17 +++++++++++------ > 1 files changed, 11 insertions(+), 6 deletions(-) > >diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c >index 76bf7e0..1d507fb 100644 >--- a/source3/lib/smbldap.c >+++ b/source3/lib/smbldap.c >@@ -1165,8 +1165,9 @@ static int rebindproc_connect (LDAP * ld, LDAP_CONST char *url, int request, > /******************************************************************* > connect to the ldap server under system privilege. > ******************************************************************/ >-static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_struct) >+static int smbldap_connect_system(struct smbldap_state *ldap_state) > { >+ LDAP *ldap_struct = ldap_state->ldap_struct; > int rc; > int version; > >@@ -1177,7 +1178,8 @@ static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_ > /* get the default dn and password only if they are not set already */ > if (!fetch_ldap_pw(&bind_dn, &bind_secret)) { > DEBUG(0, ("ldap_connect_system: Failed to retrieve password from secrets.tdb\n")); >- return LDAP_INVALID_CREDENTIALS; >+ rc = LDAP_INVALID_CREDENTIALS; >+ goto done; > } > smbldap_set_creds(ldap_state, false, bind_dn, bind_secret); > SAFE_FREE(bind_dn); >@@ -1223,7 +1225,7 @@ static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_ > ld_error ? ld_error : "(unknown)")); > SAFE_FREE(ld_error); > ldap_state->num_failures++; >- return rc; >+ goto done; > } > > ldap_state->num_failures = 0; >@@ -1238,6 +1240,11 @@ static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_ > DEBUG(3, ("ldap_connect_system: successful connection to the LDAP server\n")); > DEBUGADD(10, ("ldap_connect_system: LDAP server %s support paged results\n", > ldap_state->paged_results ? "does" : "does not")); >+done: >+ if (rc != 0) { >+ ldap_unbind(ldap_struct); >+ ldap_state->ldap_struct = NULL; >+ } > return rc; > } > >@@ -1292,9 +1299,7 @@ static int smbldap_open(struct smbldap_state *ldap_state) > return rc; > } > >- if ((rc = smbldap_connect_system(ldap_state, ldap_state->ldap_struct))) { >- ldap_unbind(ldap_state->ldap_struct); >- ldap_state->ldap_struct = NULL; >+ if ((rc = smbldap_connect_system(ldap_state))) { > return rc; > } > >-- >1.7.5.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
obnox
:
review+
metze
:
review+
Actions:
View
Attachments on
bug 8253
: 6607 |
6608