summaryrefslogtreecommitdiffstats
path: root/server/tools/sss_useradd.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-04-07 19:25:48 -0400
committerSimo Sorce <ssorce@redhat.com>2009-04-08 10:55:03 -0400
commit6b5d45693f01eec55128eb3508266cda73071d93 (patch)
treec51ca00f2fb243e5eaf06128e8092583fba1bd8c /server/tools/sss_useradd.c
parente8a7526b06acf4af322fdab593c8bafbd9f4a103 (diff)
downloadsssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.gz
sssd-6b5d45693f01eec55128eb3508266cda73071d93.tar.xz
sssd-6b5d45693f01eec55128eb3508266cda73071d93.zip
Change the way we retrieve domains
To be able to correctly filter out duplicate names when multiple non-fully qualified domains are in use we need to be able to specify the domains order. This is now accomplished by the configuration paramets 'domains' in the config/domains entry. 'domains' is a comma separated list of domain names. This paramter allows also to have disbaled domains in the configuration without requiring to completely delete them. The domains list is now kept in a linked list of sss_domain_info objects. The first domain is also the "default" domain.
Diffstat (limited to 'server/tools/sss_useradd.c')
-rw-r--r--server/tools/sss_useradd.c10
1 files changed, 7 insertions, 3 deletions
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);