Re: [Freeipa-devel] [PATCH] ipa-kdb: Free talloc autofree context when module is closed

2013-02-14 Thread Martin Kosek
On 02/12/2013 08:52 AM, Martin Kosek wrote:
 On 02/11/2013 05:00 PM, Sumit Bose wrote:
 Hi,

 this patch should fix https://fedorahosted.org/freeipa/ticket/3410 . See
 commit message for details.

 bye,
 Sumit

 
 This fixed the ipa-kdb crashes for me, so ACK.
 
 Martin
 

Pushed to master, ipa-3-1.

Martin

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] ipa-kdb: Free talloc autofree context when module is closed

2013-02-11 Thread Sumit Bose
Hi,

this patch should fix https://fedorahosted.org/freeipa/ticket/3410 . See
commit message for details.

bye,
Sumit
From 4892c10b273119e20c536285663f1ded6b6ff3fe Mon Sep 17 00:00:00 2001
From: sbose sbose@ipa18-devel.ipa18.devel
Date: Mon, 11 Feb 2013 15:39:22 +0100
Subject: [PATCH] ipa-kdb: Free talloc autofree context when module is closed

Currently kdb5kdc crashes on exit if the ipadb KDB modules is loaded and trusts
are configured. The reason is the talloc autofree context which get initialised
during the ndr_push_union_blob() call. On exit the KDC module is unloaded an
later on atexit() tries to free the context, but all related symbols are
already unloaded with the module.

This patch frees the talloc autofree context during the cleanup routine of the
module. Since this is called only at exit and not during normal operations this
is safe even if other KDC plugins use the talloc autofree context, e.g. via
some Samba libraries, as well.

Fixes https://fedorahosted.org/freeipa/ticket/3410
---
 daemons/ipa-kdb/ipa_kdb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/daemons/ipa-kdb/ipa_kdb.c b/daemons/ipa-kdb/ipa_kdb.c
index 
3527cefa10df67d3f17c730ab4483410c736a44f..0b769f7ed76488c5febf9e610450815534398f4d
 100644
--- a/daemons/ipa-kdb/ipa_kdb.c
+++ b/daemons/ipa-kdb/ipa_kdb.c
@@ -20,6 +20,8 @@
  * along with this program.  If not, see http://www.gnu.org/licenses/.
  */
 
+#include talloc.h
+
 #include ipa_kdb.h
 
 struct ipadb_context *ipadb_get_context(krb5_context kcontext)
@@ -452,6 +454,7 @@ static krb5_error_code ipadb_fini_module(krb5_context 
kcontext)
 
 ipactx = ipadb_get_context(kcontext);
 ipadb_context_free(kcontext, ipactx);
+talloc_free(talloc_autofree_context());
 
 return 0;
 }
-- 
1.8.0.2

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel