On Thu, Jun 07, 2012 at 03:33:18PM +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.

Thanks, pushed to master.

> 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
> 


-- 
Adam Tkac, Red Hat, Inc.

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

Reply via email to