summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db/sysdb_ops.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 9aaea586..3734bb18 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1139,8 +1139,13 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
ret = sysdb_search_group_by_gid(tmp_ctx, sysdb,
gid, NULL, &msg);
if (ret != ENOENT) {
- if (ret == EOK) ret = EEXIST;
- goto done;
+ if (ret == EOK) {
+ ret = sysdb_delete_group(sysdb, NULL, gid);
+ }
+
+ if (ret != EOK) {
+ goto done;
+ }
}
}