>From 22b67ba21abe37d192a2d4af1278d87900d764d9 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 4 Mar 2014 13:48:36 +0100 Subject: [PATCH] IPA: Do not save intermediate data to sysdb --- src/providers/ipa/ipa_selinux.c | 68 ++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c index d371d3c1d3ee25f8ad3700091e8b7064c5c65b9e..6b28d4f97b708e55946fe17cae06060ed99e612b 100644 --- a/src/providers/ipa/ipa_selinux.c +++ b/src/providers/ipa/ipa_selinux.c @@ -296,6 +296,40 @@ static void ipa_selinux_handler_done(struct tevent_req *req) goto fail; } + ret = sysdb_transaction_start(sysdb); + if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); + goto fail; + } + in_transaction = true; + + ret = sysdb_delete_usermaps(op_ctx->domain); + if (ret != EOK) { + DEBUG(SSSDBG_CRIT_FAILURE, + "Cannot delete existing maps from sysdb\n"); + goto fail; + } + + ret = sysdb_store_selinux_config(op_ctx->domain, + default_user, map_order); + if (ret != EOK) { + goto fail; + } + + if (map_count > 0 && maps != NULL) { + ret = ipa_save_user_maps(sysdb, op_ctx->domain, map_count, maps); + if (ret != EOK) { + goto fail; + } + } + + ret = sysdb_transaction_commit(sysdb); + if (ret != EOK) { + DEBUG(SSSDBG_OP_FAILURE, "Could not commit transaction\n"); + goto fail; + } + in_transaction = false; + /* Process the maps and return list of best matches (maps with * highest priority). The input maps are also parent memory * context for the output list of best matches. The best match @@ -324,40 +358,6 @@ static void ipa_selinux_handler_done(struct tevent_req *req) goto fail; } - ret = sysdb_transaction_start(sysdb); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "Failed to start transaction\n"); - goto fail; - } - in_transaction = true; - - ret = sysdb_delete_usermaps(op_ctx->domain); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, - "Cannot delete existing maps from sysdb\n"); - goto fail; - } - - ret = sysdb_store_selinux_config(op_ctx->domain, - default_user, map_order); - if (ret != EOK) { - goto fail; - } - - if (map_count > 0 && maps != NULL) { - ret = ipa_save_user_maps(sysdb, op_ctx->domain, map_count, maps); - if (ret != EOK) { - goto fail; - } - } - - ret = sysdb_transaction_commit(sysdb); - if (ret != EOK) { - DEBUG(SSSDBG_OP_FAILURE, "Could not commit transaction\n"); - goto fail; - } - in_transaction = false; - /* If we got here in online mode, set last_update to current time */ if (!be_is_offline(be_ctx)) { op_ctx->selinux_ctx->last_update = time(NULL); -- 1.8.4.2