Re: [Freeipa-devel] [PATCH 0022] fix crash during zone unload when NS is not resolvable

2012-06-08 Thread Martin Kosek
On Thu, 2012-06-07 at 17:51 +0200, Adam Tkac wrote:
 On Thu, Jun 07, 2012 at 04:03:46PM +0200, Martin Kosek wrote:
  On Thu, 2012-06-07 at 15:33 +0200, Petr Spacek wrote:
   Hello,
   
   this patch fixes https://fedorahosted.org/bind-dyndb-ldap/ticket/77: 
   bind-dyndb-ldap crashes during zone unload when NS is not resolvable.
   
   During investigation I found other two suspicious places. This patch adds 
   only 
   comment near to them. Any changes (as necessary) will be in separate 
   patch.
   
   Petr^2 Spacek
  
  Thanks Petr for investigation and quick fix!
  
  Adam, if this pass your review, I think it would be great to have an F17
  build at least in koji so that we can switch psearch on by default so
  that other developers start testing it (with the new bind-dyndb-ldap
  build so that their unit tests do not crash named).
 
 The patch was ok and update has been submitted to bodhi. It should be in
 updates-testing very soon.
 
 Regards, Adam
 

Thanks a lot Adam! I tested the new bind-dyndb-ldap version and it fixed
the issue I found - karma++.

I sent a rebased patch to enable psearch in IPA by default - lets get it
grilled :-)

Martin

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


[Freeipa-devel] [PATCH 0022] fix crash during zone unload when NS is not resolvable

2012-06-07 Thread Petr Spacek

Hello,

this patch fixes https://fedorahosted.org/bind-dyndb-ldap/ticket/77: 
bind-dyndb-ldap crashes during zone unload when NS is not resolvable.


During investigation I found other two suspicious places. This patch adds only 
comment near to them. Any changes (as necessary) will be in separate patch.


Petr^2 Spacek
From 970984bc84556ac1355de9f67eb4de20c823f4ce Mon Sep 17 00:00:00 2001
From: Petr Spacek pspa...@redhat.com
Date: Thu, 7 Jun 2012 15:27:27 +0200
Subject: [PATCH] Fix crash during zone unload when NS is not resolvable.
 https://fedorahosted.org/bind-dyndb-ldap/ticket/77
 Signed-off-by: Petr Spacek pspa...@redhat.com

---
 src/ldap_helper.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 5965d30e51fa50fcb4b38d35e023a529fd6a121f..a1ef9a27e5d1b031a53e779d58b7490bd3d41d05 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -30,6 +30,7 @@
 #include dns/ttl.h
 #include dns/view.h
 #include dns/zone.h
+#include dns/db.h
 #include dns/zt.h
 #include dns/byaddr.h
 #include dns/forward.h
@@ -788,7 +789,12 @@ ldap_delete_zone2(ldap_instance_t *inst, dns_name_t *name, isc_boolean_t lock)
 		freeze = ISC_TRUE;
 	}
 
-	dns_zone_unload(zone);
+	/* Do not unload partially loaded zones, they have incomplete structures. */
+	dns_db_t *dbp = NULL;
+	if (dns_zone_getdb(zone,dbp) != DNS_R_NOTLOADED) {
+		dns_db_detach(dbp); /* dns_zone_getdb() attaches DB implicitly */
+		dns_zone_unload(zone);
+	}
 	CHECK(dns_zt_unmount(inst-view-zonetable, zone));
 	CHECK(zr_del_zone(inst-zone_register, name));
 	dns_zonemgr_releasezone(inst-zmgr, zone);
@@ -1013,7 +1019,7 @@ ldap_parse_zoneentry(ldap_entry_t *entry, ldap_instance_t *inst)
 
 	/* Check if we are already serving given zone */
 	result = zr_get_zone_ptr(inst-zone_register, name, zone);
-	if (result != ISC_R_SUCCESS) {
+	if (result != ISC_R_SUCCESS) { /* TODO: What about other errors? */
 		CHECK(create_zone(inst, name, zone));
 		CHECK(zr_add_zone(inst-zone_register, zone, dn));
 		publish = ISC_TRUE;
@@ -2760,6 +2766,7 @@ update_action(isc_task_t *task, isc_event_t *event)
 	mctx = pevent-mctx;
 
 	result = manager_get_ldap_instance(pevent-dbname, inst);
+	/* TODO: Can it happen? */
 	if (result != ISC_R_SUCCESS)
 		goto cleanup;
 
-- 
1.7.7.6

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

Re: [Freeipa-devel] [PATCH 0022] fix crash during zone unload when NS is not resolvable

2012-06-07 Thread Adam Tkac
On Thu, Jun 07, 2012 at 04:03:46PM +0200, Martin Kosek wrote:
 On Thu, 2012-06-07 at 15:33 +0200, Petr Spacek wrote:
  Hello,
  
  this patch fixes https://fedorahosted.org/bind-dyndb-ldap/ticket/77: 
  bind-dyndb-ldap crashes during zone unload when NS is not resolvable.
  
  During investigation I found other two suspicious places. This patch adds 
  only 
  comment near to them. Any changes (as necessary) will be in separate patch.
  
  Petr^2 Spacek
 
 Thanks Petr for investigation and quick fix!
 
 Adam, if this pass your review, I think it would be great to have an F17
 build at least in koji so that we can switch psearch on by default so
 that other developers start testing it (with the new bind-dyndb-ldap
 build so that their unit tests do not crash named).

The patch was ok and update has been submitted to bodhi. It should be in
updates-testing very soon.

Regards, Adam

-- 
Adam Tkac, Red Hat, Inc.

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