[Issues] [mod_log_sql 0000083]: Add backticks to table-names to avoid SQL-errors

Mantis Bug Tracker issues at outoforder.cc
Sun Apr 27 08:21:56 EDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://issues.outoforder.cc/view.php?id=83 
====================================================================== 
Reported By:                wido
Assigned To:                
====================================================================== 
Project:                    mod_log_sql
Issue ID:                   83
Category:                   Apache Integration
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Apache Version:             unspecified 
====================================================================== 
Date Submitted:             2008-03-31 07:14 EDT
Last Modified:              2008-04-27 08:21 EDT
====================================================================== 
Summary:                    Add backticks to table-names to avoid SQL-errors
Description: 
mod_log_sql does not add backticks (` and `) around table-names when
inserting in the database, this causes SQL-errors on some table names.

For example, this query fails:

insert  into lost-tv_nl
(agent,bytes_sent,request_protocol,remote_host,request_method,referer,time_stamp,status,request_duration,request_uri,remote_user,virtual_host)
values ('Mozilla/5.0 (compatible; Yahoo! Slurp;
http://help.yahoo.com/help/us/ysearch/slurp)','9483','HTTP/1.0','74.6.25.114','GET','-','1206722898','200','0','/forum/index.php','-','lost-tv.nl');

On our shared-hosting platform we log to one table per virtualhost. When a
dash (-) exists in the table-name, MySQL crashes.

I modified the source and added backticks around all the inserts, then it
works.


For example, i changed the following in mod_log_sql.c:

note_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val)
values %s"

This fixes my issue, but i think quoting all the names should be even
better.
====================================================================== 

---------------------------------------------------------------------- 
 (0000106) urkle (administrator) - 2008-03-31 10:31
 http://issues.outoforder.cc/view.php?id=83#c106 
---------------------------------------------------------------------- 
https://bugs.launchpad.net/ubuntu/+source/libapache-mod-log-sql/+bug/209628 

---------------------------------------------------------------------- 
 (0000115) thomasgoirand (reporter) - 2008-04-27 08:21
 http://issues.outoforder.cc/view.php?id=83#c115 
---------------------------------------------------------------------- 
Hi,

I have added the debian dpatch file that I used for the SID package.

Thomas 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-03-31 07:14 wido           New Issue                                    
2008-03-31 07:14 wido           Apache Version            => unspecified     
2008-03-31 10:31 urkle          Note Added: 0000106                          
2008-04-27 08:21 thomasgoirand  File Added:
007-mod_log_sql.c_funny-table-names.dpatch                    
2008-04-27 08:21 thomasgoirand  Note Added: 0000115                          
======================================================================




More information about the Issues mailing list