summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-06 17:27:54 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:49:20 +0100
commita0593a02a5d2c7a8b4dda330a69fb1f10cc12cdb (patch)
treef02b7946ebfffd307df5579f196c7f356afd0d03 /src
parent2d66c2eee2e4364a52d5436b61759ef990108230 (diff)
downloadsssd-a0593a02a5d2c7a8b4dda330a69fb1f10cc12cdb.tar.gz
sssd-a0593a02a5d2c7a8b4dda330a69fb1f10cc12cdb.tar.bz2
sssd-a0593a02a5d2c7a8b4dda330a69fb1f10cc12cdb.zip
Pass domain to sysdb_enum<pw/gr>ebt() functions
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb.h2
-rw-r--r--src/db/sysdb_search.c8
-rw-r--r--src/responder/nss/nsssrv_cmd.c8
-rw-r--r--src/tests/sysdb-tests.c2
4 files changed, 13 insertions, 7 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index 350bb8db..fa6c2735 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -467,6 +467,7 @@ int sysdb_getpwuid(TALLOC_CTX *mem_ctx,
int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct ldb_result **res);
int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
@@ -483,6 +484,7 @@ int sysdb_getgrgid(TALLOC_CTX *mem_ctx,
int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct ldb_result **res);
struct sysdb_netgroup_ctx {
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index 03fef2ed..4a279526 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -128,6 +128,7 @@ done:
int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct ldb_result **_res)
{
TALLOC_CTX *tmp_ctx;
@@ -142,7 +143,7 @@ int sysdb_enumpwent(TALLOC_CTX *mem_ctx,
}
base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
- SYSDB_TMPL_USER_BASE, sysdb->domain->name);
+ SYSDB_TMPL_USER_BASE, domain->name);
if (!base_dn) {
ret = ENOMEM;
goto done;
@@ -333,6 +334,7 @@ done:
int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
struct ldb_result **_res)
{
TALLOC_CTX *tmp_ctx;
@@ -350,11 +352,11 @@ int sysdb_enumgrent(TALLOC_CTX *mem_ctx,
if (sysdb->mpg) {
fmt_filter = SYSDB_GRENT_MPG_FILTER;
base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
- SYSDB_DOM_BASE, sysdb->domain->name);
+ SYSDB_DOM_BASE, domain->name);
} else {
fmt_filter = SYSDB_GRENT_FILTER;
base_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
- SYSDB_TMPL_GROUP_BASE, sysdb->domain->name);
+ SYSDB_TMPL_GROUP_BASE, domain->name);
}
if (!base_dn) {
ret = ENOMEM;
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index 665aaf6c..d40b3f98 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -121,7 +121,7 @@ void nss_update_pw_memcache(struct nss_ctx *nctx)
now = time(NULL);
for (dom = nctx->rctx->domains; dom != NULL; dom = dom->next) {
- ret = sysdb_enumpwent(nctx, dom->sysdb, &res);
+ ret = sysdb_enumpwent(nctx, dom->sysdb, dom, &res);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Failed to enumerate users for domain [%s]\n", dom->name));
@@ -1533,7 +1533,7 @@ static errno_t nss_cmd_setpwent_step(struct setent_step_ctx *step_ctx)
}
}
- ret = sysdb_enumpwent(dctx, sysdb, &res);
+ ret = sysdb_enumpwent(dctx, sysdb, dom, &res);
if (ret != EOK) {
DEBUG(1, ("Enum from cache failed, skipping domain [%s]\n",
dom->name));
@@ -1859,7 +1859,7 @@ void nss_update_gr_memcache(struct nss_ctx *nctx)
now = time(NULL);
for (dom = nctx->rctx->domains; dom != NULL; dom = dom->next) {
- ret = sysdb_enumgrent(nctx, dom->sysdb, &res);
+ ret = sysdb_enumgrent(nctx, dom->sysdb, dom, &res);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Failed to enumerate users for domain [%s]\n", dom->name));
@@ -3101,7 +3101,7 @@ static errno_t nss_cmd_setgrent_step(struct setent_step_ctx *step_ctx)
}
}
- ret = sysdb_enumgrent(dctx, sysdb, &res);
+ ret = sysdb_enumgrent(dctx, sysdb, dom, &res);
if (ret != EOK) {
DEBUG(1, ("Enum from cache failed, skipping domain [%s]\n",
dom->name));
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index 06096ad9..c60d4766 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -1043,6 +1043,7 @@ START_TEST (test_sysdb_enumgrent)
ret = sysdb_enumgrent(test_ctx,
test_ctx->sysdb,
+ test_ctx->domain,
&res);
fail_unless(ret == EOK,
"sysdb_enumgrent failed (%d: %s)",
@@ -1070,6 +1071,7 @@ START_TEST (test_sysdb_enumpwent)
ret = sysdb_enumpwent(test_ctx,
test_ctx->sysdb,
+ test_ctx->domain,
&res);
fail_unless(ret == EOK,
"sysdb_enumpwent failed (%d: %s)",