summaryrefslogtreecommitdiff
path: root/server/tools
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-07-30 11:40:08 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-07-31 12:08:40 -0400
commita45aea02734e57dd91cdc35b6761364057ca76ae (patch)
treee12ab8df45783c52854e64fa4cd4bfc6fb0855f4 /server/tools
parent5e22a141d0d755c1ee54ea40c5795e56ba18d02f (diff)
downloadsssd-a45aea02734e57dd91cdc35b6761364057ca76ae.tar.gz
sssd-a45aea02734e57dd91cdc35b6761364057ca76ae.tar.bz2
sssd-a45aea02734e57dd91cdc35b6761364057ca76ae.zip
Notify user when deleting nonexistent user or group
Fixes: RHBZ #513247, RHBZ #513250
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/sss_groupdel.c12
-rw-r--r--server/tools/sss_userdel.c13
2 files changed, 20 insertions, 5 deletions
diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c
index 29778263..a8b93578 100644
--- a/server/tools/sss_groupdel.c
+++ b/server/tools/sss_groupdel.c
@@ -97,7 +97,7 @@ static void group_del(struct tevent_req *req)
return groupdel_done(data, ENOMEM, NULL);
}
- subreq = sysdb_delete_entry_send(data, data->ev, data->handle, group_dn);
+ subreq = sysdb_delete_entry_send(data, data->ev, data->handle, group_dn, false);
if (!subreq)
return groupdel_done(data, ENOMEM, NULL);
@@ -255,7 +255,15 @@ int main(int argc, const char **argv)
if (data->error) {
ret = data->error;
DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret)));
- ERROR("Transaction error. Could not remove group.\n");
+ switch (ret) {
+ case ENOENT:
+ ERROR("No such group\n");
+ break;
+
+ default:
+ ERROR("Internal error. Could not remove group.\n");
+ break;
+ }
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c
index c4d9abd3..f7cb7571 100644
--- a/server/tools/sss_userdel.c
+++ b/server/tools/sss_userdel.c
@@ -98,7 +98,7 @@ static void user_del(struct tevent_req *req)
return userdel_done(data, ENOMEM, NULL);
}
- subreq = sysdb_delete_entry_send(data, data->ev, data->handle, user_dn);
+ subreq = sysdb_delete_entry_send(data, data->ev, data->handle, user_dn, false);
if (!subreq)
return userdel_done(data, ENOMEM, NULL);
@@ -115,7 +115,6 @@ static void user_del_done(struct tevent_req *subreq)
return userdel_done(data, ret, NULL);
}
-
static int userdel_legacy(struct ops_ctx *ctx)
{
int ret = EOK;
@@ -257,7 +256,15 @@ int main(int argc, const char **argv)
if (data->error) {
ret = data->error;
DEBUG(1, ("sysdb operation failed (%d)[%s]\n", ret, strerror(ret)));
- ERROR("Internal error. Could not remove user.\n");
+ switch (ret) {
+ case ENOENT:
+ ERROR("No such user\n");
+ break;
+
+ default:
+ ERROR("Internal error. Could not remove user.\n");
+ break;
+ }
ret = EXIT_FAILURE;
goto fini;
}