The Samba-Bugzilla – Attachment 7222 Details for
Bug 8678
Segfault if we try to enumerate users and the last user can't be mapped to an uid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch3
s3-winbind-fix-getpwent-segfault.patch (text/plain), 3.32 KB, created by
Andreas Schneider
on 2012-01-03 16:44:44 UTC
(
hide
)
Description:
patch3
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2012-01-03 16:44:44 UTC
Size:
3.32 KB
patch
obsolete
>From 32bd69b828cdc526ad6b06b230dc44186ce87c2f Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 3 Jan 2012 16:54:39 +0100 >Subject: [PATCH 1/2] s3-winbind: Move finding the domain to it's own > function. > >This the first part to fix bug #8678. >--- > source3/winbindd/wb_next_pwent.c | 32 +++++++++++++++++++++----------- > 1 files changed, 21 insertions(+), 11 deletions(-) > >diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c >index d47b2fc..9988309 100644 >--- a/source3/winbindd/wb_next_pwent.c >+++ b/source3/winbindd/wb_next_pwent.c >@@ -31,6 +31,26 @@ struct wb_next_pwent_state { > static void wb_next_pwent_fetch_done(struct tevent_req *subreq); > static void wb_next_pwent_fill_done(struct tevent_req *subreq); > >+static struct winbindd_domain *wb_next_find_domain(struct winbindd_domain *domain) >+{ >+ if (domain == NULL) { >+ domain = domain_list(); >+ } else { >+ domain = domain->next; >+ } >+ >+ if ((domain != NULL) >+ && sid_check_is_domain(&domain->sid)) { >+ domain = domain->next; >+ } >+ >+ if (domain == NULL) { >+ return NULL; >+ } >+ >+ return domain; >+} >+ > struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct getpwent_state *gstate, >@@ -50,17 +70,7 @@ struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx, > if (state->gstate->next_user >= state->gstate->num_users) { > TALLOC_FREE(state->gstate->users); > >- if (state->gstate->domain == NULL) { >- state->gstate->domain = domain_list(); >- } else { >- state->gstate->domain = state->gstate->domain->next; >- } >- >- if ((state->gstate->domain != NULL) >- && sid_check_is_domain(&state->gstate->domain->sid)) { >- state->gstate->domain = state->gstate->domain->next; >- } >- >+ state->gstate->domain = wb_next_find_domain(state->gstate->domain); > if (state->gstate->domain == NULL) { > tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); > return tevent_req_post(req, ev); >-- >1.7.8 > > >From 777eba5e471752eef362269f1dc8fd4974710827 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 3 Jan 2012 16:55:25 +0100 >Subject: [PATCH 2/2] s3-winbind: Fix segfault if we can't map the last user. > >This fixes bug #8678. > >The issue is caused by bug #8608. >--- > source3/winbindd/wb_next_pwent.c | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > >diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c >index 9988309..8104568 100644 >--- a/source3/winbindd/wb_next_pwent.c >+++ b/source3/winbindd/wb_next_pwent.c >@@ -165,6 +165,24 @@ static void wb_next_pwent_fill_done(struct tevent_req *subreq) > if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { > state->gstate->next_user += 1; > >+ if (state->gstate->next_user >= state->gstate->num_users) { >+ TALLOC_FREE(state->gstate->users); >+ >+ state->gstate->domain = wb_next_find_domain(state->gstate->domain); >+ if (state->gstate->domain == NULL) { >+ tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES); >+ return; >+ } >+ >+ subreq = wb_query_user_list_send(state, state->ev, >+ state->gstate->domain); >+ if (tevent_req_nomem(subreq, req)) { >+ return; >+ } >+ tevent_req_set_callback(subreq, wb_next_pwent_fetch_done, req); >+ return; >+ } >+ > subreq = wb_fill_pwent_send(state, > state->ev, > &state->gstate->users[state->gstate->next_user], >-- >1.7.8 >
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:
vl
:
review+
Actions:
View
Attachments on
bug 8678
:
7215
|
7221
| 7222