diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-09-08 15:42:10 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-09-08 15:10:50 -0400 |
commit | 7a9bee06e2bc5bcc75659e9a46bdffa870951d7a (patch) | |
tree | 491ec9370b59fd12bdc081629258d64604336a45 /server/tools/sss_groupadd.c | |
parent | 889efbe608251def17c7ba6131fc9aa36c462dc2 (diff) | |
download | sssd-7a9bee06e2bc5bcc75659e9a46bdffa870951d7a.tar.gz sssd-7a9bee06e2bc5bcc75659e9a46bdffa870951d7a.tar.xz sssd-7a9bee06e2bc5bcc75659e9a46bdffa870951d7a.zip |
Remove shadow-utils support from tools
Removes the ability to proxy to shadow-utils. Also remove all the
supporting functions for getting domain type, domain by id etc.
Diffstat (limited to 'server/tools/sss_groupadd.c')
-rw-r--r-- | server/tools/sss_groupadd.c | 91 |
1 files changed, 5 insertions, 86 deletions
diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c index 3d4d4c6da..d0c028391 100644 --- a/server/tools/sss_groupadd.c +++ b/server/tools/sss_groupadd.c @@ -32,18 +32,6 @@ #include "db/sysdb.h" #include "tools/tools_util.h" -#ifndef GROUPADD -#define GROUPADD SHADOW_UTILS_PATH"/groupadd " -#endif - -#ifndef GROUPADD_GID -#define GROUPADD_GID "-g %u " -#endif - -#ifndef GROUPADD_GROUPNAME -#define GROUPADD_GROUPNAME "%s " -#endif - static void add_group_req_done(struct tevent_req *req) { struct ops_ctx *data = tevent_req_callback_data(req, struct ops_ctx); @@ -110,36 +98,6 @@ static void add_group_done(struct tevent_req *subreq) return add_group_terminate(data, ret); } -static int groupadd_legacy(struct ops_ctx *ctx) -{ - int ret = EOK; - char *command = NULL; - - command = talloc_asprintf(ctx, "%s ", GROUPADD); - if (command == NULL) { - DEBUG(1, ("Cannot allocate memory for command string\n")); - return ENOMEM; - } - - APPEND_PARAM(command, GROUPADD_GID, ctx->gid); - APPEND_STRING(command, ctx->name); - - ret = system(command); - if (ret) { - if (ret == -1) { - DEBUG(1, ("system(3) failed\n")); - } else { - DEBUG(1, ("Could not exec '%s', return code: %d\n", - command, WEXITSTATUS(ret))); - } - talloc_free(command); - return EFAULT; - } - - talloc_free(command); - return ret; -} - int main(int argc, const char **argv) { gid_t pc_gid = 0; @@ -152,7 +110,6 @@ int main(int argc, const char **argv) 0, _("The GID of the group"), NULL }, POPT_TABLEEND }; - struct sss_domain_info *dom; poptContext pc = NULL; struct tools_ctx *ctx = NULL; struct tevent_req *req; @@ -207,59 +164,21 @@ int main(int argc, const char **argv) goto fini; } - ret = parse_name_domain(data, pc_groupname); + ret = get_domain(data, pc_groupname); if (ret != EOK) { + ERROR("Cannot get domain information\n"); ret = EXIT_FAILURE; goto fini; } data->gid = pc_gid; - ret = get_domain_by_id(data->ctx, data->gid, &dom); - if (ret != EOK) { - ERROR("Cannot get domain info\n"); - ret = EXIT_FAILURE; - goto fini; - } - if (data->domain && data->gid && data->domain != dom) { - ERROR("Selected domain %s conflicts with selected GID %llu\n", - data->domain->name, (unsigned long long int) data->gid); + /* arguments processed, go on to actual work */ + if (id_in_range(data->gid, data->domain) != EOK) { + ERROR("The selected GID is outside the allowed range\n"); ret = EXIT_FAILURE; goto fini; } - if (data->domain == NULL && dom) { - data->domain = dom; - } - - ret = get_domain_type(data->ctx, data->domain); - switch (ret) { - case ID_IN_LOCAL: - break; - - case ID_IN_LEGACY_LOCAL: - ret = groupadd_legacy(data); - if(ret != EOK) { - ERROR("Cannot add group to domain using the legacy tools\n"); - } - goto fini; - - case ID_OUTSIDE: - ERROR("The selected GID is outside all domain ranges\n"); - ret = EXIT_FAILURE; - goto fini; - - case ID_IN_OTHER: - DEBUG(1, ("Cannot add group to domain %s\n", dom->name)); - ERROR("Unsupported domain type"); - ret = EXIT_FAILURE; - goto fini; - - default: - DEBUG(1, ("Unknown return code %d from get_domain_type\n", ret)); - ERROR("Error looking up domain\n"); - ret = EXIT_FAILURE; - goto fini; - } /* add_group */ req = sysdb_transaction_send(ctx, ctx->ev, data->ctx->sysdb); |