From 197e405e8e8ae8e11bb251305043810c7fa93e4e Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Fri, 16 Jul 2004 01:33:59 +0000 Subject: fixed another segfault related to the mysql escaping function (forcepreserve bug) included win32 build bat files in distribution separated -Werror to a configure time option (--enable-maintainer) update autogen to use autoconf 2.57, aclocal 1.7 included pgsql and dbi module source in distribution. setup autodetection in configure script for databases. --- diff --git a/CHANGELOG b/CHANGELOG index 919d2a6..bdbe8bc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,13 @@ -?: ? -* Added DBI support +1.99: 2004-06-10 +* Added DBI support (not completed yet) * fixed segfault in the mysql driver escape_string function +* fixed segfault when forcepreserve is set on. * switched escape_string driver function to include the string quotes. +* On Database connection failure Database errors are printed at ERR loglevel + instead of debug +* forgot to include build-apache(13|2).bat scripts in the distribution -1.98: 2004-04-12 +1.98: 2004-05-12 * re-fixed apache.m4 to better detect APR and APU code * fixed for win32 compilation under apache 2 * lowered minumum required apache 2 version to 2.0.40 (RH9) diff --git a/Makefile.in b/Makefile.in index 5b4f368..7e7ae94 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2,7 +2,6 @@ # Modify these top variables. SUBDIRS = docs contrib -SOURCES = @PACKAGE_NAME@.c HEADERS = mod_log_sql.h \ functions.h \ @@ -11,15 +10,21 @@ HEADERS = mod_log_sql.h \ apache13.h \ apache20.h -CFLAGS = -Wc,-Wall -Wc,-Werror -Wc,-fno-strict-aliasing +CFLAGS = -Wc,-Wall -Wc,-fno-strict-aliasing -LDADD = @RT_LIBS@ - -EXTRA_DIST = AUTHORS INSTALL TODO LICENSE CHANGELOG +ifeq (@OOO_MAINTAIN@,1) +CFLAGS += -Wc,-Werror +endif -TARGET = @PACKAGE_NAME@@APXS_EXTENSION@ +EXTRA_DIST = AUTHORS INSTALL TODO LICENSE CHANGELOG \ + build-apache13.bat build-apache2.bat -TARGETS = $(TARGET) +coreSOURCES = @PACKAGE_NAME@.c +coreTARGET = @PACKAGE_NAME@@APXS_EXTENSION@ +coreLDADD = @RT_LIBS@ +coreCFLAGS = +coreNAME = log_sql +TARGETS = $(coreTARGET) sslSOURCES = @PACKAGE_NAME@_ssl.c sslTARGET = @PACKAGE_NAME@_ssl@APXS_EXTENSION@ @@ -68,11 +73,14 @@ PROVIDERS_SUBDIRS = @subdirs@ srcdir = @abs_srcdir@ builddir = @abs_builddir@ -OBJ = $(SOURCES:.c=.o) $(sslSOURCES:.c=.o) $(mysqlSOURCES:.c=.o) +OBJ = $(SOURCES:.c=.o) $(sslSOURCES:.c=.o) $(mysqlSOURCES:.c=.o) \ + $(dbiSOURCES:.c=.o) $(pgsqlSOURCES:.c=.o) -LO = $(SOURCES:.c=.lo) $(sslSOURCES:.c=.lo) $(mysqlSOURCES:.c=.lo) +LO = $(SOURCES:.c=.lo) $(sslSOURCES:.c=.lo) $(mysqlSOURCES:.c=.lo) \ + $(dbiSOURCES:.c=.lo) $(pgsqlSOURCES:.c=.lo) -SLO = $(SOURCES:.c=.slo) $(sslSOURCES:.c=.slo) $(mysqlSOURCES:.c=.slo) +SLO = $(SOURCES:.c=.slo) $(sslSOURCES:.c=.slo) $(mysqlSOURCES:.c=.slo) \ + $(dbiSOURCES:.c=.slo) $(pgsqlSOURCES:.c=.slo) STD_DIST = install-sh \ config.sub \ @@ -84,8 +92,8 @@ STD_DIST = install-sh \ stamp-h.in \ config.h.in -DISTFILES = $(STD_DIST) $(EXTRA_DIST) $(SOURCES) $(HEADERS) \ - $(sslSOURCES) $(mysqlSOURCES) +DISTFILES = $(STD_DIST) $(EXTRA_DIST) $(coreSOURCES) $(HEADERS) \ + $(sslSOURCES) $(mysqlSOURCES) $(pgsqlSOURCES) $(dbsqlSOURCES) all: $(TARGETS) all-subdirs @@ -107,9 +115,9 @@ all-subdirs install-subdirs activate-subdirs clean-subdirs distclean-subdirs: TODO: TODO.in @./gen_todo.pl -$(TARGET): $(SOURCES) $(HEADERS) - @@APXS_BIN@ -c -o $(TARGET) $(CFLAGS) \ - @DEFS@ @AP_DEFS@ $(LDADD) $(SOURCES) +$(coreTARGET): $(coreSOURCES) $(HEADERS) + @@APXS_BIN@ -c -o $(coreTARGET) $(coreCFLAGS) $(CFLAGS) \ + @DEFS@ @AP_DEFS@ $(coreLDADD) $(coreSOURCES) $(sslTARGET): $(sslSOURCES) $(HEADERS) @@APXS_BIN@ -c -o $(sslTARGET) $(sslCFLAGS) $(CFLAGS) \ @@ -128,8 +136,13 @@ $(dbiTARGET): $(dbiSOURCES) $(HEADERS) @DEFS@ @AP_DEFS@ $(dbiLDADD) $(dbiSOURCES) install: $(TARGETS) install-subdirs - @@APXS_BIN@ -i $(TARGET); \ - @APXS_BIN@ -n $(mysqlNAME) -i $(mysqlTARGET); \ + @@APXS_BIN@ -n $(coreNAME) -i $(coreTARGET); \ + if test @WANT_MYSQL_MOD@ -eq 1; then \ + @APXS_BIN@ -n $(mysqlNAME) -i $(mysqlTARGET); \ + fi; \ + if test @WANT_PGSQL_MOD@ -eq 1; then \ + @APXS_BIN@ -n $(pgsqlNAME) -i $(pgsqlTARGET); \ + fi; \ if test @WANT_DBI_MOD@ -eq 1; then \ @APXS_BIN@ -n $(dbiNAME) -i $(dbiTARGET); \ fi; \ @@ -152,9 +165,9 @@ install: $(TARGETS) install-subdirs echo "*************************************************************************"; activate: activate-subdirs - @@APXS_BIN@ -i -a $(TARGET); \ + @@APXS_BIN@ -n $(coreNAME) -i -a $(coreTARGET); \ if test @WANT_SSL_MOD@ -eq 1; then \ - @APXS_BIN@ -i -a $(sslTARGET); \ + @APXS_BIN@ -n $(sslNAME) -i -a $(sslTARGET); \ fi clean: clean-subdirs diff --git a/autogen.sh b/autogen.sh index 78f11a7..9d8dbac 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,13 +1,13 @@ #!/bin/sh if [ -z $ACLOCAL ]; then - ACLOCAL=aclocal-1.5 + ACLOCAL=aclocal-1.7 fi if [ -z $AUTOCONF ]; then - AUTOCONF=autoconf-2.53 + AUTOCONF=autoconf-2.57 fi if [ -z $AUTOHEADER ]; then - AUTOHEADER=autoheader-2.53 + AUTOHEADER=autoheader-2.57 fi rm -rf autom4te-2.53.cache $ACLOCAL -I m4 diff --git a/configure.ac b/configure.ac index d10ad4f..f2c0df2 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,8 @@ AC_CONFIG_HEADERS(config.h) AC_CONFIG_SRCDIR(mod_log_sql.c) +OOO_MAINTAIN_MODE + dnl Add a test for a compiler. AC_PROG_CC @@ -19,31 +21,31 @@ CHECK_APACHE($APACHE13_VERSION,$APACHE20_VERSION, AC_MSG_ERROR([*** or Apache 2.0/2.1 version $APACHE20_VERSION or greater!]) ) -CHECK_PATH_MYSQL(:, +CHECK_PATH_MYSQL( + WANT_MYSQL_MOD=1, AC_MSG_ERROR([*** Mysql client libraries not found!]) + WANT_MYSQL_MOD=0 ) +AC_SUBST(WANT_MYSQL_MOD) + +CHECK_PATH_LIBDBI(WANT_DBI_MOD=1, + AC_MSG_ERROR([** libDBI client libraries not found!]) + WANT_DBI_MOD=0 + ) +AC_SUBST(WANT_DBI_MOD) + +dnl to write, checking for pgsql libs +WANT_PGSQL_MOD=0 +AC_SUBST(WANT_PGSQL_MOD) + CHECK_PATH_MOD_SSL( AC_DEFINE(WANT_SSL_LOGGING,,[Define if we want to compile in SSL support.]) WANT_SSL_MOD=1, WANT_SSL_MOD=0 ) - AC_SUBST(WANT_SSL_MOD) -WANT_MYSQL_MOD=1 -AC_SUBST(WANT_MYSQL_MOD) -WANT_PGSQL_MOD=0 -AC_SUBST(WANT_PGSQL_MOD) -WANT_DBI_MOD=1 -DBI_LDFLAGS="" -DBI_LIBS="-ldbi" -DBI_CFLAGS="" -AC_SUBST(DBI_LDFLAGS) -AC_SUBST(DBI_LIBS) -AC_SUBST(DBI_CFLAGS) -AC_SUBST(WANT_DBI_MOD) - case "$target" in *-*-solaris* | *-*-osf* ) if test $APACHE_VERSION -eq 1.3; then @@ -70,10 +72,24 @@ contrib/Makefile) AC_MSG_RESULT([------------------------------------]) -AC_MSG_RESULT([Apache version : $AP_VERSION]) +AC_MSG_RESULT([Apache version : $AP_VERSION]) if test $WANT_SSL_MOD -eq 1; then - AC_MSG_RESULT([SSL Support : yes]) + AC_MSG_RESULT([SSL Support : yes]) else - AC_MSG_RESULT([SSL Support : no]) - AC_MSG_RESULT([*** Use --enable-ssl to enable SSL support]) + AC_MSG_RESULT([SSL Support : no]) + AC_MSG_RESULT([*** Use --enable-ssl to enable SSL support]) +fi +AC_MSG_RESULT([Enabled drivers :]) +if test $WANT_MYSQL_MOD -eq 1; then + AC_MSG_RESULT([ MySQL Driver]) fi +if test $WANT_PGSQL_MOD -eq 1; then + AC_MSG_RESULT([ PostgreSQL Driver]) +fi +if test $WANT_DBI_MOD -eq 1; then + AC_MSG_RESULT([ libDBI Driver]) +fi +if test $OOO_MAINTAIN -eq 1; then + AC_MSG_RESULT([Maintainer mode is on. -Werror is in effect]) +fi +AC_MSG_RESULT([------------------------------------]) diff --git a/mod_log_sql.c b/mod_log_sql.c index dace2d4..7aaa595 100644 --- a/mod_log_sql.c +++ b/mod_log_sql.c @@ -154,7 +154,7 @@ static logsql_opendb_ret log_sql_opendb_link(server_rec* s) { logsql_opendb_ret result; if (global_config.forcepreserve) { - global_config.db.connected = 1; + //global_config.db.connected = 1; return LOGSQL_OPENDB_PRESERVE; } if (global_config.db.connected) { @@ -1054,10 +1054,10 @@ static int log_sql_transaction(request_rec *orig) /* How's our mysql link integrity? */ if (!global_config.db.connected) { - - /* Make a try to establish the link */ - log_sql_opendb_link(r->server); - + if (!global_config.forcepreserve) { + /* Make a try to establish the link */ + log_sql_opendb_link(r->server); + } if (!global_config.db.connected) { /* Unable to re-establish a DB link, so assume that it's really * gone and send the entry to the preserve file instead. diff --git a/mod_log_sql.h b/mod_log_sql.h index e708f57..6bcd6cb 100644 --- a/mod_log_sql.h +++ b/mod_log_sql.h @@ -79,6 +79,8 @@ typedef enum { /* Registration function for database drivers */ typedef struct { + /* name of the provider */ + const char *providername; /* NULL terminated list of drivers strings */ const char **provided_drivers; /* create a connection to the underlying database layer */ diff --git a/mod_log_sql_mysql.c b/mod_log_sql_mysql.c index f058110..fd1668a 100644 --- a/mod_log_sql_mysql.c +++ b/mod_log_sql_mysql.c @@ -247,6 +247,7 @@ static logsql_table_ret log_sql_mysql_create(request_rec *r, logsql_dbconnection static const char *supported_drivers[] = {"mysql",NULL}; static logsql_dbdriver mysql_driver = { + "mysql", supported_drivers, log_sql_mysql_connect, /* open DB connection */ log_sql_mysql_close, /* close DB connection */ -- cgit v0.9.2