[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Mon Mar 16 16:04:04 MDT 2015


The branch, master has been updated
       via  71a97c9 doc: fix the idmap_script manpage to be named idmap_script
       via  b2f5916 s3:winbind:grent: don't stop when querying one domain fails.
       via  6f13e79 s3:winbind:grent: convert wb_next_grent to use wb_query_group_list.
       via  81955eb s3:winbind: add wb_query_group_list module - async query group list
       via  9438bcc s3:winbind:grent: refactor duplication into wb_next_grent_send_do()
       via  09cc5cf s3:winbind:grent: move resetting next_group up.
       via  36fce5c s3:winbind:grent: use wb_next_domain() in wb_next_grent.c
       via  a221d88 s3:winbind:grent: fix a debug message.
       via  1ed41a5 s3:winbind:pwent: refactor duplication into wb_next_pwent_send_do()
       via  504b65c s3:winbind:pwent: move resetting next_user up.
       via  b3023c7 s3:winbind:pwent: move wb_next_domain() to winbindd_util.c for re-use
       via  d0dc648 s3:winbind:pwent: rename wb_next_find_domain to wb_next_domain
       via  e899680 s3:winbind:pwent: use wb_next_find_domain()
       via  9d1840b s3:winbind:util: fix comment typo
       via  bd4b22e s3:util_sid: donate an empty line.
       via  2401522 s3:winbind:grent: don't stop group enumeration when a group has no gid
      from  3d1e4a9 dsdb: fix the user_account_control test.

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


- Log -----------------------------------------------------------------
commit 71a97c9f8743086a28c310c468596d295ff019b3
Author: Michael Adam <obnox at samba.org>
Date:   Tue Feb 3 14:41:27 2015 +0100

    doc: fix the idmap_script manpage to be named idmap_script
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Mon Mar 16 23:03:34 CET 2015 on sn-devel-104

commit b2f5916d46d020d06230e4605fa149a5507166ac
Author: Michael Adam <obnox at samba.org>
Date:   Sun Jan 25 12:16:50 2015 +0100

    s3:winbind:grent: don't stop when querying one domain fails.
    
    Just continue with the next domain.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 6f13e7935059090b3c22d0d52dc4048d30359410
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 23 14:23:16 2015 +0100

    s3:winbind:grent: convert wb_next_grent to use wb_query_group_list.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 81955ebd407cd68af1d5e2ebefcc98ed2804409d
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jan 23 14:06:40 2015 +0100

    s3:winbind: add wb_query_group_list module - async query group list
    
    Modeled after wb_query_user_list.c
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 9438bcc04c3b5d9d6321344d8365e0d9d2cc4417
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 21 12:32:04 2015 +0100

    s3:winbind:grent: refactor duplication into wb_next_grent_send_do()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 09cc5cf355604c41150b4a884d894bd4129b842f
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 20 12:25:29 2015 +0100

    s3:winbind:grent: move resetting next_group up.
    
    This is to make it more obvious that this is a case
    of code duplication.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 36fce5c413852e2639a9ce91b25fce2de8492fa8
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 20 10:25:37 2015 +0100

    s3:winbind:grent: use wb_next_domain() in wb_next_grent.c
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit a221d88c393dcf8d78307795b37f95b720c78a65
Author: Michael Adam <obnox at samba.org>
Date:   Sun Jan 25 12:20:35 2015 +0100

    s3:winbind:grent: fix a debug message.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 1ed41a5c39069d9e95a5e82f1d0f9433bf7999f5
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 13:51:39 2015 +0100

    s3:winbind:pwent: refactor duplication into wb_next_pwent_send_do()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 504b65c49c5554dcf8b7da708dc5b9087b2f6b89
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 20 11:06:51 2015 +0100

    s3:winbind:pwent: move resetting next_user up.
    
    This does not change the behaviour and makes it more evident
    that we have anothe code duplication here:
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    if (state->gstate->num_users == 0) {
    	...
    }
    
    subreq = wb_fill_pwent_send(...)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    is for the current setting of variables equivalent
    to the block found elsewhere:
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    if (state->gstate->next_user >= state->gstate->num_users) {
    	...
    }
    
    subreq = wb_fill_pwent_send(...)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    because both num_users is set to a non-negative
    value and num_users starts at 0 and is incremented up to
    num_users.
    
    The code duplication will be factored out next.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit b3023c7e839f1462919a6d42b52650d7c4b9bc3b
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 20 10:07:59 2015 +0100

    s3:winbind:pwent: move wb_next_domain() to winbindd_util.c for re-use
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit d0dc6481a858ff1ca753fb8d315b543450b2bd1e
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 20 09:41:31 2015 +0100

    s3:winbind:pwent: rename wb_next_find_domain to wb_next_domain
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit e8996807b1dec6ca6d731f2319dda4f7e8f848fb
Author: Michael Adam <obnox at samba.org>
Date:   Sat Jan 17 23:34:37 2015 +0100

    s3:winbind:pwent: use wb_next_find_domain()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 9d1840b9bba6844f3654b3cde69d81e2ba545cb8
Author: Michael Adam <obnox at samba.org>
Date:   Tue Jan 20 08:39:58 2015 +0100

    s3:winbind:util: fix comment typo
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit bd4b22effe13ba58d5feb33ce4fd3db72c43dc75
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 08:14:44 2015 +0100

    s3:util_sid: donate an empty line.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

commit 24015224da1f363019d9d2da81ce533463a16abb
Author: Michael Adam <obnox at samba.org>
Date:   Mon Jan 19 13:51:55 2015 +0100

    s3:winbind:grent: don't stop group enumeration when a group has no gid
    
    simply continue with the next group
    
    Note: this patch introduces some code duplication to make it
    easier to create minimal backport patch. Subsequent patches
    will provide some refactoring to reduce the duplication.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=8905
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Guenther Deschner <gd at samba.org>

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

Summary of changes:
 docs-xml/manpages/idmap_script.8.xml               |   2 +-
 source3/lib/util_sid_passdb.c                      |   1 +
 source3/winbindd/wb_next_grent.c                   | 140 ++++++++-------------
 source3/winbindd/wb_next_pwent.c                   | 122 +++++-------------
 ...nbindd_allocate_uid.c => wb_query_group_list.c} |  61 ++++-----
 source3/winbindd/winbindd_proto.h                  |   9 ++
 source3/winbindd/winbindd_util.c                   |  21 +++-
 source3/wscript_build                              |   1 +
 8 files changed, 153 insertions(+), 204 deletions(-)
 copy source3/winbindd/{winbindd_allocate_uid.c => wb_query_group_list.c} (52%)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/idmap_script.8.xml b/docs-xml/manpages/idmap_script.8.xml
index e2bf665..2204079 100644
--- a/docs-xml/manpages/idmap_script.8.xml
+++ b/docs-xml/manpages/idmap_script.8.xml
@@ -12,7 +12,7 @@
 
 
 <refnamediv>
-	<refname>idmap_tdb2</refname>
+	<refname>idmap_script</refname>
 	<refpurpose>Samba's idmap_script Backend for Winbind</refpurpose>
 </refnamediv>
 
diff --git a/source3/lib/util_sid_passdb.c b/source3/lib/util_sid_passdb.c
index b56837e..0ff64cc 100644
--- a/source3/lib/util_sid_passdb.c
+++ b/source3/lib/util_sid_passdb.c
@@ -62,6 +62,7 @@ bool sid_check_object_is_for_passdb(const struct dom_sid *sid)
 
 	return false;
 }
+
 /**
  * check whether this is an object- or domain-sid that should
  * be treated by the passdb, e.g. for id-mapping.
diff --git a/source3/winbindd/wb_next_grent.c b/source3/winbindd/wb_next_grent.c
index aea134b..fd925b6 100644
--- a/source3/winbindd/wb_next_grent.c
+++ b/source3/winbindd/wb_next_grent.c
@@ -26,7 +26,6 @@ struct wb_next_grent_state {
 	struct tevent_context *ev;
 	int max_nesting;
 	struct getgrent_state *gstate;
-	struct wbint_Principals next_groups;
 	struct winbindd_gr *gr;
 	struct talloc_dict *members;
 };
@@ -34,50 +33,27 @@ struct wb_next_grent_state {
 static void wb_next_grent_fetch_done(struct tevent_req *subreq);
 static void wb_next_grent_getgrsid_done(struct tevent_req *subreq);
 
-struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
-				      struct tevent_context *ev,
-				      int max_nesting,
-				      struct getgrent_state *gstate,
-				      struct winbindd_gr *gr)
+static void wb_next_grent_send_do(struct tevent_req *req,
+				  struct wb_next_grent_state *state)
 {
-	struct tevent_req *req, *subreq;
-	struct wb_next_grent_state *state;
-
-	req = tevent_req_create(mem_ctx, &state, struct wb_next_grent_state);
-	if (req == NULL) {
-		return NULL;
-	}
-	state->ev = ev;
-	state->gstate = gstate;
-	state->gr = gr;
-	state->max_nesting = max_nesting;
+	struct tevent_req *subreq;
 
 	if (state->gstate->next_group >= state->gstate->num_groups) {
 		TALLOC_FREE(state->gstate->groups);
 
-		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_our_sam(&state->gstate->domain->sid)) {
-			state->gstate->domain = state->gstate->domain->next;
-		}
-
+		state->gstate->domain = wb_next_domain(state->gstate->domain);
 		if (state->gstate->domain == NULL) {
 			tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES);
-			return tevent_req_post(req, ev);
+			return;
 		}
-		subreq = dcerpc_wbint_QueryGroupList_send(
-			state, state->ev, dom_child_handle(state->gstate->domain),
-			&state->next_groups);
+
+		subreq = wb_query_group_list_send(state, state->ev,
+						  state->gstate->domain);
 		if (tevent_req_nomem(subreq, req)) {
-			return tevent_req_post(req, ev);
+			return;
 		}
 		tevent_req_set_callback(subreq, wb_next_grent_fetch_done, req);
-		return req;
+		return;
 	}
 
 	subreq = wb_getgrsid_send(
@@ -85,9 +61,34 @@ struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
 		&state->gstate->groups[state->gstate->next_group].sid,
 		state->max_nesting);
 	if (tevent_req_nomem(subreq, req)) {
-		return tevent_req_post(req, ev);
+		return;
 	}
 	tevent_req_set_callback(subreq, wb_next_grent_getgrsid_done, req);
+}
+
+struct tevent_req *wb_next_grent_send(TALLOC_CTX *mem_ctx,
+				      struct tevent_context *ev,
+				      int max_nesting,
+				      struct getgrent_state *gstate,
+				      struct winbindd_gr *gr)
+{
+	struct tevent_req *req;
+	struct wb_next_grent_state *state;
+
+	req = tevent_req_create(mem_ctx, &state, struct wb_next_grent_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->ev = ev;
+	state->gstate = gstate;
+	state->gr = gr;
+	state->max_nesting = max_nesting;
+
+	wb_next_grent_send_do(req, state);
+	if (!tevent_req_is_in_progress(req)) {
+		return tevent_req_post(req, ev);
+	}
+
 	return req;
 }
 
@@ -97,63 +98,22 @@ static void wb_next_grent_fetch_done(struct tevent_req *subreq)
 		subreq, struct tevent_req);
 	struct wb_next_grent_state *state = tevent_req_data(
 		req, struct wb_next_grent_state);
-	NTSTATUS status, result;
+	NTSTATUS status;
 
-	status = dcerpc_wbint_QueryGroupList_recv(subreq, state, &result);
+	status = wb_query_group_list_recv(subreq, state->gstate,
+					  &state->gstate->num_groups,
+					  &state->gstate->groups);
 	TALLOC_FREE(subreq);
-	if (tevent_req_nterror(req, status)) {
-		/* Ignore errors here, just log it */
-		DEBUG(10, ("query_user_list for domain %s returned %s\n",
-			   state->gstate->domain->name,
-			   nt_errstr(status)));
-		return;
-	}
-	if (!NT_STATUS_IS_OK(result)) {
+	if (!NT_STATUS_IS_OK(status)) {
 		/* Ignore errors here, just log it */
-		DEBUG(10, ("query_user_list for domain %s returned %s/%s\n",
-			   state->gstate->domain->name,
-			   nt_errstr(status), nt_errstr(result)));
-		tevent_req_nterror(req, result);
-		return;
-	}
-
-	state->gstate->num_groups = state->next_groups.num_principals;
-	state->gstate->groups = talloc_move(
-		state->gstate, &state->next_groups.principals);
-
-	if (state->gstate->num_groups == 0) {
-		state->gstate->domain = state->gstate->domain->next;
-
-		if ((state->gstate->domain != NULL)
-		    && sid_check_is_our_sam(&state->gstate->domain->sid)) {
-			state->gstate->domain = state->gstate->domain->next;
-		}
-
-		if (state->gstate->domain == NULL) {
-			tevent_req_nterror(req, NT_STATUS_NO_MORE_ENTRIES);
-			return;
-		}
-		subreq = dcerpc_wbint_QueryGroupList_send(
-			state, state->ev, dom_child_handle(state->gstate->domain),
-			&state->next_groups);
-		if (tevent_req_nomem(subreq, req)) {
-			return;
-		}
-		tevent_req_set_callback(subreq, wb_next_grent_fetch_done, req);
-		return;
+		DEBUG(10, ("query_group_list for domain %s returned %s\n",
+			   state->gstate->domain->name, nt_errstr(status)));
+		state->gstate->num_groups = 0;
 	}
 
 	state->gstate->next_group = 0;
 
-	subreq = wb_getgrsid_send(
-		state, state->ev,
-		&state->gstate->groups[state->gstate->next_group].sid,
-		state->max_nesting);
-	if (tevent_req_nomem(subreq, req)) {
-		return;
-	}
-	tevent_req_set_callback(subreq, wb_next_grent_getgrsid_done, req);
-	return;
+	wb_next_grent_send_do(req, state);
 }
 
 static void wb_next_grent_getgrsid_done(struct tevent_req *subreq)
@@ -168,9 +128,17 @@ static void wb_next_grent_getgrsid_done(struct tevent_req *subreq)
 	status = wb_getgrsid_recv(subreq, talloc_tos(), &domname, &name,
 				  &state->gr->gr_gid, &state->members);
 	TALLOC_FREE(subreq);
-	if (tevent_req_nterror(req, status)) {
+
+	if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+		state->gstate->next_group += 1;
+
+		wb_next_grent_send_do(req, state);
+
+		return;
+	} else if (tevent_req_nterror(req, status)) {
 		return;
 	}
+
 	if (!fill_grent(talloc_tos(), state->gr, domname, name,
 			state->gr->gr_gid)) {
 		DEBUG(5, ("fill_grent failed\n"));
diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c
index ade74e3..af5e8d9 100644
--- a/source3/winbindd/wb_next_pwent.c
+++ b/source3/winbindd/wb_next_pwent.c
@@ -31,19 +31,38 @@ 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)
+static void wb_next_pwent_send_do(struct tevent_req *req,
+				  struct wb_next_pwent_state *state)
 {
-	if (domain == NULL) {
-		domain = domain_list();
-	} else {
-		domain = domain->next;
+	struct tevent_req *subreq;
+
+	if (state->gstate->next_user >= state->gstate->num_users) {
+		TALLOC_FREE(state->gstate->users);
+
+		state->gstate->domain = wb_next_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;
 	}
 
-	if ((domain != NULL)
-	    && sid_check_is_our_sam(&domain->sid)) {
-		domain = domain->next;
+	subreq = wb_fill_pwent_send(state, state->ev,
+				&state->gstate->users[state->gstate->next_user],
+				state->pw);
+	if (tevent_req_nomem(subreq, req)) {
+		return;
 	}
-	return domain;
+
+	tevent_req_set_callback(subreq, wb_next_pwent_fill_done, req);
 }
 
 struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
@@ -51,7 +70,7 @@ struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
 				      struct getpwent_state *gstate,
 				      struct winbindd_pw *pw)
 {
-	struct tevent_req *req, *subreq;
+	struct tevent_req *req;
 	struct wb_next_pwent_state *state;
 
 	req = tevent_req_create(mem_ctx, &state, struct wb_next_pwent_state);
@@ -62,31 +81,11 @@ struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx,
 	state->gstate = gstate;
 	state->pw = pw;
 
-	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 tevent_req_post(req, ev);
-		}
-		subreq = wb_query_user_list_send(state, state->ev,
-						 state->gstate->domain);
-		if (tevent_req_nomem(subreq, req)) {
-			return tevent_req_post(req, ev);
-		}
-		tevent_req_set_callback(subreq, wb_next_pwent_fetch_done, req);
-		return req;
-	}
-
-	subreq = wb_fill_pwent_send(
-		state, state->ev,
-		&state->gstate->users[state->gstate->next_user],
-		state->pw);
-	if (tevent_req_nomem(subreq, req)) {
+	wb_next_pwent_send_do(req, state);
+	if (!tevent_req_is_in_progress(req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, wb_next_pwent_fill_done, req);
+
 	return req;
 }
 
@@ -110,37 +109,9 @@ static void wb_next_pwent_fetch_done(struct tevent_req *subreq)
 		state->gstate->num_users = 0;
 	}
 
-	if (state->gstate->num_users == 0) {
-		state->gstate->domain = state->gstate->domain->next;
-
-		if ((state->gstate->domain != NULL)
-		    && sid_check_is_our_sam(&state->gstate->domain->sid)) {
-			state->gstate->domain = state->gstate->domain->next;
-		}
-
-		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;
-	}
-
 	state->gstate->next_user = 0;
 
-	subreq = wb_fill_pwent_send(
-		state, state->ev,
-		&state->gstate->users[state->gstate->next_user],
-		state->pw);
-	if (tevent_req_nomem(subreq, req)) {
-		return;
-	}
-	tevent_req_set_callback(subreq, wb_next_pwent_fill_done, req);
+	wb_next_pwent_send_do(req, state);
 }
 
 static void wb_next_pwent_fill_done(struct tevent_req *subreq)
@@ -160,32 +131,7 @@ 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],
-					    state->pw);
-		if (tevent_req_nomem(subreq, req)) {
-			return;
-		}
-		tevent_req_set_callback(subreq, wb_next_pwent_fill_done, req);
+		wb_next_pwent_send_do(req, state);
 
 		return;
 	} else if (tevent_req_nterror(req, status)) {
diff --git a/source3/winbindd/winbindd_allocate_uid.c b/source3/winbindd/wb_query_group_list.c
similarity index 52%
copy from source3/winbindd/winbindd_allocate_uid.c
copy to source3/winbindd/wb_query_group_list.c
index 99c0bda..703d331 100644
--- a/source3/winbindd/winbindd_allocate_uid.c
+++ b/source3/winbindd/wb_query_group_list.c
@@ -1,7 +1,8 @@
 /*
    Unix SMB/CIFS implementation.
-   async implementation of WINBINDD_ALLOCATE_UID
+   async query_group_list
    Copyright (C) Volker Lendecke 2009
+   Copyright (C) Michael Adam 2015
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -21,68 +22,72 @@
 #include "winbindd.h"
 #include "librpc/gen_ndr/ndr_winbind_c.h"
 
-struct winbindd_allocate_uid_state {
-	uint64_t uid;
+
+struct wb_query_group_list_state {
+	struct wbint_Principals groups;
 };
 
-static void winbindd_allocate_uid_done(struct tevent_req *subreq);
+static void wb_query_group_list_done(struct tevent_req *subreq);
 
-struct tevent_req *winbindd_allocate_uid_send(TALLOC_CTX *mem_ctx,
-					      struct tevent_context *ev,
-					      struct winbindd_cli_state *cli,
-					      struct winbindd_request *request)
+struct tevent_req *wb_query_group_list_send(TALLOC_CTX *mem_ctx,
+					    struct tevent_context *ev,
+					    struct winbindd_domain *domain)
 {
 	struct tevent_req *req, *subreq;
-	struct winbindd_allocate_uid_state *state;
-	struct winbindd_child *child;
+	struct wb_query_group_list_state *state;
 
 	req = tevent_req_create(mem_ctx, &state,
-				struct winbindd_allocate_uid_state);
+				struct wb_query_group_list_state);
 	if (req == NULL) {
 		return NULL;
 	}
 
-	DEBUG(3, ("allocate_uid\n"));
-
-	child = idmap_child();
-
-	subreq = dcerpc_wbint_AllocateUid_send(state, ev, child->binding_handle,
-					       &state->uid);
+	subreq = dcerpc_wbint_QueryGroupList_send(state, ev,
+						  dom_child_handle(domain),
+						  &state->groups);
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
-	tevent_req_set_callback(subreq, winbindd_allocate_uid_done, req);
+
+	tevent_req_set_callback(subreq, wb_query_group_list_done, req);
 	return req;
 }
 
-static void winbindd_allocate_uid_done(struct tevent_req *subreq)
+static void wb_query_group_list_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(
 		subreq, struct tevent_req);
-	struct winbindd_allocate_uid_state *state = tevent_req_data(
-		req, struct winbindd_allocate_uid_state);
+	struct wb_query_group_list_state *state = tevent_req_data(
+		req, struct wb_query_group_list_state);
 	NTSTATUS status, result;
 
-	status = dcerpc_wbint_AllocateUid_recv(subreq, state, &result);
+	status = dcerpc_wbint_QueryGroupList_recv(subreq, state, &result);
 	TALLOC_FREE(subreq);
 	if (any_nt_status_not_ok(status, result, &status)) {
 		tevent_req_nterror(req, status);
 		return;
 	}
+
+	DEBUG(10, ("dcerpc_wbint_QueryGroupList returned %d groups\n",
+		   state->groups.num_principals));
+
 	tevent_req_done(req);
 }
 
-NTSTATUS winbindd_allocate_uid_recv(struct tevent_req *req,
-				    struct winbindd_response *response)
+NTSTATUS wb_query_group_list_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
+				  int *num_groups,
+				  struct wbint_Principal **groups)
 {
-	struct winbindd_allocate_uid_state *state = tevent_req_data(
-		req, struct winbindd_allocate_uid_state);
+	struct wb_query_group_list_state *state = tevent_req_data(
+		req, struct wb_query_group_list_state);
 	NTSTATUS status;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list