jcudeveloper / naxsi

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

nx_intercept.py v0.47 doesn't insert exceptions into a mysql database #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. confiure naxsi and nginx
2. run test
3. no exceptions in the database!

What version of the product are you using? On what operating system?
0.47 Ubuntu 12.04, nginx 1.2.4

Please provide your nginx configuration any additional information below.

fix by making sure the insert is commited

Index: SQLWrapper.py
===================================================================
--- SQLWrapper.py   (revision 498)
+++ SQLWrapper.py   (working copy)
@@ -83,8 +83,7 @@
         if self.dbtype == 'sqlite':
             self.__conn.execute("BEGIN")
     def StopInsert(self):
-        if self.dbtype == 'sqlite':
-            self.__conn.commit()
+        self.__conn.commit()

     def getResults(self):
         return self.__cursor.fetchall()

Original issue reported on code.google.com by nevins.bartolomeo@gmail.com on 8 Nov 2012 at 8:30

GoogleCodeExporter commented 8 years ago
I have the same problem with Mysql (InnoDB) on:

debian squeeze
nx_intercept 0.47
nginx 1.2.1

I found a post about python-mysqldb and innodb where it's explained that 
auto-commit is disabled by default ( 
http://bmaupin.wordpress.com/2011/03/08/python-and-mysql-autocommit/ ).

Fix by enabling auto-commit, so it fix mysql problem but sqlite too :

--- nx_intercept.py 2012-06-27 12:28:00.000000000 +0200
+++ nx_intercept.py 2012-11-12 17:44:22.000000000 +0100
@@ -46,6 +46,7 @@
         self.cursor = self.db.cursor()
         if self.cursor is None:
             raise ValueError("Cannot connect to db.")
+   self.db.autocommit(True)
         parser = signature_parser(self.cursor)
         parser.sig_to_db(fullstr, sig)
         self.db.close()

Original comment by pablo...@gmail.com on 12 Nov 2012 at 4:55

GoogleCodeExporter commented 8 years ago
Thanks,

patch reported in 0.49.

Original comment by ori...@gmail.com on 7 Jan 2013 at 6:01