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