[SSSD] [PATCH] DB: Cancel transaction in sysdb_store_user if sysdb_add_user fails
Jakub Hrozek
jhrozek at redhat.com
Thu Sep 20 10:56:57 UTC 2012
I found this while working on #1440 with Michal.
-------------- next part --------------
>From fe247234065fb30c84b97df3b42c1d8245e78b19 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 19 Sep 2012 16:02:00 +0200
Subject: [PATCH] DB: Cancel transaction in sysdb_store_user if sysdb_add_user
fails
---
src/db/sysdb_ops.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 91fa21e9624db55ecfe31e46878fee6b5448aede..33abd06b25f41d893b4d8931929f872803ed8b64 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1568,7 +1568,14 @@ int sysdb_store_user(struct sysdb_ctx *sysdb,
ret = sysdb_add_user(sysdb, name, uid, gid, gecos,
homedir, shell, attrs, cache_timeout, now);
}
- goto done;
+
+ /* Handle the result of sysdb_add_user */
+ if (ret == EOK) {
+ goto done;
+ } else {
+ DEBUG(SSSDBG_OP_FAILURE, ("Could not add user\n"));
+ goto fail;
+ }
}
/* the user exists, let's just replace attributes when set */
--
1.7.11.4
More information about the sssd-devel
mailing list