From 17692501494e65d58e4fa8a9fa4851942decbba7 Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Fri, 29 May 2009 18:11:18 +0200 Subject: More compatibility fixes This will now compile and work fairly well on a RHEL5 system with the newest BIND (9.3.6-2.P1, some stuff is back-ported here). We added a compat.h header file which contains a replacement for two functions. We also did some ifdef-ing in acl.c. --- src/Makefile.am | 1 + src/acl.c | 12 +++++++++++ src/compat.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ldap_driver.c | 1 + 4 files changed, 73 insertions(+) create mode 100644 src/compat.h diff --git a/src/Makefile.am b/src/Makefile.am index 625d9da..e0df4f7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,6 +4,7 @@ bindplugindir=$(libdir)/bind HDRS = \ acl.h \ cache.h \ + compat.h \ krb5_helper.h \ ldap_convert.h \ ldap_helper.h \ diff --git a/src/acl.c b/src/acl.c index 5daf461..ae28b0c 100644 --- a/src/acl.c +++ b/src/acl.c @@ -202,14 +202,26 @@ get_match_type(const cfg_obj_t *obj) MATCH("subdomain", DNS_SSUMATCHTYPE_SUBDOMAIN); MATCH("wildcard", DNS_SSUMATCHTYPE_WILDCARD); MATCH("self", DNS_SSUMATCHTYPE_SELF); +#if defined(DNS_SSUMATCHTYPE_SELFSUB) && defined(DNS_SSUMATCHTYPE_SELFWILD) MATCH("selfsub", DNS_SSUMATCHTYPE_SELFSUB); MATCH("selfwild", DNS_SSUMATCHTYPE_SELFWILD); +#endif +#ifdef DNS_SSUMATCHTYPE_SELFMS MATCH("ms-self", DNS_SSUMATCHTYPE_SELFMS); +#endif +#ifdef DNS_SSUMATCHTYPE_SELFKRB5 MATCH("krb5-self", DNS_SSUMATCHTYPE_SELFKRB5); +#endif +#ifdef DNS_SSUMATCHTYPE_SUBDOMAINMS MATCH("ms-subdomain", DNS_SSUMATCHTYPE_SUBDOMAINMS); +#endif +#ifdef DNS_SSUMATCHTYPE_SUBDOMAINKRB5 MATCH("krb5-subdomain", DNS_SSUMATCHTYPE_SUBDOMAINKRB5); +#endif +#if defined(DNS_SSUMATCHTYPE_TCPSELF) && defined(DNS_SSUMATCHTYPE_6TO4SELF) MATCH("tcp-self", DNS_SSUMATCHTYPE_TCPSELF); MATCH("6to4-self", DNS_SSUMATCHTYPE_6TO4SELF); +#endif INSIST(0); /* Not reached. */ diff --git a/src/compat.h b/src/compat.h new file mode 100644 index 0000000..478788c --- /dev/null +++ b/src/compat.h @@ -0,0 +1,59 @@ +/* Authors: Martin Nagy + * + * Copyright (C) 2009 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 only + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include +#else +#error "Can't compile without config.h" +#endif + +/* + * dns_rdatalist_fromrdataset() did not exist in older versions of libdns. + * Add a substitude function here. + */ +#if LIBDNS_VERSION_MAJOR < 40 +static inline isc_result_t +dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, + dns_rdatalist_t **rdatalist) +{ + REQUIRE(rdatalist != NULL && rdataset != NULL); + + *rdatalist = rdataset->private1; + + return ISC_R_SUCCESS; +} +#endif /* LIBDNS_VERSION_MAJOR < 40 */ + +/* + * In older libdns versions, isc_refcount_init() was defined as a macro. + * However, in newer versions, it is a function returning isc_result_t type. + * This piece of code should take care of that problem. + */ +#if LIBDNS_VERSION_MAJOR < 30 +#include + +static inline isc_result_t +isc_refcount_init_func(isc_refcount_t *ref, unsigned int n) +{ + isc_refcount_init(ref, n); + return ISC_R_SUCCESS; +} +#undef isc_refcount_init +#define isc_refcount_init isc_refcount_init_func +#endif /* LIBDNS_VERSION_MAJOR < 30 */ diff --git a/src/ldap_driver.c b/src/ldap_driver.c index b8fd02c..c4ebed2 100644 --- a/src/ldap_driver.c +++ b/src/ldap_driver.c @@ -42,6 +42,7 @@ #include /* For memcpy */ #include "cache.h" +#include "compat.h" #include "ldap_helper.h" #include "log.h" #include "rdlist.h" -- cgit