Skip to content

Commit

Permalink
The client also needs to be able to unpickle zodbpickle.binary
Browse files Browse the repository at this point in the history
Fixes #113
  • Loading branch information
jamadden committed Mar 28, 2018
1 parent 6693ddf commit 48946af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Changelog
with Python 3.7. See `issue 104
<https://github.com/zopefoundation/ZEO/issues/104>`_.

- Fix: Client-side updates for ZODB 5.4.0 or databases that already
had ``zodbpickle.binary`` OIDs. See `issue 113
<https://github.com/zopefoundation/ZEO/issues/113>`_.

5.1.2 (2018-03-27)
------------------

Expand Down
7 changes: 5 additions & 2 deletions src/ZEO/asyncio/marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .._compat import Unpickler, Pickler, BytesIO, PY3, PYPY
from ..shortrepr import short_repr

PY2 = not PY3
logger = logging.getLogger(__name__)

def encoder(protocol, server=False):
Expand Down Expand Up @@ -132,6 +133,8 @@ def reduce_exception(exc):

exception_type_type = type(Exception)

_SAFE_MODULE_NAMES = ('ZopeUndo.Prefix', 'copy_reg', '__builtin__', 'zodbpickle')

def find_global(module, name):
"""Helper for message unpickler"""
try:
Expand All @@ -144,7 +147,7 @@ def find_global(module, name):
except AttributeError:
raise ImportError("module %s has no global %s" % (module, name))

safe = getattr(r, '__no_side_effects__', 0)
safe = getattr(r, '__no_side_effects__', 0) or (PY2 and module in _SAFE_MODULE_NAMES)
if safe:
return r

Expand All @@ -156,7 +159,7 @@ def find_global(module, name):

def server_find_global(module, name):
"""Helper for message unpickler"""
if module not in ('ZopeUndo.Prefix', 'copy_reg', '__builtin__', 'zodbpickle'):
if module not in _SAFE_MODULE_NAMES:
raise ImportError("Module not allowed: %s" % (module,))

try:
Expand Down

0 comments on commit 48946af

Please sign in to comment.