1. 13 Jan, 2021 4 commits
    • Kirill Smelkov's avatar
      55476bd0
    • Kirill Smelkov's avatar
      . · b9009ed2
      Kirill Smelkov authored
      b9009ed2
    • Kirill Smelkov's avatar
      Merge branch 'master' into t · aea23d6c
      Kirill Smelkov authored
      * master:
        go/neo/neonet: Fix thinko in recvPkt
      aea23d6c
    • Kirill Smelkov's avatar
      Y ssl: Don't ignore non-ragged EOF · 8628699c
      Kirill Smelkov authored
      Testing NEO/go client wrt NEO/py server revealed a bug in NEO/py SSL
      handling: proper non-ragged EOF from a peer is ignored, and so leads to
      hang in infinite loop inside _SSL.receive with read_buf memory growing
      indefinitely. Details are below:
      
      NEO/py wraps raw sockets with
      
      	ssl.wrap_socket(suppress_ragged_eofs=False)
      
      which instructs SSL layer to convert unexpected EOF when receiving a TLS
      record into SSLEOFError exception. However when remote peer properly
      closes its side of the connection, socket.read() still returns b'' to
      report non-ragged regular EOF:
      
      https://github.com/python/cpython/blob/v2.7.18/Lib/ssl.py#L630-L650
      
      The code was handling SSLEOFError but not b'' return from socket recv.
      Thus after NEO/go client was disconnecting and properly closing its side
      of the connection, the code started to loop indefinitely in _SSL.receive
      under `while 1` with  b'' returned by self.socket.recv() appended to
      read_buf again and again.
      
      -> Fix it by detecting non-ragged EOF as well and, similarly to how
      SSLEOFError is handled, converting them into self._error('recv', None).
      8628699c
  2. 12 Jan, 2021 11 commits
    • Kirill Smelkov's avatar
      6a1decde
    • Kirill Smelkov's avatar
      . · 2243abc5
      Kirill Smelkov authored
      2243abc5
    • Kirill Smelkov's avatar
      X Split Handshake into HandshakeClient + HandshakeServer · caafdbaa
      Kirill Smelkov authored
      Dial will use handshakeClient with options and retries.
      caafdbaa
    • Kirill Smelkov's avatar
      go/neo/neonet: Fix thinko in recvPkt · 4f6adb26
      Kirill Smelkov authored
      We were returning packet with tail read for next packet data.
      Previously decoding was forgiving, but upcoming rework for msgpack
      support will add check to catch packets with overlong payload, e.g.
      
          === RUN   TestEmptyDB/py/!ssl
          I: runneo.py: /tmp/neo214694750/1 !ssl: started master(s): 127.0.0.1:30621
          127.0.0.1:42266 > 127.0.0.1:30621: .1 RequestIdentification &{CLIENT ?(0)0  1 ø [] []}
          127.0.0.1:42266 < 127.0.0.1:30621: (N: decode header: len(payload) != msgLen) 00 00 00 01 80 01 00 00 00 09 00 f0 00 00 01 e0 00 00 01 00 00 00 00 00 06 00 00 00 58 41 d7 ff 69 82 0a 91 25 00 00 00 03 02 00 00 00 00 e0 00 00 01 02 41 d7 ff 69 82 0a 78 ff 01 00 00 00 09 31 32 37 2e 30 2e 30 2e 31 96 f7 00 00 00 01 02 41 d7 ff 69 81 c6 65 f5 00 00 00 00 09 31 32 37 2e 30 2e 30 2e 31 77 9d f0 00 00 01 02 ff ff ff ff ff ff ff ff 00 00 00 02 00 0a 00 00 00 19 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 01
      
      -> Fix is: pkt.data should be data[:pktLen], not data[:n] since n is how
      much we have read at all.
      4f6adb26
    • Kirill Smelkov's avatar
      . · 655906f5
      Kirill Smelkov authored
      655906f5
    • Kirill Smelkov's avatar
      X go/neo/neonet: Fix thinko in recvPktN · bf824e6c
      Kirill Smelkov authored
      We were retruning packet with tail read for next packet data.
      Previously decoding was forgiving, but recent rework along msgpack
      support added check that is now failing, e.g.
      
          === RUN   TestEmptyDB/py/!ssl
          I: runneo.py: /tmp/neo214694750/1 !ssl: started master(s): 127.0.0.1:30621
          127.0.0.1:42266 > 127.0.0.1:30621: .1 RequestIdentification &{CLIENT ?(0)0  1 ø [] []}
          127.0.0.1:42266 < 127.0.0.1:30621: (N: decode header: len(payload) != msgLen) 00 00 00 01 80 01 00 00 00 09 00 f0 00 00 01 e0 00 00 01 00 00 00 00 00 06 00 00 00 58 41 d7 ff 69 82 0a 91 25 00 00 00 03 02 00 00 00 00 e0 00 00 01 02 41 d7 ff 69 82 0a 78 ff 01 00 00 00 09 31 32 37 2e 30 2e 30 2e 31 96 f7 00 00 00 01 02 41 d7 ff 69 81 c6 65 f5 00 00 00 00 09 31 32 37 2e 30 2e 30 2e 31 77 9d f0 00 00 01 02 ff ff ff ff ff ff ff ff 00 00 00 02 00 0a 00 00 00 19 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00 01 01
      
      -> Fix is: pkt.data should be data[:pktLen], not data[:n] since n is how
      much we have read at all.
      bf824e6c
    • Kirill Smelkov's avatar
      . · 97cbe2b8
      Kirill Smelkov authored
      97cbe2b8
    • Kirill Smelkov's avatar
      . · 4c098a14
      Kirill Smelkov authored
      4c098a14
    • Kirill Smelkov's avatar
      . · 4f871a72
      Kirill Smelkov authored
      4f871a72
    • Kirill Smelkov's avatar
      . · bebc5e77
      Kirill Smelkov authored
      bebc5e77
    • Kirill Smelkov's avatar
      . · 35d32ba6
      Kirill Smelkov authored
      35d32ba6
  3. 10 Jan, 2021 2 commits
  4. 05 Jan, 2021 1 commit
  5. 03 Jan, 2021 22 commits