diff --git a/bind-9.4.0-zone-freeze.patch b/bind-9.4.0-zone-freeze.patch index 3091d72..d782c7a 100644 --- a/bind-9.4.0-zone-freeze.patch +++ b/bind-9.4.0-zone-freeze.patch @@ -1,41 +1,97 @@ ---- bind-9.4.0/lib/dns/view.c.freeze 2007-04-24 12:35:03.000000000 +0200 -+++ bind-9.4.0/lib/dns/view.c 2007-04-24 12:52:02.000000000 +0200 -@@ -1140,6 +1140,32 @@ +Index: bind9/bin/named/server.c +diff -u bind9/bin/named/server.c:1.483 bind9/bin/named/server.c:1.483.10.1 +--- bind9/bin/named/server.c:1.483 Tue Apr 24 06:55:32 2007 ++++ bind9/bin/named/server.c Mon May 14 05:46:56 2007 +@@ -4124,23 +4124,28 @@ + result = dns_rdataclass_fromtext(&rdclass, &r); + if (result != ISC_R_SUCCESS) + goto fail1; +- } else { ++ } else + rdclass = dns_rdataclass_in; +- } + +- if (viewtxt == NULL) +- viewtxt = "_default"; +- result = dns_viewlist_find(&server->viewlist, viewtxt, +- rdclass, &view); +- if (result != ISC_R_SUCCESS) +- goto fail1; ++ if (viewtxt == NULL) { ++ result = dns_viewlist_findzone(&server->viewlist, ++ dns_fixedname_name(&name), ++ ISC_TF(classtxt == NULL), ++ rdclass, zonep); ++ } else { ++ result = dns_viewlist_find(&server->viewlist, viewtxt, ++ rdclass, &view); ++ if (result != ISC_R_SUCCESS) ++ goto fail1; + +- result = dns_zt_find(view->zonetable, dns_fixedname_name(&name), +- 0, NULL, zonep); ++ result = dns_zt_find(view->zonetable, dns_fixedname_name(&name), ++ 0, NULL, zonep); ++ dns_view_detach(&view); ++ } ++ + /* Partial match? */ + if (result != ISC_R_SUCCESS && *zonep != NULL) + dns_zone_detach(zonep); +- dns_view_detach(&view); + fail1: + return (result); + } +Index: bind9/lib/dns/view.c +diff -u bind9/lib/dns/view.c:1.141 bind9/lib/dns/view.c:1.141.18.1 +--- bind9/lib/dns/view.c:1.141 Thu Mar 29 06:36:30 2007 ++++ bind9/lib/dns/view.c Mon May 14 05:46:57 2007 +@@ -1147,6 +1147,40 @@ } isc_result_t -+dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allclasses, -+ dns_rdataclass_t rdclass, dns_zone_t **zonep) ++dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, ++ isc_boolean_t allclasses, dns_rdataclass_t rdclass, ++ dns_zone_t **zonep) +{ + dns_view_t *view; + isc_result_t result; -+ isc_boolean_t match = isc_boolean_false; ++ dns_zone_t *zone1 = NULL, *zone2 = NULL; + + REQUIRE(list != NULL); -+ + for (view = ISC_LIST_HEAD(*list); + view != NULL; + view = ISC_LIST_NEXT(view, link)) { -+ if (allclasses == isc_boolean_false && view->rdclass != rdclass ) ++ if (allclasses == ISC_FALSE && view->rdclass != rdclass) + continue; -+ result = dns_zt_find(view->zonetable, name, -+ 0, NULL, zonep); -+ if(result == ISC_R_SUCCESS) { -+ if (match != isc_boolean_false) -+ return ISC_R_NOTFOUND; -+ match = isc_boolean_true; ++ result = dns_zt_find(view->zonetable, name, 0, NULL, ++ (zone1 == NULL) ? &zone1 : &zone2); ++ INSIST(result == ISC_R_SUCCESS || result == ISC_R_NOTFOUND); ++ if (zone2 != NULL) { ++ dns_zone_detach(&zone1); ++ dns_zone_detach(&zone2); ++ return (ISC_R_NOTFOUND); + } + } -+ return (match == isc_boolean_false) ? ISC_R_NOTFOUND : ISC_R_SUCCESS; ++ ++ if (zone1 != NULL) { ++ dns_zone_attach(zone1, zonep); ++ dns_zone_detach(&zone1); ++ return (ISC_R_SUCCESS); ++ } ++ ++ return (ISC_R_NOTFOUND); +} + +isc_result_t dns_view_load(dns_view_t *view, isc_boolean_t stop) { REQUIRE(DNS_VIEW_VALID(view)); ---- bind-9.4.0/lib/dns/include/dns/view.h.freeze 2007-04-24 12:35:03.000000000 +0200 -+++ bind-9.4.0/lib/dns/include/dns/view.h 2007-04-24 12:35:03.000000000 +0200 -@@ -592,6 +592,19 @@ +Index: bind9/lib/dns/include/dns/view.h +diff -u bind9/lib/dns/include/dns/view.h:1.105 bind9/lib/dns/include/dns/view.h:1.105.16.1 +--- bind9/lib/dns/include/dns/view.h:1.105 Thu Mar 29 23:47:04 2007 ++++ bind9/lib/dns/include/dns/view.h Mon May 14 05:46:57 2007 +@@ -595,6 +595,19 @@ */ isc_result_t @@ -55,76 +111,3 @@ dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep); /*%< * Search for the zone 'name' in the zone table of 'view'. ---- bind-9.4.0/bin/named/server.c.freeze 2007-04-24 12:35:03.000000000 +0200 -+++ bind-9.4.0/bin/named/server.c 2007-04-24 12:35:03.000000000 +0200 -@@ -3922,19 +3922,24 @@ - rdclass = dns_rdataclass_in; - } - -- if (viewtxt == NULL) -- viewtxt = "_default"; -- result = dns_viewlist_find(&server->viewlist, viewtxt, -- rdclass, &view); -- if (result != ISC_R_SUCCESS) -- goto fail1; -+ if (viewtxt == NULL) { -+ result = dns_viewlist_findzone(&server->viewlist, dns_fixedname_name(&name), -+ (classtxt == NULL) ? isc_boolean_true : isc_boolean_false, -+ rdclass, zonep); -+ } -+ else { -+ result = dns_viewlist_find(&server->viewlist, viewtxt, -+ rdclass, &view); -+ if (result != ISC_R_SUCCESS) -+ goto fail1; - -- result = dns_zt_find(view->zonetable, dns_fixedname_name(&name), -- 0, NULL, zonep); -+ result = dns_zt_find(view->zonetable, dns_fixedname_name(&name), -+ 0, NULL, zonep); -+ dns_view_detach(&view); -+ } - /* Partial match? */ - if (result != ISC_R_SUCCESS && *zonep != NULL) - dns_zone_detach(zonep); -- dns_view_detach(&view); - fail1: - return (result); - } ---- bind-9.4.0/bin/named_sdb/server.c.freeze 2007-04-24 12:35:03.000000000 +0200 -+++ bind-9.4.0/bin/named_sdb/server.c 2007-04-24 12:35:03.000000000 +0200 -@@ -3917,19 +3917,24 @@ - rdclass = dns_rdataclass_in; - } - -- if (viewtxt == NULL) -- viewtxt = "_default"; -- result = dns_viewlist_find(&server->viewlist, viewtxt, -- rdclass, &view); -- if (result != ISC_R_SUCCESS) -- goto fail1; -- -- result = dns_zt_find(view->zonetable, dns_fixedname_name(&name), -- 0, NULL, zonep); -+ if (viewtxt == NULL) { -+ result = dns_viewlist_findzone(&server->viewlist, dns_fixedname_name(&name), -+ (classtxt == NULL) ? isc_boolean_true : isc_boolean_false, -+ rdclass, zonep); -+ } -+ else { -+ result = dns_viewlist_find(&server->viewlist, viewtxt, -+ rdclass, &view); -+ if (result != ISC_R_SUCCESS) -+ goto fail1; -+ -+ result = dns_zt_find(view->zonetable, dns_fixedname_name(&name), -+ 0, NULL, zonep); -+ dns_view_detach(&view); -+ } - /* Partial match? */ - if (result != ISC_R_SUCCESS && *zonep != NULL) - dns_zone_detach(zonep); -- dns_view_detach(&view); - fail1: - return (result); - } diff --git a/bind-9.4.1-ldap-new-api.patch b/bind-9.4.1-ldap-new-api.patch new file mode 100644 index 0000000..66412af --- /dev/null +++ b/bind-9.4.1-ldap-new-api.patch @@ -0,0 +1,351 @@ +--- bind-9.4.1/contrib/sdb/ldap/ldapdb.c.new-api 2004-08-27 02:10:25.000000000 +0200 ++++ bind-9.4.1/contrib/sdb/ldap/ldapdb.c 2007-05-21 15:22:10.000000000 +0200 +@@ -58,9 +58,13 @@ + static dns_sdbimplementation_t *ldapdb = NULL; + + struct ldapdb_data { ++#if LDAP_API_VERSION >= 3001 ++ LDAPURLDesc *lud; ++#else + char *hostport; + char *hostname; + int portno; ++#endif + char *base; + int defaultttl; + char *filterall; +@@ -135,7 +139,11 @@ ldapdb_getconn(struct ldapdb_data *data) + conndata = threaddata->data; + free(conndata->index); + if (conndata->data != NULL) ++#if LDAP_API_VERSION < 3001 + ldap_unbind((LDAP *)conndata->data); ++#else ++ ldap_unbind_ext((LDAP *)conndata->data, NULL, NULL); ++#endif + threaddata->data = conndata->next; + free(conndata); + } +@@ -172,14 +180,14 @@ ldapdb_getconn(struct ldapdb_data *data) + /* threaddata points at the connection list for current thread */ + /* look for existing connection to our server */ + conndata = ldapdb_find((struct ldapdb_entry *)threaddata->data, +- data->hostport, strlen(data->hostport)); ++ data->lud->lud_host, strlen(data->lud->lud_host)); + if (conndata == NULL) { + /* no connection data structure for this server, create one */ + conndata = malloc(sizeof(*conndata)); + if (conndata == NULL) + return (NULL); +- conndata->index = data->hostport; +- conndata->size = strlen(data->hostport); ++ conndata->index = data->lud->lud_host; ++ conndata->size = strlen(data->lud->lud_host); + conndata->data = NULL; + ldapdb_insert((struct ldapdb_entry **)&threaddata->data, + conndata); +@@ -196,9 +204,15 @@ ldapdb_bind(struct ldapdb_data *data, LD + #endif + + if (*ldp != NULL) ++#if LDAP_API_VERSION < 3001 + ldap_unbind(*ldp); + *ldp = ldap_open(data->hostname, data->portno); + if (*ldp == NULL) ++#else ++ ldap_unbind_ext (*ldp, NULL, NULL); ++ int res = ldap_initialize(ldp, ldap_url_desc2str(data->lud)); ++ if (res != LDAP_SUCCESS) ++#endif + return; + + #ifndef LDAPDB_RFC1823API +@@ -211,8 +225,17 @@ ldapdb_bind(struct ldapdb_data *data, LD + } + #endif + ++#if LDAP_API_VERSION < 3001 + if (ldap_simple_bind_s(*ldp, data->bindname, data->bindpw) != LDAP_SUCCESS) { + ldap_unbind(*ldp); ++#else ++ struct berval ber; ++ ber.bv_val = data->bindpw; ++ ber.bv_len = (data->bindpw == NULL) ? 0 : strlen(data->bindpw); ++ ++ if (ldap_sasl_bind_s(*ldp, data->base, LDAP_SASL_SIMPLE, &ber, NULL, NULL, NULL) != LDAP_SUCCESS) { ++ ldap_unbind_ext(*ldp, NULL, NULL); ++#endif + *ldp = NULL; + } + } +@@ -224,14 +247,19 @@ ldapdb_search(const char *zone, const ch + isc_result_t result = ISC_R_NOTFOUND; + LDAP **ldp; + LDAPMessage *res, *e; +- char *fltr, *a, **vals = NULL, **names = NULL; ++ char *fltr, *a; ++#if LDAP_API_VERSION < 3001 ++ char **names, **vals; ++#else ++ struct berval **names, **vals; ++#endif + char type[64]; + #ifdef LDAPDB_RFC1823API + void *ptr; + #else + BerElement *ptr; + #endif +- int i, j, errno, msgid; ++ int i, j, errno, msgid, ldap_res; + + ldp = ldapdb_getconn(data); + if (ldp == NULL) +@@ -256,12 +284,21 @@ ldapdb_search(const char *zone, const ch + sprintf(data->filtername, "%s))", name); + fltr = data->filterone; + } +- ++#if LDAP_API_VERSION < 3001 + msgid = ldap_search(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0); ++#else ++ ldap_res = ldap_search_ext(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0, ++ NULL, NULL, NULL, 65535, &msgid); ++#endif + if (msgid == -1) { + ldapdb_bind(data, ldp); + if (*ldp != NULL) ++#if LDAP_API_VERSION < 3001 + msgid = ldap_search(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0); ++#else ++ ldap_res = ldap_search_ext(*ldp, data->base, LDAP_SCOPE_SUBTREE, fltr, NULL, 0, ++ NULL, NULL, NULL, 65535, &msgid); ++#endif + } + + if (*ldp == NULL || msgid == -1) { +@@ -293,15 +330,27 @@ ldapdb_search(const char *zone, const ch + } + + if (name == NULL) { ++#if LDAP_API_VERSION < 3001 + names = ldap_get_values(ld, e, "relativeDomainName"); ++#else ++ names = ldap_get_values_len(ld, e, "relativeDomainName"); ++#endif + if (names == NULL) + continue; + } +- ++#if LDAP_API_VERSION < 3001 + vals = ldap_get_values(ld, e, "dNSTTL"); ++#else ++ vals = ldap_get_values_len(ld, e, "dNSTTL"); ++#endif + if (vals != NULL) { ++#if LDAP_API_VERSION < 3001 + ttl = atoi(vals[0]); + ldap_value_free(vals); ++#else ++ ttl = atoi(vals[0]->bv_val); ++ ldap_value_free_len(vals); ++#endif + } + + for (a = ldap_first_attribute(ld, e, &ptr); a != NULL; a = ldap_next_attribute(ld, e, ptr)) { +@@ -319,34 +368,60 @@ ldapdb_search(const char *zone, const ch + + strncpy(type, a, s - a); + type[s - a] = '\0'; ++#if LDAP_API_VERSION < 3001 + vals = ldap_get_values(ld, e, a); ++#else ++ vals = ldap_get_values_len(ld, e, a); ++#endif + if (vals != NULL) { + for (i = 0; vals[i] != NULL; i++) { + if (name != NULL) { ++#if LDAP_API_VERSION < 3001 + result = dns_sdb_putrr(retdata, type, ttl, vals[i]); ++#else ++ result = dns_sdb_putrr(retdata, type, ttl, vals[i]->bv_val); ++#endif + } else { + for (j = 0; names[j] != NULL; j++) { ++#if LDAP_API_VERSION < 3001 + result = dns_sdb_putnamedrr(retdata, names[j], type, ttl, vals[i]); ++#else ++ result = dns_sdb_putnamedrr(retdata, names[j]->bv_val, type, ttl, vals[i]->bv_val); ++#endif + if (result != ISC_R_SUCCESS) + break; + } + } +-; if (result != ISC_R_SUCCESS) { ++ if (result != ISC_R_SUCCESS) { ++#if LDAP_API_VERSION < 3001 + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR, + "LDAP sdb zone '%s': dns_sdb_put... failed for %s", zone, vals[i]); + ldap_value_free(vals); ++#else ++ isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_ERROR, ++ "LDAP sdb zone '%s': dns_sdb_put... failed for %s", zone, vals[i]->bv_val); ++ ldap_value_free_len(vals); ++#endif + #ifndef LDAPDB_RFC1823API + ldap_memfree(a); + if (ptr != NULL) + ber_free(ptr, 0); + #endif + if (name == NULL) ++#if LDAP_API_VERSION < 3001 + ldap_value_free(names); ++#else ++ ldap_value_free_len(names); ++#endif + ldap_msgfree(res); + return (ISC_R_FAILURE); + } + } ++#if LDAP_API_VERSION < 3001 + ldap_value_free(vals); ++#else ++ ldap_value_free_len(vals); ++#endif + } + #ifndef LDAPDB_RFC1823API + ldap_memfree(a); +@@ -357,7 +432,11 @@ ldapdb_search(const char *zone, const ch + ber_free(ptr, 0); + #endif + if (name == NULL) ++#if LDAP_API_VERSION < 3001 + ldap_value_free(names); ++#else ++ ldap_value_free_len(names); ++#endif + + /* free this result */ + ldap_msgfree(res); +@@ -460,10 +539,15 @@ parseextensions(char *extensions, struct + static void + free_data(struct ldapdb_data *data) + { ++#if LDAP_API_VERSION < 3001 + if (data->hostport != NULL) + isc_mem_free(ns_g_mctx, data->hostport); + if (data->hostname != NULL) + isc_mem_free(ns_g_mctx, data->hostname); ++#else ++ if (data->lud != NULL) ++ ldap_free_urldesc(data->lud); ++#endif + if (data->filterall != NULL) + isc_mem_put(ns_g_mctx, data->filterall, data->filteralllen); + if (data->filterone != NULL) +@@ -478,7 +562,7 @@ ldapdb_create(const char *zone, int argc + { + struct ldapdb_data *data; + char *s, *filter = NULL, *extensions = NULL; +- int defaultttl; ++ int defaultttl, i; + + UNUSED(driverdata); + +@@ -486,7 +570,10 @@ ldapdb_create(const char *zone, int argc + /* want to do this only once for all instances */ + + if ((argc < 2) ++#if LDAP_API_VERSION < 3001 ++ /* Could be ldap[is]:// */ + || (argv[0] != strstr( argv[0], "ldap://")) ++#endif + || ((defaultttl = atoi(argv[1])) < 1)) + return (ISC_R_FAILURE); + data = isc_mem_get(ns_g_mctx, sizeof(struct ldapdb_data)); +@@ -494,14 +581,15 @@ ldapdb_create(const char *zone, int argc + return (ISC_R_NOMEMORY); + + memset(data, 0, sizeof(struct ldapdb_data)); ++ ++ data->defaultttl = defaultttl; ++#if LDAP_API_VERSION < 3001 + data->hostport = isc_mem_strdup(ns_g_mctx, argv[0] + strlen("ldap://")); + if (data->hostport == NULL) { + free_data(data); + return (ISC_R_NOMEMORY); + } + +- data->defaultttl = defaultttl; +- + s = strchr(data->hostport, '/'); + if (s != NULL) { + *s++ = '\0'; +@@ -544,11 +632,26 @@ ldapdb_create(const char *zone, int argc + } + } + ++#else ++ if (ldap_url_parse (argv[0], &data->lud) != LDAP_URL_SUCCESS) { ++ free_data (data); ++ return (ISC_R_FAILURE); ++ } ++ ++ data->base = data->lud->lud_dn; ++ ++ for (i = 0; data->lud->lud_exts[i] != NULL; i++) { ++ extensions = strdup (data->lud->lud_exts[i]); ++#endif ++ + /* parse extensions */ + if (extensions != NULL) { + int err; + + err = parseextensions(extensions, data); ++#if LDAP_API_VERSION >= 3001 ++ free (extensions); ++#endif + if (err < 0) { + /* err should be -1 or -2 */ + free_data(data); +@@ -562,6 +665,14 @@ ldapdb_create(const char *zone, int argc + return (ISC_R_FAILURE); + } + } ++#if LDAP_API_VERSION >= 3001 ++ else { ++ free_data (data); ++ return (ISC_R_NOMEMORY); ++ } ++ } ++ filter = data->lud->lud_filter; ++#else + + if ((data->base != NULL && unhex(data->base) == NULL) || + (filter != NULL && unhex(filter) == NULL) || +@@ -572,6 +683,7 @@ ldapdb_create(const char *zone, int argc + "LDAP sdb zone '%s': URL: bad hex values", zone); + return (ISC_R_FAILURE); + } ++#endif + + /* compute filterall and filterone once and for all */ + if (filter == NULL) { +@@ -602,6 +714,7 @@ ldapdb_create(const char *zone, int argc + } + data->filtername = data->filterone + strlen(data->filterone); + ++#if LDAP_API_VERSION < 3001 + /* support URLs with literal IPv6 addresses */ + data->hostname = isc_mem_strdup(ns_g_mctx, data->hostport + (*data->hostport == '[' ? 1 : 0)); + if (data->hostname == NULL) { +@@ -620,8 +733,10 @@ ldapdb_create(const char *zone, int argc + data->portno = atoi(s); + } else + data->portno = LDAP_PORT; ++#endif + + *dbdata = data; ++ + return (ISC_R_SUCCESS); + } + diff --git a/bind.spec b/bind.spec index e88b789..15a3780 100644 --- a/bind.spec +++ b/bind.spec @@ -17,7 +17,7 @@ Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) serv Name: bind License: BSD-like Version: 9.4.1 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 31 Url: http://www.isc.org/products/BIND/ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -83,6 +83,7 @@ Patch65: bind-9.4.0-dig-idn.patch %endif Patch66: bind-9.4.0-zone-freeze.patch Patch67: bind-9.4.0-dbus-race-condition.patch +Patch68: bind-9.4.1-ldap-new-api.patch # Requires: bind-libs = %{epoch}:%{version}-%{release}, glibc >= 2.2, mktemp Requires(post): grep, chkconfig >= 1.3.26 @@ -246,6 +247,7 @@ BIND's idn implementation libraries %if %{SDB} %patch11 -p1 -b .sdbsrc %patch61 -p1 -b .sdb-sqlite-src +%patch68 -p1 -b .new-api # BUILD 'Simplified Database Backend' (SDB) version of named: named_sdb cp -rfp bin/named bin/named_sdb # SDB ldap @@ -808,8 +810,10 @@ rm -rf ${RPM_BUILD_ROOT} %changelog -* Tue May 15 2007 Adam Tkac 31:9.4.1-3.fc7 +* Tue May 22 2007 Adam Tkac 31:9.4.1-3.fc7 - fixed bind-chroot-admin dynamic DNS handling (#239149) +- updated zone-freeze patch to latest upstream +- ldap sdb has been rewriten to latest api (#239802) * Mon May 07 2007 Adam Tkac 31:9.4.1-2.fc7 - test build on new build system