diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-10-02 10:39:02 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-10-14 15:24:53 -0400 |
commit | 62aa4da7dc3a7826c5a942349e1af9631ca819f5 (patch) | |
tree | 7e6419821ae04117ee300022dadcebfa5b94c23b /server/tools/sss_groupmod.c | |
parent | 00d9648150da524df2690392995804e69604bdc8 (diff) | |
download | sssd-62aa4da7dc3a7826c5a942349e1af9631ca819f5.tar.gz sssd-62aa4da7dc3a7826c5a942349e1af9631ca819f5.tar.bz2 sssd-62aa4da7dc3a7826c5a942349e1af9631ca819f5.zip |
Fix error messages in tools
Add getpwnam, getgrnam sync versions
Fix ticket #164: Groupnames in non-local domains
Fix ticket #100: Error Message Modifying a user that doesn't Exist
Fix ticket #214: incorrect error message when MPG already exists
Fix ticket #188: Deleting and modifying users in non-local domain
Fix ticket #120: Adding a user to a full domain gives unhelpful error message
Diffstat (limited to 'server/tools/sss_groupmod.c')
-rw-r--r-- | server/tools/sss_groupmod.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c index e821fdc3..d3a35988 100644 --- a/server/tools/sss_groupmod.c +++ b/server/tools/sss_groupmod.c @@ -53,6 +53,7 @@ int main(int argc, const char **argv) char *addgroups = NULL, *rmgroups = NULL; int ret; const char *pc_groupname = NULL; + char *badgroup = NULL; debug_prg_name = argv[0]; @@ -117,6 +118,17 @@ int main(int argc, const char **argv) ret = EXIT_FAILURE; goto fini; } + /* check the username to be able to give sensible error message */ + ret = sysdb_getgrnam_sync(tctx, tctx->ev, tctx->sysdb, + tctx->octx->name, tctx->local, + &tctx->octx); + if (ret != EOK) { + ERROR("Cannot find group in local domain, " + "modifying groups is allowed only in local domain\n"); + ret = EXIT_FAILURE; + goto fini; + } + tctx->octx->gid = pc_gid; @@ -125,6 +137,7 @@ int main(int argc, const char **argv) if (ret != EOK) { DEBUG(1, ("Cannot parse groups to add the group to\n")); ERROR("Internal error while parsing parameters\n"); + ret = EXIT_FAILURE; goto fini; } @@ -132,6 +145,16 @@ int main(int argc, const char **argv) if (ret != EOK) { DEBUG(1, ("Cannot parse FQDN groups to add the group to\n")); ERROR("Member groups must be in the same domain as parent group\n"); + ret = EXIT_FAILURE; + goto fini; + } + + /* Check group names in the LOCAL domain */ + ret = check_group_names(tctx, tctx->octx->addgroups, &badgroup); + if (ret != EOK) { + ERROR("Cannot find group %s in local domain, " + "only groups in local domain are allowed\n", badgroup); + ret = EXIT_FAILURE; goto fini; } } @@ -141,6 +164,7 @@ int main(int argc, const char **argv) if (ret != EOK) { DEBUG(1, ("Cannot parse groups to remove the group from\n")); ERROR("Internal error while parsing parameters\n"); + ret = EXIT_FAILURE; goto fini; } @@ -148,6 +172,16 @@ int main(int argc, const char **argv) if (ret != EOK) { DEBUG(1, ("Cannot parse FQDN groups to remove the group from\n")); ERROR("Member groups must be in the same domain as parent group\n"); + ret = EXIT_FAILURE; + goto fini; + } + + /* Check group names in the LOCAL domain */ + ret = check_group_names(tctx, tctx->octx->rmgroups, &badgroup); + if (ret != EOK) { + ERROR("Cannot find group %s in local domain, " + "only groups in local domain are allowed\n", badgroup); + ret = EXIT_FAILURE; goto fini; } } |