From a9105855d34d4130caf67d5e0bc00e09babc04d3 Mon Sep 17 00:00:00 2001 From: Bert Hubert Date: Sat, 30 Aug 2003 11:55:37 +0000 Subject: [PATCH] ldap work git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@182 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- ChangeLog | 4 + modules/gmysqlbackend/Makefile.in | 357 -------------------------- modules/ldapbackend/ldapbackend.cc | 190 +++++--------- modules/ldapbackend/ldapbackend.hh | 6 +- modules/xdbbackend/Makefile.in | 395 ----------------------------- 5 files changed, 66 insertions(+), 886 deletions(-) delete mode 100644 modules/gmysqlbackend/Makefile.in delete mode 100644 modules/xdbbackend/Makefile.in diff --git a/ChangeLog b/ChangeLog index 0589048ae..524d9c67b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +changes since 2.9.11: + - ldap updates + no longer sends entire reverse zone with AXFR + changes since 2.9.10: - pdns_recursor now cleans its cache - pdns_recursor writes its pid to disk now (FreeBSD port maintainer) diff --git a/modules/gmysqlbackend/Makefile.in b/modules/gmysqlbackend/Makefile.in deleted file mode 100644 index c3d28c4d7..000000000 --- a/modules/gmysqlbackend/Makefile.in +++ /dev/null @@ -1,357 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DYNLINKFLAGS = @DYNLINKFLAGS@ -ECHO = @ECHO@ -EXEEXT = @EXEEXT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LEX = @LEX@ -LIBDL = @LIBDL@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MYSQL_incdir = @MYSQL_incdir@ -MYSQL_lib = @MYSQL_lib@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PGSQL_incdir = @PGSQL_incdir@ -PGSQL_lib = @PGSQL_lib@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -THREADFLAGS = @THREADFLAGS@ -VERSION = @VERSION@ -YACC = @YACC@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ -moduledirs = @moduledirs@ -modulelibs = @modulelibs@ -moduleobjects = @moduleobjects@ -programdescend = @programdescend@ -socketdir = @socketdir@ - -lib_LTLIBRARIES = libgmysqlbackend.la - -EXTRA_DIST = OBJECTFILES OBJECTLIBS - -INCLUDES = -I@MYSQL_incdir@ - -libgmysqlbackend_la_SOURCES = gmysqlbackend.cc gmysqlbackend.hh \ - smysql.hh smysql.cc - - -libgmysqlbackend_la_LDFLAGS = -module -lmysqlclient -subdir = modules/gmysqlbackend -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(lib_LTLIBRARIES) - -libgmysqlbackend_la_LIBADD = -am_libgmysqlbackend_la_OBJECTS = gmysqlbackend.lo smysql.lo -libgmysqlbackend_la_OBJECTS = $(am_libgmysqlbackend_la_OBJECTS) - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/gmysqlbackend.Plo $(DEPDIR)/smysql.Plo -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CXXFLAGS = @CXXFLAGS@ -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libgmysqlbackend_la_SOURCES) -DIST_COMMON = INSTALL Makefile.am Makefile.in -SOURCES = $(libgmysqlbackend_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .lo .o .obj - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign modules/gmysqlbackend/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) -libgmysqlbackend.la: $(libgmysqlbackend_la_OBJECTS) $(libgmysqlbackend_la_DEPENDENCIES) - $(CXXLINK) -rpath $(libdir) $(libgmysqlbackend_la_LDFLAGS) $(libgmysqlbackend_la_OBJECTS) $(libgmysqlbackend_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gmysqlbackend.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/smysql.Plo@am__quote@ - -distclean-depend: - -rm -rf $(DEPDIR) - -.cc.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< - -.cc.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CXXCOMPILE) -c -o $@ `cygpath -w $<` - -.cc.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -CXXDEPMODE = @CXXDEPMODE@ -uninstall-info-am: - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-libLTLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES - -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool distclean distclean-compile \ - distclean-depend distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am \ - install-libLTLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool tags uninstall \ - uninstall-am uninstall-info-am uninstall-libLTLIBRARIES - - -# -Wl,-Bstatic -lpq++ -lpq -Wl,-Bdynamic -lssl -lcrypt -lcrypto -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/modules/ldapbackend/ldapbackend.cc b/modules/ldapbackend/ldapbackend.cc index 657ebaea5..fe2a41f80 100644 --- a/modules/ldapbackend/ldapbackend.cc +++ b/modules/ldapbackend/ldapbackend.cc @@ -83,24 +83,12 @@ bool LdapBackend::list( const string &target, int domain_id ) return false; } - if( m_result.empty() ) + if( m_result.empty() || m_result.find( "dn" ) == m_result.end() || m_result["dn"].empty() ) { L << Logger::Error << backendname << " No SOA record for " << target << endl; return false; } - if( m_result.find( "dn" ) == m_result.end() ) - { - L << Logger::Error << backendname << " LDAP error while searching SOA record for " << target << endl; - return false; - } - - if( m_result["dn"].empty() ) - { - L << Logger::Error << backendname << " LDAP error while getting SOA record for " << target << endl; - return false; - } - dn = m_result["dn"].front(); m_result.clear(); @@ -108,7 +96,7 @@ bool LdapBackend::list( const string &target, int domain_id ) m_qname = ""; m_adomain = m_adomains.end(); // skip loops in get() first time - filter = "(&(associatedDomain=*)(!(SOARecord=*)))"; + filter = "(&(associatedDomain=*" + target + ")(!(SOARecord=*)))"; m_msgid = m_pldap->search( dn, LDAP_SCOPE_ONELEVEL, filter, (const char**) attrany ); } catch( LDAPException &le ) @@ -151,37 +139,15 @@ void LdapBackend::lookup( const QType &qtype, const string &qname, DNSPacket *dn len = qesc.length(); stringtok( parts, qesc, "." ); - if( len > 13 && qesc.substr( len - 13, 13 ) == ".in-addr.arpa" ) // IPv4 reverse lookups + if( parts.size() == 6 && len > 13 && qesc.substr( len - 13, 13 ) == ".in-addr.arpa" ) // IPv4 reverse lookups { - parts.pop_back(); - parts.pop_back(); - - filter = "(aRecord=" + parts.back(); - parts.pop_back(); - while( !parts.empty() ) - { - filter += "." + parts.back(); - parts.pop_back(); - } - filter += ")"; - + filter = name2filter( parts, "aRecord", "." ); attronly[0] = "associatedDomain"; attributes = attronly; } - else if( len > 9 && ( qesc.substr( len - 8, 8 ) == ".ip6.int" || qesc.substr( len - 9, 9 ) == ".ip6.arpa" ) ) // IPv6 reverse lookups + else if( parts.size() == 10 && len > 9 && ( qesc.substr( len - 8, 8 ) == ".ip6.int" ) ) // IPv6 reverse lookups { - parts.pop_back(); - parts.pop_back(); - - filter = "(aAAARecord=" + parts.back(); - parts.pop_back(); - while( !parts.empty() ) - { - filter += ":" + parts.back(); - parts.pop_back(); - } - filter += ")"; - + filter = name2filter( parts, "aAAARecord", ":" ); attronly[0] = "associatedDomain"; attributes = attronly; } @@ -242,61 +208,56 @@ bool LdapBackend::get( DNSResourceRecord &rr ) { do { - do + while( m_adomain != m_adomains.end() ) { - while( m_adomain != m_adomains.end() ) + while( m_attribute != m_result.end() ) { - while( m_attribute != m_result.end() ) + attrname = m_attribute->first; + qstr = attrname.substr( 0, attrname.length() - 6 ); // extract qtype string from ldap attribute name + transform( qstr.begin(), qstr.end(), qstr.begin(), &Toupper ); + qt = QType( const_cast(qstr.c_str()) ); + + while( m_value != m_attribute->second.end() ) { - attrname = m_attribute->first; - qstr = attrname.substr( 0, attrname.length() - 6 ); // extract qtype string from ldap attribute name - transform( qstr.begin(), qstr.end(), qstr.begin(), &Toupper ); - qt = QType( const_cast(qstr.c_str()) ); + content = *m_value; - while( m_value != m_attribute->second.end() ) - { - content = *m_value; + rr.qtype = qt; + rr.qname = *m_adomain; + rr.priority = 0; + rr.ttl = m_ttl; - rr.qtype = qt; - rr.qname = *m_adomain; - rr.priority = 0; - rr.ttl = m_ttl; + if( qt.getCode() == QType::MX ) // MX Record, e.g. 10 smtp.example.com + { + parts.clear(); + stringtok( parts, content, " " ); - if( qt.getCode() == QType::MX ) // MX Record, e.g. 10 smtp.example.com + if( parts.size() != 2) { - parts.clear(); - stringtok( parts, content, " " ); - - if( parts.size() != 2) - { - L << Logger::Warning << backendname << " Invalid MX record without priority: " << content << endl; - continue; - } - - rr.priority = (u_int16_t) strtol( parts[0].c_str(), NULL, 10 ); - content = parts[1]; + L << Logger::Warning << backendname << " Invalid MX record without priority: " << content << endl; + continue; } - rr.content = content; - m_value++; - - L << Logger::Info << backendname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", content: " << rr.content << endl; - return true; + rr.priority = (u_int16_t) strtol( parts[0].c_str(), NULL, 10 ); + content = parts[1]; } - m_attribute++; - m_value = m_attribute->second.begin(); + rr.content = content; + m_value++; + + L << Logger::Info << backendname << " Record = qname: " << rr.qname << ", qtype: " << (rr.qtype).getName() << ", priority: " << rr.priority << ", content: " << rr.content << endl; + return true; } - m_adomain++; - m_attribute = m_result.begin(); + + m_attribute++; m_value = m_attribute->second.begin(); } + m_adomain++; + m_attribute = m_result.begin(); + m_value = m_attribute->second.begin(); } - while( !m_adomains.empty() && m_qname.empty() && mustDo( "disable-ptrrecord" ) && makePtrRecords() ); // make PTR records from associatedDomain entries - m_result.clear(); } - while( m_pldap->getSearchEntry( m_msgid, m_result, false ) && prepSearchEntry() ); + while( m_pldap->getSearchEntry( m_msgid, m_result, false ) && prepareEntry() ); } catch( LDAPException &le ) @@ -316,7 +277,26 @@ bool LdapBackend::get( DNSResourceRecord &rr ) } -inline bool LdapBackend::prepSearchEntry() +inline string LdapBackend::name2filter( vector& parts, string record, string separator ) +{ + string filter; + parts.pop_back(); + parts.pop_back(); + + filter = "(" + record + "=" + parts.back(); + parts.pop_back(); + while( !parts.empty() ) + { + filter += separator + parts.back(); + parts.pop_back(); + } + filter += ")"; + + return filter; +} + + +inline bool LdapBackend::prepareEntry() { m_adomains.clear(); m_ttl = m_default_ttl; @@ -353,58 +333,6 @@ inline bool LdapBackend::prepSearchEntry() } -inline bool LdapBackend::makePtrRecords() -{ - unsigned int i = 0; - string ptrsrc; - vector parts, tmp; - vector::iterator record; - char* attr[] = { "aRecord", "aAAARecord", NULL }; - char* suffix[] = { ".in-addr.arpa", ".ip6.int", NULL }; - char* seperator[] = { ".", ":", NULL }; - - - tmp = m_adomains; - m_adomains.clear(); - - while( attr[i] != NULL && m_result.find( attr[i] ) != m_result.end() ) - { - for( record = m_result[attr[i]].begin(); record != m_result[attr[i]].end(); record++ ) - { - parts.clear(); - stringtok( parts, *record, seperator[i] ); - - ptrsrc = parts.back(); - parts.pop_back(); - while( !parts.empty() ) - { - ptrsrc += "." + parts.back(); - parts.pop_back(); - } - ptrsrc += suffix[i]; - - m_adomains.push_back( ptrsrc ); - } - - i++; - } - - if( m_adomains.empty() ) - { - return false; - } - - m_result.clear(); - m_result["PTRRecord"] = tmp; - m_adomain = m_adomains.begin(); - m_attribute = m_result.begin(); - m_value = m_attribute->second.begin(); - - return true; -} - - - class LdapFactory : public BackendFactory { diff --git a/modules/ldapbackend/ldapbackend.hh b/modules/ldapbackend/ldapbackend.hh index d007b50fe..b03a3ecc9 100644 --- a/modules/ldapbackend/ldapbackend.hh +++ b/modules/ldapbackend/ldapbackend.hh @@ -74,16 +74,16 @@ private: int m_msgid; u_int32_t m_ttl; u_int32_t m_default_ttl; - QType m_qtype; string m_qname; + QType m_qtype; PowerLDAP* m_pldap; PowerLDAP::sentry_t m_result; PowerLDAP::sentry_t::iterator m_attribute; vector::iterator m_value, m_adomain; vector m_adomains; - bool prepSearchEntry(); - bool makePtrRecords(); + bool prepareEntry(); + string name2filter( vector& parts, string record, string separator ); public: diff --git a/modules/xdbbackend/Makefile.in b/modules/xdbbackend/Makefile.in deleted file mode 100644 index 94d68c65c..000000000 --- a/modules/xdbbackend/Makefile.in +++ /dev/null @@ -1,395 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DYNLINKFLAGS = @DYNLINKFLAGS@ -ECHO = @ECHO@ -EXEEXT = @EXEEXT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LEX = @LEX@ -LIBDL = @LIBDL@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -MYSQL_incdir = @MYSQL_incdir@ -MYSQL_lib = @MYSQL_lib@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PGSQL_incdir = @PGSQL_incdir@ -PGSQL_lib = @PGSQL_lib@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -THREADFLAGS = @THREADFLAGS@ -VERSION = @VERSION@ -YACC = @YACC@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ -moduledirs = @moduledirs@ -modulelibs = @modulelibs@ -moduleobjects = @moduleobjects@ -programdescend = @programdescend@ -socketdir = @socketdir@ - -EXTRA_DIST = OBJECTFILES OBJECTLIBS -bin_PROGRAMS = xdb-fill - -lib_LTLIBRARIES = libxdbbackend.la - -libxdbbackend_la_SOURCES = xdbbackend.cc xtdb.cc xtdb.hh xdb.hh xgdbm.hh -libxdbbackend_la_LDFLAGS = -module -ltdb - -xdb_fill_SOURCES = xdb-fill.cc xtdb.cc xtdb.hh -xdb_fill_LDFLAGS = -ltdb -subdir = modules/xdbbackend -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(lib_LTLIBRARIES) - -libxdbbackend_la_LIBADD = -am_libxdbbackend_la_OBJECTS = xdbbackend.lo xtdb.lo -libxdbbackend_la_OBJECTS = $(am_libxdbbackend_la_OBJECTS) -bin_PROGRAMS = xdb-fill$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_xdb_fill_OBJECTS = xdb-fill.$(OBJEXT) xtdb.$(OBJEXT) -xdb_fill_OBJECTS = $(am_xdb_fill_OBJECTS) -xdb_fill_LDADD = $(LDADD) -xdb_fill_DEPENDENCIES = - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/xdb-fill.Po $(DEPDIR)/xdbbackend.Plo \ -@AMDEP_TRUE@ $(DEPDIR)/xtdb.Plo $(DEPDIR)/xtdb.Po -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CXXFLAGS = @CXXFLAGS@ -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libxdbbackend_la_SOURCES) $(xdb_fill_SOURCES) -DIST_COMMON = README Makefile.am Makefile.in -SOURCES = $(libxdbbackend_la_SOURCES) $(xdb_fill_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .cc .lo .o .obj - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign modules/xdbbackend/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) -libxdbbackend.la: $(libxdbbackend_la_OBJECTS) $(libxdbbackend_la_DEPENDENCIES) - $(CXXLINK) -rpath $(libdir) $(libxdbbackend_la_LDFLAGS) $(libxdbbackend_la_OBJECTS) $(libxdbbackend_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -xdb-fill$(EXEEXT): $(xdb_fill_OBJECTS) $(xdb_fill_DEPENDENCIES) - @rm -f xdb-fill$(EXEEXT) - $(CXXLINK) $(xdb_fill_LDFLAGS) $(xdb_fill_OBJECTS) $(xdb_fill_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xdb-fill.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xdbbackend.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xtdb.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/xtdb.Po@am__quote@ - -distclean-depend: - -rm -rf $(DEPDIR) - -.cc.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< - -.cc.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CXXCOMPILE) -c -o $@ `cygpath -w $<` - -.cc.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -CXXDEPMODE = @CXXDEPMODE@ -uninstall-info-am: - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) -install-binPROGRAMS: install-libLTLIBRARIES - - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS install-libLTLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ - uninstall-libLTLIBRARIES - -.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool distclean \ - distclean-compile distclean-depend distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-binPROGRAMS install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-libLTLIBRARIES install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am uninstall-libLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: -- 2.40.0