summaryrefslogtreecommitdiffstats
path: root/src/responder/nss/nsssrv_services.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-14 17:04:00 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-02-10 22:08:47 +0100
commit0232747f04b650796db56fd7b487aee8a96fab03 (patch)
tree0c0329a59cbb66b1e4ea4983cd034dc9015245dc /src/responder/nss/nsssrv_services.c
parent95e94691178297f2b8225a83d43ae388cab04b45 (diff)
downloadsssd-0232747f04b650796db56fd7b487aee8a96fab03.tar.gz
sssd-0232747f04b650796db56fd7b487aee8a96fab03.tar.xz
sssd-0232747f04b650796db56fd7b487aee8a96fab03.zip
Add function get_next_domain()
Use this function instead of explicitly calling domain->next This function allows to get the next primary domain or to descend into the subdomains and replaces also get_next_dom_or_subdom()
Diffstat (limited to 'src/responder/nss/nsssrv_services.c')
-rw-r--r--src/responder/nss/nsssrv_services.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index dd12fa412..7b76cad86 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -99,7 +99,9 @@ getserv_send(TALLOC_CTX *mem_ctx,
if (!req) return NULL;
state->dctx = dctx;
- for (dom = cctx->rctx->domains; dom; dom = dom->next) num_domains++;
+ for (dom = cctx->rctx->domains; dom; dom = get_next_domain(dom, false)) {
+ num_domains++;
+ }
/* Create an array of domains to check. To save resizes, we'll
* assume that all will be checked
@@ -160,7 +162,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* if it is a domainless search, skip domains that require fully
* qualified names instead */
while (dom && cmdctx->check_next && dom->fqnames) {
- dom = dom->next;
+ dom = get_next_domain(dom, false);
}
if (!dom) break;
@@ -191,7 +193,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* If this is a multi-domain search, try the next one */
if (cmdctx->check_next) {
- dom = dom->next;
+ dom = get_next_domain(dom, false);
} else {
/* This was a single-domain search.
* exit the loop. Since it was negatively-
@@ -232,7 +234,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* If this is a multi-domain search, try the next one */
if (cmdctx->check_next) {
- dom = dom->next;
+ dom = get_next_domain(dom, false);
} else {
/* This was a single-domain search.
* exit the loop. Since it was negatively-
@@ -298,7 +300,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* If this is a multi-domain search, try the next one */
if (cmdctx->check_next) {
- dom = dom->next;
+ dom = get_next_domain(dom, false);
} else {
/* This was a single-domain search.
* exit the loop.
@@ -380,7 +382,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* If this is a multi-domain search, try the next one */
if (cmdctx->check_next) {
- dom = dom->next;
+ dom = get_next_domain(dom, false);
} else {
/* This was a single-domain search.
* exit the loop.
@@ -1257,10 +1259,10 @@ setservent_send(TALLOC_CTX *mem_ctx, struct cli_ctx *cctx)
* to reallocate later
*/
num_domains = 0;
- dom = state->cctx->rctx->domains;
- while (dom) {
+ for (dom = state->cctx->rctx->domains;
+ dom;
+ dom = get_next_domain(dom, false)) {
num_domains++;
- dom = dom->next;
}
state->nctx->svcctx->doms = talloc_zero_array(state->nctx->svcctx,
@@ -1306,7 +1308,7 @@ setservent_send(TALLOC_CTX *mem_ctx, struct cli_ctx *cctx)
("Error [%s] requesting info from domain [%s]. Skipping.\n",
strerror(ret), step_ctx->dctx->domain->name));
- step_ctx->dctx->domain = step_ctx->dctx->domain->next;
+ step_ctx->dctx->domain = get_next_domain(step_ctx->dctx->domain, false);
}
/* All domains failed */
@@ -1501,7 +1503,7 @@ setservent_step_done(struct tevent_req *req)
svcctx->num++;
}
- step_ctx->dctx->domain = step_ctx->dctx->domain->next;
+ step_ctx->dctx->domain = get_next_domain(step_ctx->dctx->domain, false);
while (step_ctx->dctx->domain) {
/* There are more domains to check */
@@ -1515,7 +1517,7 @@ setservent_step_done(struct tevent_req *req)
("Error [%s] requesting info from domain [%s]. Skipping.\n",
strerror(ret), step_ctx->dctx->domain->name));
- step_ctx->dctx->domain = step_ctx->dctx->domain->next;
+ step_ctx->dctx->domain = get_next_domain(step_ctx->dctx->domain, false);
}
/* All domains have been checked */