diff options
Diffstat (limited to 'mod_log_sql.c')
-rw-r--r-- | mod_log_sql.c | 48 |
1 files changed, 39 insertions, 9 deletions
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, | |||
312 | static const char *set_log_sql_info(cmd_parms *cmd, void *dummy, | 312 | static const char *set_log_sql_info(cmd_parms *cmd, void *dummy, |
313 | const char *host, const char *user, const char *pwd) | 313 | const char *host, const char *user, const char *pwd) |
314 | { | 314 | { |
315 | if (*host != '.') { | 315 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, |
316 | set_dbparam(cmd, NULL, "host", host); | 316 | "%s - %s - %s", host, user, pwd); |
317 | } | 317 | if (!user) { /* user is null, so only one arg passed */ |
318 | if (*user != '.') { | 318 | apr_uri_t uri; |
319 | set_dbparam(cmd, NULL, "user", user); | 319 | apr_uri_parse(cmd->pool, host, &uri); |
320 | } | 320 | if (uri.scheme) { |
321 | if (*pwd != '.') { | 321 | /* set DB plugin */ |
322 | set_dbparam(cmd, NULL, "passwd", pwd); | 322 | } |
323 | if (uri.hostname) { | ||
324 | set_dbparam(cmd, NULL, "host", uri.hostname); | ||
325 | } | ||
326 | if (uri.user) { | ||
327 | set_dbparam(cmd, NULL, "user", uri.user); | ||
328 | } | ||
329 | if (uri.password) { | ||
330 | set_dbparam(cmd, NULL, "passwd", uri.password); | ||
331 | } | ||
332 | if (uri.port_str) { | ||
333 | set_dbparam(cmd, NULL, "tcpport", uri.port_str); | ||
334 | } | ||
335 | if (uri.path) { | ||
336 | /* extract Database name */ | ||
337 | char *off = strchr(++uri.path,'/'); | ||
338 | if (off) | ||
339 | *off='\0'; | ||
340 | set_dbparam(cmd, NULL, "database", uri.path); | ||
341 | |||
342 | } | ||
343 | } else { | ||
344 | if (*host != '.') { | ||
345 | set_dbparam(cmd, NULL, "host", host); | ||
346 | } | ||
347 | if (*user != '.') { | ||
348 | set_dbparam(cmd, NULL, "user", user); | ||
349 | } | ||
350 | if (*pwd != '.') { | ||
351 | set_dbparam(cmd, NULL, "passwd", pwd); | ||
352 | } | ||
323 | } | 353 | } |
324 | return NULL; | 354 | return NULL; |
325 | } | 355 | } |
@@ -1048,7 +1078,7 @@ static const command_rec log_sql_cmds[] = { | |||
1048 | (void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF, | 1078 | (void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF, |
1049 | "Turn on module's capability to create its SQL tables on the fly") | 1079 | "Turn on module's capability to create its SQL tables on the fly") |
1050 | , | 1080 | , |
1051 | AP_INIT_TAKE3("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF, | 1081 | AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF, |
1052 | "The database host, user-id and password for logging") | 1082 | "The database host, user-id and password for logging") |
1053 | , | 1083 | , |
1054 | AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF, | 1084 | AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF, |