mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-16 19:40:37 +03:00
Patch for an Issue #193
This commit is contained in:
parent
c9e7e71ea2
commit
fccdb824bb
|
@ -402,6 +402,9 @@ DEFAULT_COOKIE_DELIMITER = ';'
|
|||
# Skip unforced HashDB flush requests below the threshold number of cached items
|
||||
HASHDB_FLUSH_THRESHOLD = 32
|
||||
|
||||
# Number of retries for unsuccessful HashDB flush attempts
|
||||
HASHDB_FLUSH_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.letters, 10))
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ import time
|
|||
from lib.core.common import getUnicode
|
||||
from lib.core.common import serializeObject
|
||||
from lib.core.common import unserializeObject
|
||||
from lib.core.data import logger
|
||||
from lib.core.settings import HASHDB_FLUSH_RETRIES
|
||||
from lib.core.settings import HASHDB_FLUSH_THRESHOLD
|
||||
from lib.core.settings import UNICODE_ENCODING
|
||||
from lib.core.threads import getCurrentThreadData
|
||||
|
@ -95,6 +97,7 @@ class HashDB(object):
|
|||
try:
|
||||
self.beginTransaction()
|
||||
for hash_, value in _.items():
|
||||
retries = 0
|
||||
while True:
|
||||
try:
|
||||
try:
|
||||
|
@ -102,9 +105,16 @@ class HashDB(object):
|
|||
except sqlite3.IntegrityError:
|
||||
self.cursor.execute("UPDATE storage SET value=? WHERE id=?", (value, hash_,))
|
||||
except sqlite3.OperationalError, ex:
|
||||
if not any(_ in ex.message for _ in ('locked', 'I/O')):
|
||||
raise
|
||||
|
||||
if retries == 0:
|
||||
warnMsg = "there has been a problem while writing to "
|
||||
warnMsg += "the session file ('%s')" % ex.message
|
||||
logger.warn(warnMsg)
|
||||
|
||||
if retries >= HASHDB_FLUSH_RETRIES:
|
||||
return
|
||||
else:
|
||||
retries += 1
|
||||
time.sleep(1)
|
||||
else:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user