Blame SOURCES/0044-pac-fix-double-free.patch

2fc102
From 47bc6c387ab1d3f835167c528bb57f688080af1a Mon Sep 17 00:00:00 2001
2fc102
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
2fc102
Date: Mon, 11 Nov 2013 12:47:53 +0100
2fc102
Subject: [PATCH 44/47] pac: fix double free
2fc102
2fc102
---
2fc102
 src/responder/pac/pacsrv_utils.c | 14 ++++++--------
2fc102
 1 file changed, 6 insertions(+), 8 deletions(-)
2fc102
2fc102
diff --git a/src/responder/pac/pacsrv_utils.c b/src/responder/pac/pacsrv_utils.c
2fc102
index 6a6ea2e357483c68533c501b93c16383ee644048..a82320fcae3b0494e7b6b322428e3a17ed729b4a 100644
2fc102
--- a/src/responder/pac/pacsrv_utils.c
2fc102
+++ b/src/responder/pac/pacsrv_utils.c
2fc102
@@ -74,6 +74,7 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
2fc102
     struct sss_domain_info *user_dom;
2fc102
     struct sss_domain_info *group_dom;
2fc102
     char *sid_str = NULL;
2fc102
+    char *msid_str = NULL;
2fc102
     char *user_dom_sid_str = NULL;
2fc102
     size_t user_dom_sid_str_len;
2fc102
     enum idmap_error_code err;
2fc102
@@ -231,24 +232,22 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
2fc102
 
2fc102
     }
2fc102
 
2fc102
-    talloc_zfree(sid_str);
2fc102
-
2fc102
     for(s = 0; s < info3->sidcount; s++) {
2fc102
         err = sss_idmap_smb_sid_to_sid(pac_ctx->idmap_ctx, info3->sids[s].sid,
2fc102
-                                       &sid_str);
2fc102
+                                       &msid_str);
2fc102
         if (err != IDMAP_SUCCESS) {
2fc102
             DEBUG(SSSDBG_OP_FAILURE, ("sss_idmap_smb_sid_to_sid failed.\n"));
2fc102
             ret = EFAULT;
2fc102
             goto done;
2fc102
         }
2fc102
 
2fc102
-        key.str = sid_str;
2fc102
+        key.str = msid_str;
2fc102
         value.ul = 0;
2fc102
 
2fc102
-        ret = responder_get_domain_by_id(pac_ctx->rctx, sid_str, &group_dom);
2fc102
+        ret = responder_get_domain_by_id(pac_ctx->rctx, msid_str, &group_dom);
2fc102
         if (ret == EOK) {
2fc102
             ret = sysdb_search_object_by_sid(mem_ctx, group_dom->sysdb,
2fc102
-                                             group_dom, sid_str, NULL, &msg;;
2fc102
+                                             group_dom, msid_str, NULL, &msg;;
2fc102
             if (ret == EOK && msg->count == 1 ) {
2fc102
                 value.ul = ldb_msg_find_attr_as_uint64(msg->msgs[0],
2fc102
                                                        SYSDB_GIDNUM, 0);
2fc102
@@ -257,14 +256,13 @@ errno_t get_sids_from_pac(TALLOC_CTX *mem_ctx,
2fc102
         }
2fc102
 
2fc102
         ret = hash_enter(sid_table, &key, &value);
2fc102
+        sss_idmap_free_sid(pac_ctx->idmap_ctx, msid_str);
2fc102
         if (ret != HASH_SUCCESS) {
2fc102
             DEBUG(SSSDBG_OP_FAILURE, ("hash_enter failed [%d][%s].\n",
2fc102
                                       ret, hash_error_string(ret)));
2fc102
             ret = EIO;
2fc102
             goto done;
2fc102
         }
2fc102
-
2fc102
-        sss_idmap_free_sid(pac_ctx->idmap_ctx, sid_str);
2fc102
     }
2fc102
 
2fc102
     ret = EOK;
2fc102
-- 
2fc102
1.8.4.2
2fc102