ReJeCtAll / naxsi

Automatically exported from code.google.com/p/naxsi
Other
0 stars 0 forks source link

SQLWrapper sets autocommit = 0, but never commits transaction leading to lost data #64

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The SQL library sets autocommit 0, but never does a commit trans, so the rows 
are never inserted into the db.

The attached patch changes the StopInsert() function and now does a commit for 
MySQL

What steps will reproduce the problem?
1. configure naxsi-ui to use a mysql backend
2. make a request to the site that will be banned
3. MySQL autoindex ids will increase, but rows will not appear. 

What is the expected output? What do you see instead?
Should see the rows in the MySQL tables

What version of the product are you using? On what operating system?
Debian using packages from DotDeb

Please provide your nginx configuration any additional information below.

The following shows the MySQL log, showing there is no commit.
Connect   naxsi_ui@localhost on naxsi_ui
Query     set autocommit=0
Query     SELECT 1 FROM exceptions
Query     INSERT INTO urls (url) VALUES ('<url>')
Query     INSERT INTO exceptions (zone, var_name, rule_id) VALUES 
('HEADERS','cookie','1005')
Query     INSERT INTO connections (peer_ip, host, url_id, id_exception,date) 
VALUES ('<ip address>','<domain>','5','13',NULL)
Query     INSERT INTO exceptions (zone, var_name, rule_id) VALUES 
('HEADERS','cookie','1010')
Query     INSERT INTO connections (peer_ip, host, url_id, id_exception,date) 
VALUES ('<ip address>','<domain>','5','14',NULL)
Query     INSERT INTO exceptions (zone, var_name, rule_id) VALUES 
('HEADERS','cookie','1011')
Query     INSERT INTO connections (peer_ip, host, url_id, id_exception,date) 
VALUES ('<ip address>','<domain>','5','15',NULL)
Quit

naxsi-ui.conf
[sql]
username=<dbuser>
password=<password>
hostname=localhost
dbname=<dbname>
dbtype=mysql

[nx_intercept]
port = 8080

[nx_extract]
username = <webuser>
password = <webpassword>
port = 8081
rules_path = /etc/nginx/naxsi_core.rules

Original issue reported on code.google.com by add...@ask-adders.com on 26 Mar 2013 at 1:13

Attachments: