+++ /dev/null
-# 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@
-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:
+++ /dev/null
-// $Id: gmysqlbackend.cc,v 1.7 2002/12/16 18:02:24 ahu Exp $
-#include <string>
-#include <map>
-
-using namespace std;
-
-#include "pdns/dns.hh"
-#include "pdns/dnsbackend.hh"
-#include "gmysqlbackend.hh"
-#include "pdns/dnspacket.hh"
-#include "pdns/ueberbackend.hh"
-#include "pdns/ahuexception.hh"
-#include "pdns/logger.hh"
-#include "pdns/arguments.hh"
-
-#include "smysql.hh"
-
-
-#include <sstream>
-
-gMySQLBackend::gMySQLBackend(const string &mode, const string &suffix) : GSQLBackend(mode,suffix)
-{
- try {
- setDB(new SMySQL(getArg("dbname"),
- getArg("host"),
- getArg("socket"),
- getArg("user"),
- getArg("password")));
-
- }
-
- catch(SSqlException &e) {
- L<<Logger::Error<<mode<<" Connection failed: "<<e.txtReason()<<endl;
- throw AhuException("Unable to launch "+mode+" connection: "+e.txtReason());
- }
- L<<Logger::Warning<<mode<<" Connection succesful"<<endl;
-}
-
-class gMySQLFactory : public BackendFactory
-{
-public:
- gMySQLFactory(const string &mode) : BackendFactory(mode),d_mode(mode) {}
-
- void declareArguments(const string &suffix="")
- {
- declare(suffix,"dbname","Pdns backend database name to connect to","powerdns");
- declare(suffix,"user","Pdns backend user to connect as","powerdns");
- declare(suffix,"host","Pdns backend host to connect to","");
- declare(suffix,"socket","Pdns backend socket to connect to","");
- declare(suffix,"password","Pdns backend password to connect with","");
-
- declare(suffix,"basic-query","Basic query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s'");
- declare(suffix,"id-query","Basic with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name='%s' and domain_id=%d");
- declare(suffix,"wildcard-query","Wildcard query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s'");
- declare(suffix,"wildcard-id-query","Wildcard with ID query","select content,ttl,prio,type,domain_id,name from records where type='%s' and name like '%s' and domain_id='%d'");
-
- declare(suffix,"any-query","Any query","select content,ttl,prio,type,domain_id,name from records where name='%s'");
- declare(suffix,"any-id-query","Any with ID query","select content,ttl,prio,type,domain_id,name from records where name='%s' and domain_id=%d");
- declare(suffix,"wildcard-any-query","Wildcard ANY query","select content,ttl,prio,type,domain_id,name from records where name like '%s'");
- declare(suffix,"wildcard-any-id-query","Wildcard ANY with ID query","select content,ttl,prio,type,domain_id,name from records where like '%s' and domain_id='%d'");
-
- declare(suffix,"list-query","AXFR query", "select content,ttl,prio,type,domain_id,name from records where domain_id='%d'");
-
- }
-
- DNSBackend *make(const string &suffix="")
- {
- return new gMySQLBackend(d_mode,suffix);
- }
-private:
- const string d_mode;
-};
-
-
-//! Magic class that is activated when the dynamic library is loaded
-class gMySQLLoader
-{
-public:
- //! This reports us to the main UeberBackend class
- gMySQLLoader()
- {
- BackendMakers().report(new gMySQLFactory("gmysql"));
- L<<Logger::Warning<<"This is module gmysqlbackend.so reporting"<<endl;
- }
-};
-static gMySQLLoader gmysqlloader;
+++ /dev/null
-/* Copyright 2001 Netherlabs BV, bert.hubert@netherlabs.nl. See LICENSE
- for more information.
- $Id: smysql.cc,v 1.2 2002/12/16 18:02:24 ahu Exp $ */
-#include "smysql.hh"
-#include <string>
-#include <iostream>
-#include "pdns/logger.hh"
-#include "pdns/dns.hh"
-using namespace std;
-
-bool SMySQL::s_dolog;
-
-SMySQL::SMySQL(const string &database, const string &host, const string &msocket, const string &user,
- const string &password)
-{
- mysql_init(&d_db);
- if (!mysql_real_connect(&d_db, host.empty() ? 0 : host.c_str(),
- user.empty() ? 0 : user.c_str(),
- password.empty() ? 0 : password.c_str(),
- database.c_str(), 0,
- msocket.empty() ? 0 : msocket.c_str(),
- 0)) {
- throw sPerrorException("Unable to connect to database");
- }
- d_rres=0;
-}
-
-void SMySQL::setLog(bool state)
-{
- s_dolog=state;
-}
-
-SMySQL::~SMySQL()
-{
- mysql_close(&d_db);
-}
-
-SSqlException SMySQL::sPerrorException(const string &reason)
-{
- return SSqlException(reason+string(": ")+mysql_error(&d_db));
-}
-
-int SMySQL::doQuery(const string &query)
-{
- if(d_rres)
- throw SSqlException("Attempt to start new MySQL query while old one still in progress");
-
- if(s_dolog)
- L<<Logger::Warning<<"Query: "<<query<<endl;
-
- if(mysql_query(&d_db,query.c_str()))
- throw sPerrorException("Failed to execute mysql_query");
-
-
- return 0;
-}
-
-int SMySQL::doQuery(const string &query, result_t &result)
-{
- result.clear();
- doQuery(query);
-
- row_t row;
- while(getRow(row))
- result.push_back(row);
-
- return result.size();
-}
-
-bool SMySQL::getRow(row_t &row)
-{
- row.clear();
- if(!d_rres)
- if(!(d_rres = mysql_use_result(&d_db)))
- throw sPerrorException("Failed on mysql_use_result");
-
- MYSQL_ROW rrow;
-
- if((rrow = mysql_fetch_row(d_rres))) {
- for(unsigned int i=0;i<mysql_num_fields(d_rres);i++)
- row.push_back(rrow[i] ?: "");
- return true;
- }
- mysql_free_result(d_rres);
- d_rres=0;
- return false;
-}
-
-string SMySQL::escape(const string &name)
-{
- string a;
-
- for(string::const_iterator i=name.begin();i!=name.end();++i) {
- if(*i=='\'' || *i=='\\')
- a+='\\';
- a+=*i;
- }
- return a;
-}
-
-
-#if 0
-int main()
-{
- try {
- SMySQL s("kkfnetmail","127.0.0.1","readonly");
- SSql::result_t juh;
-
- int num=s.doQuery("select *, from mboxes", juh);
- cout<<num<<" responses"<<endl;
-
- for(int i=0;i<num;i++) {
- const SSql::row_t &row=juh[i];
-
- for(SSql::row_t::const_iterator j=row.begin();j!=row.end();++j)
- cout <<"'"<< *j<<"', ";
- cout<<endl;
- }
- }
- catch(SSqlException &e) {
- cerr<<e.txtReason()<<endl;
- }
-}
-
-
-#endif