[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Wed Jan 4 10:31:02 MST 2012


The branch, master has been updated
       via  b9d208b s3-winbind: Fix segfault if we can't map the last user.
       via  5075e56 s3-winbind: Move finding the domain to it's own function.
      from  bd5fe0a s3-perfcount: fix incorrect array length calculations

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b9d208bdaa9da2a5ae534481865efc881b851b01
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jan 3 16:55:25 2012 +0100

    s3-winbind: Fix segfault if we can't map the last user.
    
    This fixes bug #8678.
    
    The issue is caused by bug #8608.
    
    Autobuild-User: Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date: Wed Jan  4 18:30:53 CET 2012 on sn-devel-104

commit 5075e565684627dfbd23f715da344b4365351ccb
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Jan 3 16:54:39 2012 +0100

    s3-winbind: Move finding the domain to it's own function.
    
    This the first part to fix bug #8678.

-----------------------------------------------------------------------

Summary of changes:
 source3/winbindd/wb_next_pwent.c |   50 +++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c
index d47b2fc..8104568 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);
@@ -155,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],


-- 
Samba Shared Repository


More information about the samba-cvs mailing list