mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-23 15:54:24 +03:00
Fix for an Issue #650
This commit is contained in:
parent
106102bd3c
commit
f6e1d9e026
|
@ -460,6 +460,9 @@ HASHDB_FLUSH_THRESHOLD = 32
|
|||
# Number of retries for unsuccessful HashDB flush attempts
|
||||
HASHDB_FLUSH_RETRIES = 3
|
||||
|
||||
# Number of retries for unsuccessful HashDB end transaction attempts
|
||||
HASHDB_END_TRANSACTION_RETRIES = 3
|
||||
|
||||
# Unique milestone value used for forced deprecation of old HashDB values (e.g. when changing hash/pickle mechanism)
|
||||
HASHDB_MILESTONE_VALUE = "cAWxkLYCQT" # r5129 "".join(random.sample(string.ascii_letters, 10))
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ from lib.core.common import serializeObject
|
|||
from lib.core.common import unserializeObject
|
||||
from lib.core.data import logger
|
||||
from lib.core.exception import SqlmapDataException
|
||||
from lib.core.settings import HASHDB_END_TRANSACTION_RETRIES
|
||||
from lib.core.settings import HASHDB_FLUSH_RETRIES
|
||||
from lib.core.settings import HASHDB_FLUSH_THRESHOLD
|
||||
from lib.core.settings import UNICODE_ENCODING
|
||||
|
@ -43,7 +44,11 @@ class HashDB(object):
|
|||
|
||||
return threadData.hashDBCursor
|
||||
|
||||
cursor = property(_get_cursor)
|
||||
def _set_cursor(self, cursor):
|
||||
threadData = getCurrentThreadData()
|
||||
threadData.hashDBCursor = cursor
|
||||
|
||||
cursor = property(_get_cursor, _set_cursor)
|
||||
|
||||
def close(self):
|
||||
threadData = getCurrentThreadData()
|
||||
|
@ -134,15 +139,29 @@ class HashDB(object):
|
|||
def beginTransaction(self):
|
||||
threadData = getCurrentThreadData()
|
||||
if not threadData.inTransaction:
|
||||
self.cursor.execute('BEGIN TRANSACTION')
|
||||
self.cursor.execute("BEGIN TRANSACTION")
|
||||
threadData.inTransaction = True
|
||||
|
||||
def endTransaction(self):
|
||||
threadData = getCurrentThreadData()
|
||||
if threadData.inTransaction:
|
||||
retries = 0
|
||||
while retries < HASHDB_END_TRANSACTION_RETRIES:
|
||||
try:
|
||||
self.cursor.execute("END TRANSACTION")
|
||||
threadData.inTransaction = False
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
retries += 1
|
||||
time.sleep(1)
|
||||
|
||||
try:
|
||||
self.cursor.execute('END TRANSACTION')
|
||||
self.cursor.execute("ROLLBACK TRANSACTION")
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
self.cursor.close()
|
||||
self.cursor = None
|
||||
finally:
|
||||
threadData.inTransaction = False
|
||||
|
|
Loading…
Reference in New Issue
Block a user