minor improvement when --dbs returns no database names (like in many cases with MySQL 4)

This commit is contained in:
Miroslav Stampar 2011-03-25 19:50:06 +00:00
parent 5eb7787fc9
commit af39a441fa

View File

@ -692,8 +692,8 @@ class Enumeration:
if not isNumPosStrValue(count): if not isNumPosStrValue(count):
errMsg = "unable to retrieve the number of databases" errMsg = "unable to retrieve the number of databases"
raise sqlmapNoneDataException, errMsg logger.error(errMsg)
else:
if Backend.getIdentifiedDbms() == DBMS.ORACLE: if Backend.getIdentifiedDbms() == DBMS.ORACLE:
plusOne = True plusOne = True
else: else:
@ -713,6 +713,13 @@ class Enumeration:
kb.data.cachedDbs.append(db) kb.data.cachedDbs.append(db)
if not kb.data.cachedDbs: if not kb.data.cachedDbs:
infoMsg = "falling back to current database"
logger.info(infoMsg)
self.getCurrentDb()
if kb.data.currentDb:
kb.data.cachedDbs = [kb.data.currentDb]
else:
errMsg = "unable to retrieve the database names" errMsg = "unable to retrieve the database names"
raise sqlmapNoneDataException, errMsg raise sqlmapNoneDataException, errMsg