From d14dcc25d77a556940bcbb6feb71f0b6e67c2674 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Fri, 2 Apr 2004 06:08:59 +0000 Subject: Added alternat loginInfo form.. driver://user;passwd@host:port/databasename fixed RT_LIBS parameter in makefile.in, and configure.ac --- Makefile.in | 4 ++-- configure.ac | 6 +++--- mod_log_sql.c | 48 +++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/Makefile.in b/Makefile.in index e45968b..2789904 100644 --- a/Makefile.in +++ b/Makefile.in @@ -16,7 +16,7 @@ CFLAGS = -Wc,-Wall -Wc,-Werror -Wc,-fno-strict-aliasing INCLUDES = @MYSQL_CFLAGS@ -LDADD = @MYSQL_LDFLAGS@ @MYSQL_LIBS@ @RT_LIBS +LDADD = @MYSQL_LDFLAGS@ @MYSQL_LIBS@ @RT_LIBS@ EXTRA_DIST = AUTHORS INSTALL TODO LICENSE CHANGELOG @@ -96,7 +96,7 @@ install: $(TARGETS) install-subdirs echo "*** Please edit your Apache configuration files and"; \ echo "*** add the appropriate LoadModule directives per the documentation"; \ echo "*** in docs/manual.html"; \ - echo "*** If you have previously used 1.18 or lower then update you must change"; \ + echo "*** If you have previously used 1.18 or lower then you must change"; \ echo "*** >LoadModule sql_log_module modules/mod_log_sql.so"; \ echo "*** to"; \ echo "*** >LoadModule log_sql_module modules/mod_log_sql.so"; \ diff --git a/configure.ac b/configure.ac index bf8ba6e..c93d224 100644 --- a/configure.ac +++ b/configure.ac @@ -33,15 +33,15 @@ AC_SUBST(WANT_SSL_MOD) case "$target" in *-*-solaris* | *-*-osf* ) if test $APACHE_VERSION -eq 1.3; then - RTLIBS=-lrt + RT_LIBS=-lrt fi ;; *) - RTLIBS="" + RT_LIBS="" ;; esac -AC_SUBST(RTLIBS) +AC_SUBST(RT_LIBS) AC_CHECK_HEADERS(limits.h) diff --git a/mod_log_sql.c b/mod_log_sql.c index 666ac46..a247f30 100644 --- a/mod_log_sql.c +++ b/mod_log_sql.c @@ -312,14 +312,44 @@ static const char *set_dbparam_slot(cmd_parms *cmd, static const char *set_log_sql_info(cmd_parms *cmd, void *dummy, const char *host, const char *user, const char *pwd) { - if (*host != '.') { - set_dbparam(cmd, NULL, "host", host); - } - if (*user != '.') { - set_dbparam(cmd, NULL, "user", user); - } - if (*pwd != '.') { - set_dbparam(cmd, NULL, "passwd", pwd); + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, + "%s - %s - %s", host, user, pwd); + if (!user) { /* user is null, so only one arg passed */ + apr_uri_t uri; + apr_uri_parse(cmd->pool, host, &uri); + if (uri.scheme) { + /* set DB plugin */ + } + if (uri.hostname) { + set_dbparam(cmd, NULL, "host", uri.hostname); + } + if (uri.user) { + set_dbparam(cmd, NULL, "user", uri.user); + } + if (uri.password) { + set_dbparam(cmd, NULL, "passwd", uri.password); + } + if (uri.port_str) { + set_dbparam(cmd, NULL, "tcpport", uri.port_str); + } + if (uri.path) { + /* extract Database name */ + char *off = strchr(++uri.path,'/'); + if (off) + *off='\0'; + set_dbparam(cmd, NULL, "database", uri.path); + + } + } else { + if (*host != '.') { + set_dbparam(cmd, NULL, "host", host); + } + if (*user != '.') { + set_dbparam(cmd, NULL, "user", user); + } + if (*pwd != '.') { + set_dbparam(cmd, NULL, "passwd", pwd); + } } return NULL; } @@ -1048,7 +1078,7 @@ static const command_rec log_sql_cmds[] = { (void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF, "Turn on module's capability to create its SQL tables on the fly") , - AP_INIT_TAKE3("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF, + AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF, "The database host, user-id and password for logging") , AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF, -- cgit