author | Edouard Tisserant |
Fri, 10 Jan 2020 13:15:07 +0100 | |
branch | svghmi |
changeset 2822 | 9101a72a1da0 |
parent 2598 | 46df689dbc3b |
child 3750 | f62625418bff |
permissions | -rw-r--r-- |
2544
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
1 |
#!/usr/bin/env python |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
3 |
|
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
4 |
# This file is part of Beremiz, a Integrated Development Environment for |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
5 |
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
6 |
# |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
7 |
# Copyright (C) 2019: Edouard TISSERANT |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
8 |
# |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
9 |
# See COPYING file for copyrights details. |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
10 |
# |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
11 |
# This program is free software; you can redistribute it and/or |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
12 |
# modify it under the terms of the GNU General Public License |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
13 |
# as published by the Free Software Foundation; either version 2 |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
14 |
# of the License, or (at your option) any later version. |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
15 |
# |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
16 |
# This program is distributed in the hope that it will be useful, |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
19 |
# GNU General Public License for more details. |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
20 |
# |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
21 |
# You should have received a copy of the GNU General Public License |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
22 |
# along with this program; if not, write to the Free Software |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
23 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
24 |
|
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
25 |
|
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
26 |
""" |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
27 |
The TLS-PSK adapter that handles SSL connections instead of regular sockets, |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
28 |
but using Pre Shared Keys instead of Certificates |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
29 |
""" |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
30 |
|
2313
2eaf235270f8
PYRO/TLSPSK : fixed typos, used appropriate ciphers (https://github.com/drbild/sslpsk/issues/3), use PYROPSK instead of unresolvable PYROLOCPSK.
Edouard Tisserant
parents:
2312
diff
changeset
|
31 |
from __future__ import absolute_import |
2eaf235270f8
PYRO/TLSPSK : fixed typos, used appropriate ciphers (https://github.com/drbild/sslpsk/issues/3), use PYROPSK instead of unresolvable PYROLOCPSK.
Edouard Tisserant
parents:
2312
diff
changeset
|
32 |
from __future__ import print_function |
2312 | 33 |
|
2313
2eaf235270f8
PYRO/TLSPSK : fixed typos, used appropriate ciphers (https://github.com/drbild/sslpsk/issues/3), use PYROPSK instead of unresolvable PYROLOCPSK.
Edouard Tisserant
parents:
2312
diff
changeset
|
34 |
import socket |
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
35 |
import re |
2537
eb4a4cc41914
Fix various pylint and pep8 errors
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2536
diff
changeset
|
36 |
import ssl |
2312 | 37 |
import Pyro |
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
38 |
from Pyro.core import PyroURI |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
39 |
from Pyro.protocol import _connect_socket, TCPConnection, PYROAdapter |
2312 | 40 |
from Pyro.errors import ConnectionDeniedError, ProtocolError |
41 |
from Pyro.util import Log |
|
42 |
||
2588
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
43 |
try: |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
44 |
import sslpsk |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
45 |
except ImportError as e: |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
46 |
print(str(e)) |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
47 |
sslpsk = None |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
48 |
|
2598
46df689dbc3b
pep8 again...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2597
diff
changeset
|
49 |
|
2312 | 50 |
class PYROPSKAdapter(PYROAdapter): |
2544
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
51 |
""" |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
52 |
This is essentialy the same as in Pyro/protocol.py |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
53 |
only raw_sock wrapping into sock through sslpsk.wrap_socket was added |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
54 |
Pyro unfortunately doesn't allow cleaner customization |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
55 |
""" |
640d639d9bd8
Fix header and convert comments to docstrings in PSK_Adapter
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2543
diff
changeset
|
56 |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
57 |
def bindToURI(self, URI): |
2312 | 58 |
with self.lock: # only 1 thread at a time can bind the URI |
59 |
try: |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
60 |
self.URI = URI |
2312 | 61 |
|
62 |
# This are the statements that differ from Pyro/protocol.py |
|
63 |
raw_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
64 |
_connect_socket(raw_sock, URI.address, URI.port, self.timeout) |
|
65 |
sock = sslpsk.wrap_socket( |
|
2313
2eaf235270f8
PYRO/TLSPSK : fixed typos, used appropriate ciphers (https://github.com/drbild/sslpsk/issues/3), use PYROPSK instead of unresolvable PYROLOCPSK.
Edouard Tisserant
parents:
2312
diff
changeset
|
66 |
raw_sock, psk=Pyro.config.PYROPSK, server_side=False, |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
67 |
ciphers="PSK-AES256-CBC-SHA", # available in openssl 1.0.2 |
2316
5416c76df9e2
Fix PYROPSK protocol configuration. After a few iteration of trial and error it appears that TSLv1 and PSK ciphers needs to be specified
Edouard Tisserant
parents:
2314
diff
changeset
|
68 |
ssl_version=ssl.PROTOCOL_TLSv1) |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
69 |
# all the rest is the same as in Pyro/protocol.py |
2312 | 70 |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
71 |
conn = TCPConnection(sock, sock.getpeername()) |
2312 | 72 |
# receive the authentication challenge string, and use that to build the actual identification string. |
73 |
try: |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
74 |
authChallenge = self.recvAuthChallenge(conn) |
2536
2747d6e72eb8
Fix invalid python3 syntax
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2492
diff
changeset
|
75 |
except ProtocolError as x: |
2312 | 76 |
# check if we were denied |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
77 |
if hasattr(x, "partialMsg") and x.partialMsg[:len(self.denyMSG)] == self.denyMSG: |
2312 | 78 |
raise ConnectionDeniedError(Pyro.constants.deniedReasons[int(x.partialMsg[-1])]) |
79 |
else: |
|
80 |
raise |
|
81 |
# reply with our ident token, generated from the ident passphrase and the challenge |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
82 |
msg = self._sendConnect(sock, self.newConnValidator.createAuthToken(self.ident, authChallenge, conn.addr, self.URI, None)) |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
83 |
if msg == self.acceptMSG: |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
84 |
self.conn = conn |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
85 |
self.conn.connected = 1 |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
86 |
Log.msg('PYROAdapter', 'connected to', str(URI)) |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
87 |
if URI.protocol == 'PYROLOCPSK': |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
88 |
self.resolvePYROLOC_URI("PYROPSK") # updates self.URI |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
89 |
elif msg[:len(self.denyMSG)] == self.denyMSG: |
2312 | 90 |
try: |
91 |
raise ConnectionDeniedError(Pyro.constants.deniedReasons[int(msg[-1])]) |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
92 |
except (KeyError, ValueError): |
2312 | 93 |
raise ConnectionDeniedError('invalid response') |
94 |
except socket.error: |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
95 |
Log.msg('PYROAdapter', 'connection failed to URI', str(URI)) |
2312 | 96 |
raise ProtocolError('connection failed') |
97 |
||
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
98 |
|
2312 | 99 |
_getProtocolAdapter = Pyro.protocol.getProtocolAdapter |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
100 |
|
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
101 |
|
2312 | 102 |
def getProtocolAdapter(protocol): |
103 |
if protocol in ('PYROPSK', 'PYROLOCPSK'): |
|
104 |
return PYROPSKAdapter() |
|
2318
8925d487605a
Fixed PYRO's PSK_Adapter : monkey patching was breaking non-PSK protocol, and import ssl was missing.
Edouard Tisserant
parents:
2316
diff
changeset
|
105 |
return _getProtocolAdapter(protocol) |
2312 | 106 |
|
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
107 |
|
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
108 |
_processStringURI = Pyro.core.processStringURI |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
109 |
|
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
110 |
|
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
111 |
def processStringURI(URI): |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
112 |
x = re.match(r'(?P<protocol>PYROLOCPSK)://(?P<hostname>[^\s:]+):?(?P<port>\d+)?/(?P<name>\S*)', URI) |
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
113 |
if x: |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
114 |
protocol = x.group('protocol') |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
115 |
hostname = x.group('hostname') |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
116 |
port = x.group('port') |
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
117 |
if port: |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
118 |
port = int(port) |
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
119 |
else: |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
120 |
port = 0 |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
121 |
name = x.group('name') |
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
122 |
return PyroURI(hostname, name, port, protocol) |
2314
e927c101ce6d
PYRO/TLSPSK : must use PYROLOC* protocol scheme in pyro URI, otherwise object ID is missing. Had to use more persuasive pyro3 monkey patching to have PYROLOCPSK resolved properly
Edouard Tisserant
parents:
2313
diff
changeset
|
123 |
return _processStringURI(URI) |
2492
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
124 |
|
7dd551ac2fa0
check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2325
diff
changeset
|
125 |
|
2543
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
126 |
def setupPSKAdapter(): |
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
127 |
""" |
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
128 |
Add PyroAdapter to the list of available in |
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
129 |
Pyro adapters and handle new supported protocols |
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
130 |
|
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
131 |
This function should be called after |
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
132 |
reimport of Pyro module to enable PYROS:// again. |
2befed4d6ca8
Fix Pyro work with SSL wrapper (sslpsk)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2537
diff
changeset
|
133 |
""" |
2588
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
134 |
if sslpsk is not None: |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
135 |
Pyro.protocol.getProtocolAdapter = getProtocolAdapter |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
136 |
Pyro.core.processStringURI = processStringURI |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
137 |
else: |
25f19b76c7b6
Allow starting IDE without sslpsk module installed. Fail when connecting to PYROS if sslpsk unavailable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2544
diff
changeset
|
138 |
raise Exception("sslpsk python module unavailable") |