diff options
Diffstat (limited to 'server/tools')
-rw-r--r-- | server/tools/sss_groupadd.c | 9 | ||||
-rw-r--r-- | server/tools/sss_groupdel.c | 12 | ||||
-rw-r--r-- | server/tools/sss_groupmod.c | 11 | ||||
-rw-r--r-- | server/tools/sss_useradd.c | 10 | ||||
-rw-r--r-- | server/tools/sss_userdel.c | 11 | ||||
-rw-r--r-- | server/tools/sss_usermod.c | 12 | ||||
-rw-r--r-- | server/tools/tools_util.h | 2 |
7 files changed, 46 insertions, 21 deletions
diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c index 5363dbbaf..d05597164 100644 --- a/server/tools/sss_groupadd.c +++ b/server/tools/sss_groupadd.c @@ -83,7 +83,7 @@ int main(int argc, const char **argv) { "gid", 'g', POPT_ARG_INT, &pc_gid, 0, "The GID of the group", NULL }, POPT_TABLEEND }; - + struct sss_domain_info *dom; poptContext pc = NULL; struct tools_ctx *ctx = NULL; struct group_add_ctx *group_ctx = NULL; @@ -128,12 +128,15 @@ int main(int argc, const char **argv) /* arguments processed, go on to actual work */ - group_ctx->domain = btreemap_get_value(ctx->domains, "LOCAL"); - if (group_ctx->domain == NULL) { + for (dom = ctx->domains; dom; dom = dom->next) { + if (strcasecmp(dom->name, "LOCAL") == 0) break; + } + if (dom == NULL) { DEBUG(0, ("Could not get domain info\n")); ret = EXIT_FAILURE; goto fini; } + group_ctx->domain = dom; /* add_group */ ret = sysdb_transaction(ctx, ctx->sysdb, add_group, group_ctx); diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c index 1cbddf458..8e85003c9 100644 --- a/server/tools/sss_groupdel.c +++ b/server/tools/sss_groupdel.c @@ -79,7 +79,7 @@ int main(int argc, const char **argv) int ret = EXIT_SUCCESS; struct group_del_ctx *group_ctx = NULL; struct tools_ctx *ctx = NULL; - + struct sss_domain_info *dom; poptContext pc = NULL; struct poptOption long_options[] = { @@ -121,12 +121,16 @@ int main(int argc, const char **argv) /* arguments processed, go on to actual work */ - group_ctx->domain = btreemap_get_value(ctx->domains, "LOCAL"); - if (group_ctx->domain == NULL) { - DEBUG(0, ("Could not set default values\n")); + for (dom = ctx->domains; dom; dom = dom->next) { + if (strcasecmp(dom->name, "LOCAL") == 0) break; + } + if (dom == NULL) { + DEBUG(0, ("Could not get domain info\n")); ret = EXIT_FAILURE; goto fini; } + group_ctx->domain = dom; + group_ctx->group_dn = sysdb_group_dn(ctx->sysdb, ctx, group_ctx->domain->name, diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c index ed16033a1..922555f0b 100644 --- a/server/tools/sss_groupmod.c +++ b/server/tools/sss_groupmod.c @@ -186,6 +186,7 @@ int main(int argc, const char **argv) POPT_TABLEEND }; poptContext pc = NULL; + struct sss_domain_info *dom; struct group_mod_ctx *group_ctx = NULL; struct tools_ctx *ctx = NULL; char *groups; @@ -246,12 +247,16 @@ int main(int argc, const char **argv) group_ctx->gid = pc_gid; /* arguments processed, go on to actual work */ - group_ctx->domain = btreemap_get_value(ctx->domains, "LOCAL"); - if (group_ctx->domain == NULL) { - DEBUG(0, ("Could not get the domain\n")); + + for (dom = ctx->domains; dom; dom = dom->next) { + if (strcasecmp(dom->name, "LOCAL") == 0) break; + } + if (dom == NULL) { + DEBUG(0, ("Could not get domain info\n")); ret = EXIT_FAILURE; goto fini; } + group_ctx->domain = dom; ret = sysdb_transaction(ctx, ctx->sysdb, mod_group, group_ctx); if (ret != EOK) { diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c index ba89276fa..d3b930d1a 100644 --- a/server/tools/sss_useradd.c +++ b/server/tools/sss_useradd.c @@ -233,6 +233,7 @@ int main(int argc, const char **argv) POPT_TABLEEND }; poptContext pc = NULL; + struct sss_domain_info *dom; struct user_add_ctx *user_ctx = NULL; struct tools_ctx *ctx = NULL; char *groups; @@ -332,12 +333,15 @@ int main(int argc, const char **argv) /* arguments processed, go on to actual work */ - user_ctx->domain = btreemap_get_value(ctx->domains, "LOCAL"); - if (user_ctx->domain == NULL) { - DEBUG(0, ("Could not set default values\n")); + for (dom = ctx->domains; dom; dom = dom->next) { + if (strcasecmp(dom->name, "LOCAL") == 0) break; + } + if (dom == NULL) { + DEBUG(0, ("Could not get domain info\n")); ret = EXIT_FAILURE; goto fini; } + user_ctx->domain = dom; /* useradd */ ret = sysdb_transaction(ctx, ctx->sysdb, add_user, user_ctx); diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c index 1a56cf9d8..47188824c 100644 --- a/server/tools/sss_userdel.c +++ b/server/tools/sss_userdel.c @@ -78,7 +78,7 @@ int main(int argc, const char **argv) int ret = EXIT_SUCCESS; struct user_del_ctx *user_ctx = NULL; struct tools_ctx *ctx = NULL; - + struct sss_domain_info *dom; poptContext pc = NULL; struct poptOption long_options[] = { @@ -120,12 +120,15 @@ int main(int argc, const char **argv) /* arguments processed, go on to actual work */ - user_ctx->domain = btreemap_get_value(ctx->domains, "LOCAL"); - if (user_ctx->domain == NULL) { - DEBUG(0, ("Could not set default values\n")); + for (dom = ctx->domains; dom; dom = dom->next) { + if (strcasecmp(dom->name, "LOCAL") == 0) break; + } + if (dom == NULL) { + DEBUG(0, ("Could not get domain info\n")); ret = EXIT_FAILURE; goto fini; } + user_ctx->domain = dom; user_ctx->user_dn = sysdb_user_dn(ctx->sysdb, ctx, user_ctx->domain->name, diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c index 6f1d4ce66..dae584e2e 100644 --- a/server/tools/sss_usermod.c +++ b/server/tools/sss_usermod.c @@ -210,6 +210,7 @@ int main(int argc, const char **argv) POPT_TABLEEND }; poptContext pc = NULL; + struct sss_domain_info *dom; struct user_mod_ctx *user_ctx = NULL; struct tools_ctx *ctx = NULL; char *groups; @@ -328,10 +329,15 @@ int main(int argc, const char **argv) /* arguments processed, go on to actual work */ - user_ctx->domain = btreemap_get_value(ctx->domains, "LOCAL"); - if (user_ctx->domain == NULL) { - VAR_CHECK(ret, EOK, "Could not set default values\n"); + for (dom = ctx->domains; dom; dom = dom->next) { + if (strcasecmp(dom->name, "LOCAL") == 0) break; } + if (dom == NULL) { + DEBUG(0, ("Could not get domain info\n")); + ret = EXIT_FAILURE; + goto fini; + } + user_ctx->domain = dom; ret = sysdb_transaction(ctx, ctx->sysdb, mod_user, user_ctx); if (ret != EOK) { diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h index 4a32e9c73..ef55dede0 100644 --- a/server/tools/tools_util.h +++ b/server/tools/tools_util.h @@ -9,7 +9,7 @@ struct tools_ctx { struct confdb_ctx *confdb; struct sysdb_ctx *sysdb; - struct btreemap *domains; + struct sss_domain_info *domains; }; int setup_db(struct tools_ctx **ctx); |