diff -Naur mod_log_sql-1.101-rs3/mod_log_sql.c mod_log_sql-1.101-rs4/mod_log_sql.c --- mod_log_sql-1.101-rs3/mod_log_sql.c 2008-02-21 22:29:13.000000000 +0100 +++ mod_log_sql-1.101-rs4/mod_log_sql.c 2008-02-26 15:22:18.000000000 +0100 @@ -499,7 +499,7 @@ for (cur_s = s; cur_s != NULL; cur_s= cur_s->next) { logsql_state *cls = ap_get_module_config(cur_s->module_config, &log_sql_module); - if (cls->preserve_file == DEFAULT_PRESERVE_FILE) + if (strcmp(cls->preserve_file,DEFAULT_PRESERVE_FILE)==0) cls->preserve_file = default_p; } } @@ -525,15 +525,14 @@ static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_type, const char *table_name, const char *query) { - logsql_query_ret result; - logsql_state *cls = ap_get_module_config(r->server->module_config, - &log_sql_module); - if (!global_config.db.connected || global_config.driver == NULL) { /* preserve query */ return LOGSQL_QUERY_NOLINK; } + logsql_query_ret result; + logsql_state *cls = ap_get_module_config(r->server->module_config, + &log_sql_module); result = global_config.driver->insert(r,&global_config.db,query); /* If we ran the query and it returned an error, try to be robust. @@ -642,15 +641,13 @@ logsql_state *cls = (logsql_state *) apr_pcalloc(p, sizeof(logsql_state)); /* These defaults are overridable in the httpd.conf file. */ - cls->transfer_log_format = DEFAULT_TRANSFER_LOG_FMT; - apr_pool_create(&cls->parsed_pool, p); - cls->parsed_log_format = apr_pcalloc(cls->parsed_pool, - strlen(cls->transfer_log_format) * sizeof(logsql_item *)); - cls->notes_table_name = DEFAULT_NOTES_TABLE_NAME; - cls->hin_table_name = DEFAULT_HIN_TABLE_NAME; - cls->hout_table_name = DEFAULT_HOUT_TABLE_NAME; - cls->cookie_table_name = DEFAULT_COOKIE_TABLE_NAME; - cls->preserve_file = DEFAULT_PRESERVE_FILE; + cls->transfer_log_format= apr_pstrcat(p,DEFAULT_TRANSFER_LOG_FMT,NULL); + + cls->notes_table_name = apr_pstrcat(p,DEFAULT_NOTES_TABLE_NAME,NULL); + cls->hin_table_name = apr_pstrcat(p,DEFAULT_HIN_TABLE_NAME,NULL); + cls->hout_table_name = apr_pstrcat(p,DEFAULT_HOUT_TABLE_NAME,NULL); + cls->cookie_table_name = apr_pstrcat(p,DEFAULT_COOKIE_TABLE_NAME,NULL); + cls->preserve_file = apr_pstrcat(p,DEFAULT_PRESERVE_FILE,NULL); cls->transfer_ignore_list = apr_array_make(p, 1, sizeof(char *)); cls->transfer_accept_list = apr_array_make(p, 1, sizeof(char *)); @@ -658,7 +655,10 @@ cls->notes_list = apr_array_make(p, 1, sizeof(char *)); cls->hin_list = apr_array_make(p, 1, sizeof(char *)); cls->hout_list = apr_array_make(p, 1, sizeof(char *)); - cls->cookie_list = apr_array_make(p, 1, sizeof(char *)); + cls->cookie_list = apr_array_make(p, 1, sizeof(char *)); + + apr_pool_create(&cls->parsed_pool, p); + cls->parsed_log_format = apr_pcalloc(cls->parsed_pool, strlen(cls->transfer_log_format) * sizeof(logsql_item *)); return (void *) cls; } @@ -742,29 +742,29 @@ child->transfer_table_name = parent->transfer_table_name; } - if (child->transfer_log_format == DEFAULT_TRANSFER_LOG_FMT) { + if (strcmp(child->transfer_log_format,DEFAULT_TRANSFER_LOG_FMT)==0) { child->transfer_log_format = parent->transfer_log_format; /*apr_pool_clear(child->parsed_pool);*/ child->parsed_log_format = apr_pcalloc(child->parsed_pool, strlen(child->transfer_log_format) * sizeof(logsql_item *)); } - if (child->preserve_file == DEFAULT_PRESERVE_FILE) + if (strcmp(child->preserve_file,DEFAULT_PRESERVE_FILE)==0) child->preserve_file = parent->preserve_file; /* server_root_relative the preserve file location */ - if (child->preserve_file == DEFAULT_PRESERVE_FILE) - child->preserve_file = ap_server_root_relative(p, DEFAULT_PRESERVE_FILE); + if (strcmp(child->preserve_file,DEFAULT_PRESERVE_FILE)==0) + child->preserve_file = ap_server_root_relative(p, DEFAULT_PRESERVE_FILE); - if (child->notes_table_name == DEFAULT_NOTES_TABLE_NAME) + if (strcmp(child->notes_table_name,DEFAULT_NOTES_TABLE_NAME)==0) child->notes_table_name = parent->notes_table_name; - if (child->hin_table_name == DEFAULT_HIN_TABLE_NAME) + if (strcmp(child->hin_table_name,DEFAULT_HIN_TABLE_NAME)==0) child->hin_table_name = parent->hin_table_name; - if (child->hout_table_name == DEFAULT_HOUT_TABLE_NAME) + if (strcmp(child->hout_table_name,DEFAULT_HOUT_TABLE_NAME)==0) child->hout_table_name = parent->hout_table_name; - if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME) + if (strcmp(child->cookie_table_name,DEFAULT_COOKIE_TABLE_NAME)==0) child->cookie_table_name = parent->cookie_table_name; do_merge_array(parent->transfer_ignore_list, child->transfer_ignore_list, subp, p); @@ -1104,14 +1104,11 @@ if (global_config.forcepreserve) { log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: preservation forced"); preserve_entry(orig, access_query); - if ( note_query != NULL ) - preserve_entry(orig, note_query); - if ( hin_query != NULL ) - preserve_entry(orig, hin_query); - if ( hout_query != NULL ) - preserve_entry(orig, hout_query); - if ( cookie_query != NULL ) - preserve_entry(orig, cookie_query); + + if (note_query != NULL) preserve_entry(orig, note_query); + if (hin_query != NULL) preserve_entry(orig, hin_query); + if (hout_query != NULL) preserve_entry(orig, hout_query); + if (cookie_query != NULL) preserve_entry(orig, cookie_query); return OK; } @@ -1129,10 +1126,10 @@ * we don't keep logging the db error over and over. */ preserve_entry(orig, access_query); - if ( note_query != NULL ) preserve_entry(orig, note_query); - if ( hin_query != NULL ) preserve_entry(orig, hin_query); - if ( hout_query != NULL ) preserve_entry(orig, hout_query); - if ( cookie_query != NULL ) preserve_entry(orig, cookie_query); + if (note_query != NULL) preserve_entry(orig, note_query); + if (hin_query != NULL) preserve_entry(orig, hin_query); + if (hout_query != NULL) preserve_entry(orig, hout_query); + if (cookie_query != NULL) preserve_entry(orig, cookie_query); return OK; } diff -Naur mod_log_sql-1.101-rs3/mod_log_sql_mysql.c mod_log_sql-1.101-rs4/mod_log_sql_mysql.c --- mod_log_sql-1.101-rs3/mod_log_sql_mysql.c 2008-02-26 14:48:10.000000000 +0100 +++ mod_log_sql-1.101-rs4/mod_log_sql_mysql.c 2008-02-26 15:18:16.000000000 +0100 @@ -46,7 +46,7 @@ if (!socketfile) { - /* RS: replace socketfile = "..." with apr_pstrcat, hope s->pool is the right one */ + /* RS: replace socketfile = "..." with apr_pstrcat, hope s->process->pool is the right one */ socketfile = apr_pstrcat(s->process->pool,"/var/lib/mysql/mysql.sock",NULL); }