Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 278824 | Differences between
and this patch

Collapse All | Expand All

(-)lib/python/ZEO/StorageServer.py (-1 / +2 lines)
Lines 98-104 class ZEOStorage: Link Here
98
        for func in self.extensions:
98
        for func in self.extensions:
99
            self._extensions[func.func_name] = None
99
            self._extensions[func.func_name] = None
100
100
101
    def finish_auth(self, authenticated):
101
    def _finish_auth(self, authenticated):
102
        if not self.auth_realm:
102
        if not self.auth_realm:
103
            return 1
103
            return 1
104
        self.authenticated = authenticated
104
        self.authenticated = authenticated
Lines 350-355 class ZEOStorage: Link Here
350
350
351
    def new_oids(self, n=100):
351
    def new_oids(self, n=100):
352
        """Return a sequence of n new oids, where n defaults to 100"""
352
        """Return a sequence of n new oids, where n defaults to 100"""
353
        n = min(n, 100)
353
        if self.read_only:
354
        if self.read_only:
354
            raise ReadOnlyError()
355
            raise ReadOnlyError()
355
        if n <= 0:
356
        if n <= 0:
(-)lib/python/ZEO/auth/auth_digest.py (-1 / +1 lines)
Lines 121-127 class StorageClass(ZEOStorage): Link Here
121
        check = hexdigest("%s:%s" % (h_up, challenge))
121
        check = hexdigest("%s:%s" % (h_up, challenge))
122
        if check == response:
122
        if check == response:
123
            self.connection.setSessionKey(session_key(h_up, self._key_nonce))
123
            self.connection.setSessionKey(session_key(h_up, self._key_nonce))
124
        return self.finish_auth(check == response)
124
        return self._finish_auth(check == response)
125
125
126
    extensions = [auth_get_challenge, auth_response]
126
    extensions = [auth_get_challenge, auth_response]
127
127
(-)lib/python/ZEO/tests/auth_plaintext.py (-1 / +1 lines)
Lines 41-47 class StorageClass(ZEOStorage): Link Here
41
            self.connection.setSessionKey(session_key(username,
41
            self.connection.setSessionKey(session_key(username,
42
                                                      self.database.realm,
42
                                                      self.database.realm,
43
                                                      password))
43
                                                      password))
44
        return self.finish_auth(dbpw == password_dig)
44
        return self._finish_auth(dbpw == password_dig)
45
45
46
class PlaintextClient(Client):
46
class PlaintextClient(Client):
47
    extensions = ["auth"]
47
    extensions = ["auth"]
(-)lib/python/ZEO/zrpc/connection.py (-1 / +2 lines)
Lines 22-28 import logging Link Here
22
import ThreadedAsync
22
import ThreadedAsync
23
from ZEO.zrpc import smac
23
from ZEO.zrpc import smac
24
from ZEO.zrpc.error import ZRPCError, DisconnectedError
24
from ZEO.zrpc.error import ZRPCError, DisconnectedError
25
from ZEO.zrpc.marshal import Marshaller
25
from ZEO.zrpc.marshal import Marshaller, ServerMarshaller
26
from ZEO.zrpc.trigger import trigger
26
from ZEO.zrpc.trigger import trigger
27
from ZEO.zrpc.log import short_repr, log
27
from ZEO.zrpc.log import short_repr, log
28
from ZODB.loglevels import BLATHER, TRACE
28
from ZODB.loglevels import BLATHER, TRACE
Lines 716-721 class ManagedServerConnection(Connection Link Here
716
    def __init__(self, sock, addr, obj, mgr):
716
    def __init__(self, sock, addr, obj, mgr):
717
        self.mgr = mgr
717
        self.mgr = mgr
718
        self.__super_init(sock, addr, obj, 'S')
718
        self.__super_init(sock, addr, obj, 'S')
719
        self.marshal = ServerMarshaller()
719
        self.obj.notifyConnected(self)
720
        self.obj.notifyConnected(self)
720
721
721
    def handshake(self):
722
    def handshake(self):
(-)lib/python/ZEO/zrpc/marshal.py (+32 lines)
Lines 53-58 class Marshaller: Link Here
53
                level=logging.ERROR)
53
                level=logging.ERROR)
54
            raise
54
            raise
55
55
56
class ServerMarshaller(Marshaller):
57
58
    def decode(self, msg):
59
        """Decodes msg and returns its parts"""
60
        unpickler = cPickle.Unpickler(StringIO(msg))
61
        unpickler.find_global = server_find_global
62
63
        try:
64
            return unpickler.load() # msgid, flags, name, args
65
        except:
66
            log("can't decode message: %s" % short_repr(msg),
67
                level=logging.ERROR)
68
            raise
69
56
_globals = globals()
70
_globals = globals()
57
_silly = ('__doc__',)
71
_silly = ('__doc__',)
58
72
Lines 77-79 def find_global(module, name): Link Here
77
        return r
91
        return r
78
92
79
    raise ZRPCError("Unsafe global: %s.%s" % (module, name))
93
    raise ZRPCError("Unsafe global: %s.%s" % (module, name))
94
95
def server_find_global(module, name):
96
    """Helper for message unpickler"""
97
    try:
98
        m = __import__(module, _globals, _globals, _silly)
99
    except ImportError, msg:
100
        raise ZRPCError("import error %s: %s" % (module, msg))
101
102
    try:
103
        r = getattr(m, name)
104
    except AttributeError:
105
        raise ZRPCError("module %s has no global %s" % (module, name))
106
107
    safe = getattr(r, '__no_side_effects__', 0)
108
    if safe:
109
        return r
110
111
    raise ZRPCError("Unsafe global: %s.%s" % (module, name))

Return to bug 278824