Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
1c7bf350
Commit
1c7bf350
authored
Mar 14, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added security to SQL methods (!)
parent
60d74be4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
lib/python/Shared/DC/ZRDB/DA.py
lib/python/Shared/DC/ZRDB/DA.py
+27
-6
No files found.
lib/python/Shared/DC/ZRDB/DA.py
View file @
1c7bf350
...
...
@@ -85,8 +85,8 @@
__doc__
=
'''Generic Database adapter
$Id: DA.py,v 1.7
8 2000/01/10 23:05:51 amos
Exp $'''
__version__
=
'$Revision: 1.7
8
$'
[
11
:
-
2
]
$Id: DA.py,v 1.7
9 2000/03/14 19:26:32 brian
Exp $'''
__version__
=
'$Revision: 1.7
9
$'
[
11
:
-
2
]
import
OFS.SimpleItem
,
Aqueduct
,
RDB
import
DocumentTemplate
,
marshal
,
md5
,
base64
,
Acquisition
,
os
...
...
@@ -97,6 +97,8 @@ from cStringIO import StringIO
import
sys
,
Globals
,
OFS
.
SimpleItem
,
AccessControl
.
Role
from
string
import
atoi
,
find
,
join
,
split
import
DocumentTemplate
,
sqlvar
,
sqltest
,
sqlgroup
from
AccessControl.User
import
verify_watermark
from
DocumentTemplate.DT_Util
import
cDocument
from
time
import
time
from
zlib
import
compress
,
decompress
from
DateTime.DateTime
import
DateTime
...
...
@@ -107,18 +109,27 @@ from cPickle import dumps, loads
from
Results
import
Results
from
App.Extensions
import
getBrain
try
:
from
IOBTree
import
Bucket
except
:
Bucket
=
lambda
:{}
class
SQL
(
DocumentTemplate
.
HTML
):
class
nvSQL
(
DocumentTemplate
.
HTML
):
# Non-validating SQL Template for use by SQLFiles.
commands
=
{}
for
k
,
v
in
DocumentTemplate
.
HTML
.
commands
.
items
():
commands
[
k
]
=
v
commands
[
'sqlvar'
]
=
sqlvar
.
SQLVar
commands
[
'sqltest'
]
=
sqltest
.
SQLTest
commands
[
'sqlgroup'
]
=
sqlgroup
.
SQLGroup
_proxy_roles
=
()
class
SQL
(
cDocument
,
nvSQL
):
# Validating SQL template for Zope SQL Methods.
pass
class
DA
(
Aqueduct
.
BaseQuery
,
Acquisition
.
Implicit
,
...
...
@@ -135,6 +146,7 @@ class DA(
class_name_
=
class_file_
=
''
_zclass
=
None
allow_simple_one_argument_traversal
=
None
template_class
=
SQL
manage_options
=
(
{
'label'
:
'Edit'
,
'action'
:
'manage_main'
,
...
...
@@ -224,7 +236,7 @@ class DA(
self
.
arguments_src
=
arguments
self
.
_arg
=
parse
(
arguments
)
self
.
src
=
template
self
.
template
=
t
=
SQL
(
template
)
self
.
template
=
t
=
self
.
template_class
(
template
)
t
.
cook
()
self
.
_v_cache
=
{},
Bucket
()
if
REQUEST
:
...
...
@@ -412,7 +424,14 @@ class DA(
argdata
=
self
.
_argdata
(
REQUEST
)
argdata
[
'sql_delimiter'
]
=
'
\
0
'
argdata
[
'sql_quote__'
]
=
dbc
.
sql_quote__
query
=
apply
(
self
.
template
,
(
p
,),
argdata
)
# Also need the authenticated user.
if
REQUEST
.
has_key
(
'AUTHENTICATED_USER'
):
auth_user
=
REQUEST
[
'AUTHENTICATED_USER'
]
verify_watermark
(
auth_user
)
argdata
[
'AUTHENTICATED_USER'
]
=
auth_user
query
=
apply
(
self
.
template
,
(
p
,
argdata
))
if
src__
:
return
query
...
...
@@ -479,6 +498,8 @@ class DA(
return
r
Globals
.
default__class_init__
(
DA
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment