[Freeipa-devel] [PATCH 0107] Don't fail if idnsSOAserial attribute is missing in LDAP
Adam Tkac
atkac at redhat.com
Mon Jan 14 14:17:35 UTC 2013
On Fri, Jan 11, 2013 at 06:47:52PM +0100, Petr Spacek wrote:
> Hello,
>
> Don't fail if idnsSOAserial attribute is missing in LDAP.
>
> DNS zones created on remote IPA 3.0 server don't have
> idnsSOAserial attribute present in LDAP.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=894131
>
>
> Attached patch contains the minimal set of changes need for resurrecting BIND.
>
> In configurations with serial auto-increment:
> - enabled (IPA 3.0+ default) - some new serial is written back to
> LDAP nearly immediately
> - disabled - the attribute will be missing forever
Ack
> From 958f46a5ceee336e2466686bafbb203082e2ccc1 Mon Sep 17 00:00:00 2001
> From: Petr Spacek <pspacek at redhat.com>
> Date: Fri, 11 Jan 2013 17:30:03 +0100
> Subject: [PATCH] Don't fail if idnsSOAserial attribute is missing in LDAP.
>
> DNS zones created on remote IPA 3.0 server don't have
> idnsSOAserial attribute present in LDAP.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=894131
>
> Signed-off-by: Petr Spacek <pspacek at redhat.com>
> ---
> src/ldap_entry.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/src/ldap_entry.c b/src/ldap_entry.c
> index 1e165ca696ccafa177f17b97bda08ed9cc344c7d..52b927d410300eb6df98ea058c3a08b426d66a70 100644
> --- a/src/ldap_entry.c
> +++ b/src/ldap_entry.c
> @@ -350,8 +350,9 @@ ldap_entry_getfakesoa(ldap_entry_t *entry, const ld_string_t *fake_mname,
> ldap_valuelist_t values;
> int i = 0;
>
> + const char *soa_serial_attr = "idnsSOAserial";
> const char *soa_attrs[] = {
> - "idnsSOAmName", "idnsSOArName", "idnsSOAserial",
> + "idnsSOAmName", "idnsSOArName", soa_serial_attr,
> "idnsSOArefresh", "idnsSOAretry", "idnsSOAexpire",
> "idnsSOAminimum", NULL
> };
> @@ -366,12 +367,25 @@ ldap_entry_getfakesoa(ldap_entry_t *entry, const ld_string_t *fake_mname,
> CHECK(str_cat_char(target, " "));
> }
> for (; soa_attrs[i] != NULL; i++) {
> - CHECK(ldap_entry_getvalues(entry, soa_attrs[i], &values));
> + result = ldap_entry_getvalues(entry, soa_attrs[i], &values);
> + /** Workaround for
> + * https://bugzilla.redhat.com/show_bug.cgi?id=894131
> + * DNS zones created on remote IPA 3.0 server don't have
> + * idnsSOAserial attribute present in LDAP. */
> + if (result == ISC_R_NOTFOUND
> + && soa_attrs[i] == soa_serial_attr) {
> + /* idnsSOAserial is missing! Read it as 1. */
> + CHECK(str_cat_char(target, "1 "));
> + continue;
> + } else if (result != ISC_R_SUCCESS)
> + goto cleanup;
> +
> CHECK(str_cat_char(target, HEAD(values)->value));
> CHECK(str_cat_char(target, " "));
> }
>
> cleanup:
> + /* TODO: check for memory leaks */
> return result;
> }
>
> --
> 1.7.11.7
>
--
Adam Tkac, Red Hat, Inc.
More information about the Freeipa-devel
mailing list