diff options
author | Michael Adam <obnox@samba.org> | 2015-01-20 10:07:59 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2015-03-16 20:26:51 +0100 |
commit | b3023c7e839f1462919a6d42b52650d7c4b9bc3b (patch) | |
tree | ac1388d0880da95d6f9f317c20b068fd2600dbbd /source3 | |
parent | d0dc6481a858ff1ca753fb8d315b543450b2bd1e (diff) | |
download | samba-b3023c7e839f1462919a6d42b52650d7c4b9bc3b.tar.gz |
s3:winbind:pwent: move wb_next_domain() to winbindd_util.c for re-use
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/wb_next_pwent.c | 15 | ||||
-rw-r--r-- | source3/winbindd/winbindd_proto.h | 1 | ||||
-rw-r--r-- | source3/winbindd/winbindd_util.c | 19 |
3 files changed, 20 insertions, 15 deletions
diff --git a/source3/winbindd/wb_next_pwent.c b/source3/winbindd/wb_next_pwent.c index 0de7fd109c5..9bd2a094927 100644 --- a/source3/winbindd/wb_next_pwent.c +++ b/source3/winbindd/wb_next_pwent.c @@ -31,21 +31,6 @@ 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_domain(struct winbindd_domain *domain) -{ - if (domain == NULL) { - domain = domain_list(); - } else { - domain = domain->next; - } - - if ((domain != NULL) - && sid_check_is_our_sam(&domain->sid)) { - domain = domain->next; - } - return domain; -} - struct tevent_req *wb_next_pwent_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct getpwent_state *gstate, diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 66ddaf7d207..37931467aa6 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -404,6 +404,7 @@ NTSTATUS winbind_dual_SamLogon(struct winbindd_domain *domain, /* The following definitions come from winbindd/winbindd_util.c */ struct winbindd_domain *domain_list(void); +struct winbindd_domain *wb_next_domain(struct winbindd_domain *domain); bool domain_is_forest_root(const struct winbindd_domain *domain); void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te, struct timeval now, void *private_data); diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index b1b93266a2a..a0d42a59131 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -73,6 +73,25 @@ static void free_domain_list(void) } } +/** + * Iterator for winbindd's domain list. + * To be used (e.g.) in tevent based loops. + */ +struct winbindd_domain *wb_next_domain(struct winbindd_domain *domain) +{ + if (domain == NULL) { + domain = domain_list(); + } else { + domain = domain->next; + } + + if ((domain != NULL) + && sid_check_is_our_sam(&domain->sid)) { + domain = domain->next; + } + return domain; +} + static bool is_internal_domain(const struct dom_sid *sid) { if (sid == NULL) |