summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-06 17:17:25 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:49:20 +0100
commit58fd3aa25c5292bc67432647ab7e5059439fcc6d (patch)
tree54d9c27c24d910d412875fd6cdc2660f9dae743f /src/tools
parent73120327cc136229d56d08f7f8c5e8df4129c1e3 (diff)
downloadsssd-58fd3aa25c5292bc67432647ab7e5059439fcc6d.tar.gz
sssd-58fd3aa25c5292bc67432647ab7e5059439fcc6d.tar.bz2
sssd-58fd3aa25c5292bc67432647ab7e5059439fcc6d.zip
Pass domain to sysdb_get<pw/gr>nam() functions
Also allows us to remove sysdb_subdom_get<pw/gr>nam() wrappers and restore fqnames proper value in subdomains, by testing for a parent domain being present or not.
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/sss_seed.c10
-rw-r--r--src/tools/sss_sync_ops.c4
2 files changed, 9 insertions, 5 deletions
diff --git a/src/tools/sss_seed.c b/src/tools/sss_seed.c
index d3c1cb44..45b4d1ad 100644
--- a/src/tools/sss_seed.c
+++ b/src/tools/sss_seed.c
@@ -47,6 +47,7 @@ struct user_ctx {
struct seed_ctx {
struct confdb_ctx *confdb;
+ struct sss_domain_info *domain;
struct sysdb_ctx *sysdb;
struct user_ctx *uctx;
@@ -598,6 +599,7 @@ fini:
static int seed_init_db(TALLOC_CTX *mem_ctx,
const char *domain_name,
struct confdb_ctx **_confdb,
+ struct sss_domain_info **_domain,
struct sysdb_ctx **_sysdb)
{
TALLOC_CTX *tmp_ctx = NULL;
@@ -640,6 +642,7 @@ static int seed_init_db(TALLOC_CTX *mem_ctx,
}
*_confdb = talloc_steal(mem_ctx, confdb);
+ *_domain = domain;
*_sysdb = domain->sysdb;
done:
@@ -650,6 +653,7 @@ done:
static int seed_domain_user_info(const char *name,
const char *domain_name,
struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
bool *is_cached)
{
TALLOC_CTX *tmp_ctx = NULL;
@@ -680,7 +684,7 @@ static int seed_domain_user_info(const char *name,
}
/* look for user in cache */
- ret = sysdb_getpwnam(tmp_ctx, sysdb, name, &res);
+ ret = sysdb_getpwnam(tmp_ctx, sysdb, domain, name, &res);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
("Couldn't lookup user (%s) in the cache\n", name));
@@ -792,7 +796,7 @@ int main(int argc, const char **argv)
/* set up confdb,sysdb and domain */
ret = seed_init_db(sctx, sctx->uctx->domain_name, &sctx->confdb,
- &sctx->sysdb);
+ &sctx->domain, &sctx->sysdb);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to initialize db and domain\n"));
goto done;
@@ -800,7 +804,7 @@ int main(int argc, const char **argv)
/* get user info from domain */
ret = seed_domain_user_info(sctx->uctx->name, sctx->uctx->domain_name,
- sctx->sysdb, &sctx->user_cached);
+ sctx->sysdb, sctx->domain, &sctx->user_cached);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE, ("Failed lookup of user [%s] in domain [%s]\n",
sctx->uctx->name, sctx->uctx->domain_name));
diff --git a/src/tools/sss_sync_ops.c b/src/tools/sss_sync_ops.c
index 37fd8c61..f5d496b5 100644
--- a/src/tools/sss_sync_ops.c
+++ b/src/tools/sss_sync_ops.c
@@ -575,7 +575,7 @@ int sysdb_getpwnam_sync(TALLOC_CTX *mem_ctx,
const char *str;
int ret;
- ret = sysdb_getpwnam(mem_ctx, sysdb, name, &res);
+ ret = sysdb_getpwnam(mem_ctx, sysdb, out->domain, name, &res);
if (ret) {
return ret;
}
@@ -648,7 +648,7 @@ int sysdb_getgrnam_sync(TALLOC_CTX *mem_ctx,
const char *str;
int ret;
- ret = sysdb_getgrnam(mem_ctx, sysdb, name, &res);
+ ret = sysdb_getgrnam(mem_ctx, sysdb, out->domain, name, &res);
if (ret) {
return ret;
}