summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-02-17 02:17:58 -0500
committerSimo Sorce <idra@samba.org>2009-02-17 02:18:44 -0500
commit9317122ff7de070361f6a4862ccffbbcd4b13924 (patch)
treed1da8745973700f94007af414cd282bcd485940b
parenta0610e92ac970ebbc0d83761f9fef5ca4f95f4c9 (diff)
downloadsssd-9317122ff7de070361f6a4862ccffbbcd4b13924.tar.gz
sssd-9317122ff7de070361f6a4862ccffbbcd4b13924.tar.bz2
sssd-9317122ff7de070361f6a4862ccffbbcd4b13924.zip
Fix another transaction mis-handling
-rw-r--r--server/db/sysdb.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/server/db/sysdb.c b/server/db/sysdb.c
index c9ca1f62..f910110c 100644
--- a/server/db/sysdb.c
+++ b/server/db/sysdb.c
@@ -1140,15 +1140,14 @@ int sysdb_posix_remove_user_by_uid(TALLOC_CTX *memctx,
}
if (res->count == 0) {
- DEBUG(0, ("Base search returned %d results\n",
- res->count));
+ DEBUG(0, ("Base search returned no results\n"));
ret = EOK;
goto done;
}
if (res->count > 1) {
DEBUG(0, ("Cache DB corrupted, base search returned %d results\n",
res->count));
- ret = EOK;
+ ret = EIO;
goto done;
}
@@ -1170,20 +1169,20 @@ int sysdb_posix_remove_user_by_uid(TALLOC_CTX *memctx,
goto done;
}
- lret = ldb_transaction_commit(sysdb->ldb);
- if (lret != LDB_SUCCESS) {
- DEBUG(1, ("Failed ldb transaction commit !! (%d)\n", lret));
- ret = EIO;
- goto done;
- }
-
ret = EOK;
done:
- if (ret != EOK) {
+ if (ret == EOK) {
+ lret = ldb_transaction_commit(sysdb->ldb);
+ if (lret != LDB_SUCCESS) {
+ DEBUG(1, ("Failed ldb transaction commit !! (%d)\n", lret));
+ ret = EIO;
+ }
+ } else {
lret = ldb_transaction_cancel(sysdb->ldb);
if (lret != LDB_SUCCESS) {
DEBUG(1, ("Failed to cancel ldb transaction (%d)\n", lret));
+ ret = EIO;
}
}
@@ -1538,15 +1537,14 @@ int sysdb_posix_remove_group_by_gid(TALLOC_CTX *memctx,
}
if (res->count == 0) {
- DEBUG(0, ("Base search returned %d results\n",
- res->count));
+ DEBUG(0, ("Base search returned no results\n"));
ret = EOK;
goto done;
}
if (res->count > 1) {
DEBUG(0, ("Cache DB corrupted, base search returned %d results\n",
res->count));
- ret = EOK;
+ ret = EIO;
goto done;
}
@@ -1568,20 +1566,20 @@ int sysdb_posix_remove_group_by_gid(TALLOC_CTX *memctx,
goto done;
}
- lret = ldb_transaction_commit(sysdb->ldb);
- if (lret != LDB_SUCCESS) {
- DEBUG(1, ("Failed ldb transaction commit !! (%d)\n", lret));
- ret = EIO;
- goto done;
- }
-
ret = EOK;
done:
- if (ret != EOK) {
+ if (ret == EOK) {
+ lret = ldb_transaction_commit(sysdb->ldb);
+ if (lret != LDB_SUCCESS) {
+ DEBUG(1, ("Failed ldb transaction commit !! (%d)\n", lret));
+ ret = EIO;
+ }
+ } else {
lret = ldb_transaction_cancel(sysdb->ldb);
if (lret != LDB_SUCCESS) {
DEBUG(1, ("Failed to cancel ldb transaction (%d)\n", lret));
+ ret = EIO;
}
}