From 3f21b54146399bdf3e2a56b8466dc95c3b70283e Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Thu, 30 Jul 2009 12:02:29 +0200 Subject: Correct check for local domain in tools When looking for the local domain in the tools, do so by looking on provider value, not domain name. Also removes one redundant lookup of local domain. --- server/tools/sss_usermod.c | 12 ------------ server/tools/tools_util.c | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c index cc94be3a..ca6463fa 100644 --- a/server/tools/sss_usermod.c +++ b/server/tools/sss_usermod.c @@ -553,18 +553,6 @@ int main(int argc, const char **argv) "Could not add attribute to changeset\n"); } - - /* arguments processed, go on to actual work */ - for (dom = ctx->domains; dom; dom = dom->next) { - if (strcasecmp(dom->name, "LOCAL") == 0) break; - } - if (dom == NULL) { - ERROR("Could not get LOCAL domain info\n"); - ret = EXIT_FAILURE; - goto fini; - } - data->domain = dom; - req = sysdb_transaction_send(ctx, ctx->ev, ctx->sysdb); if (!req) { DEBUG(1, ("Could not start transaction (%d)[%s]\n", ret, strerror(ret))); diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c index 0d3220ee..b580300b 100644 --- a/server/tools/tools_util.c +++ b/server/tools/tools_util.c @@ -81,7 +81,7 @@ enum id_domain find_domain_for_id(struct tools_ctx *ctx, if (id < dom->id_min || id > dom->id_max) { continue; } else { - if (strcasecmp(dom->name, "LOCAL") == 0) { + if (strcasecmp(dom->provider, "local") == 0) { *dom_ret = dom; return ID_IN_LOCAL; } else if (is_domain_local_legacy(ctx, dom) == 0) { @@ -100,7 +100,7 @@ enum id_domain find_domain_for_id(struct tools_ctx *ctx, } else { /* No ID specified, find LOCAL */ for (dom = ctx->domains; dom; dom = dom->next) { - if (strcasecmp(dom->name, "LOCAL") == 0) { + if (strcasecmp(dom->provider, "local") == 0) { *dom_ret = dom; return ID_IN_LOCAL; } -- cgit