diff options
author | Edward Rudd | 2008-10-23 06:56:41 +0000 |
---|---|---|
committer | Edward Rudd | 2008-10-23 06:56:41 +0000 |
commit | 50af087b9f3831285869dc8d8bf91cc3e6d5169a (patch) | |
tree | 2654017cf9aac96b7d0c57aaf913af786fd997d8 /utility | |
parent | aed9f10440d8789f99919c3a6f91e8d76bbc44dc (diff) |
fix possible crash when regex function doesn't match (set to *default*)
Diffstat (limited to 'utility')
-rw-r--r-- | utility/database.c | 2 | ||||
-rw-r--r-- | utility/logparse.c | 3 | ||||
-rw-r--r-- | utility/mod_log_sql.conf | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/utility/database.c b/utility/database.c index e7650aa..a979268 100644 --- a/utility/database.c +++ b/utility/database.c | |||
@@ -19,7 +19,7 @@ apr_status_t database_connect(config_t *cfg) | |||
19 | { | 19 | { |
20 | apr_status_t rv; | 20 | apr_status_t rv; |
21 | if (!cfg->dbconn) { | 21 | if (!cfg->dbconn) { |
22 | cfg->dbconn = apr_palloc(cfg->pool, sizeof(config_dbd_t)); | 22 | cfg->dbconn = apr_pcalloc(cfg->pool, sizeof(config_dbd_t)); |
23 | } | 23 | } |
24 | rv = apr_dbd_get_driver(cfg->pool, cfg->dbdriver, &(cfg->dbconn->driver)); | 24 | rv = apr_dbd_get_driver(cfg->pool, cfg->dbdriver, &(cfg->dbconn->driver)); |
25 | if (rv) | 25 | if (rv) |
diff --git a/utility/logparse.c b/utility/logparse.c index e9ca340..dfe2e9b 100644 --- a/utility/logparse.c +++ b/utility/logparse.c | |||
@@ -40,6 +40,8 @@ static apr_status_t parser_func_regexmatch(apr_pool_t *p, config_t *cfg, | |||
40 | 40 | ||
41 | if (!ap_regexec(data->rx, value, AP_MAX_REG_MATCH, regm, 0)) { | 41 | if (!ap_regexec(data->rx, value, AP_MAX_REG_MATCH, regm, 0)) { |
42 | *ret = ap_pregsub(p, data->substr, value, AP_MAX_REG_MATCH, regm); | 42 | *ret = ap_pregsub(p, data->substr, value, AP_MAX_REG_MATCH, regm); |
43 | } else { | ||
44 | *ret = field->def; | ||
43 | } | 45 | } |
44 | //printf("We matched %s against %s to %s\n",value, field->args[0], *ret); | 46 | //printf("We matched %s against %s to %s\n",value, field->args[0], *ret); |
45 | return APR_SUCCESS; | 47 | return APR_SUCCESS; |
@@ -51,6 +53,7 @@ static apr_status_t parser_func_totimestamp(apr_pool_t *p, config_t *cfg, | |||
51 | time_t time; | 53 | time_t time; |
52 | struct tm ts; | 54 | struct tm ts; |
53 | 55 | ||
56 | //memset(&ts,0,sizeof(struct tm)); | ||
54 | 57 | ||
55 | strptime(value, "%d/%b/%Y:%H:%M:%S %z", &ts); | 58 | strptime(value, "%d/%b/%Y:%H:%M:%S %z", &ts); |
56 | time = mktime(&ts); | 59 | time = mktime(&ts); |
diff --git a/utility/mod_log_sql.conf b/utility/mod_log_sql.conf index 9730983..bd8496c 100644 --- a/utility/mod_log_sql.conf +++ b/utility/mod_log_sql.conf | |||
@@ -2,7 +2,6 @@ InputDirectory ./logs | |||
2 | ErrorLog ./error_log | 2 | ErrorLog ./error_log |
3 | DBDDriver mysql | 3 | DBDDriver mysql |
4 | DBDParams "host=localhost;user=root;dbname=apache_log" | 4 | DBDParams "host=localhost;user=root;dbname=apache_log" |
5 | DBParam socketfile /tmp/mysql.sock | ||
6 | Table access_log | 5 | Table access_log |
7 | MachineID 7of9 | 6 | MachineID 7of9 |
8 | UseTransactions on | 7 | UseTransactions on |