Opened 5 years ago

Last modified 5 years ago

#4226 enhancement new

conch\telnet.py does not allow for Binary Transmission or End of Record

Reported by: kench Owned by:
Priority: normal Milestone:
Component: conch Keywords: telnet
Cc: Branch:
Author: Launchpad Bug:

Description

The state machine as implemented in the Telnet.dataReceived method will have problems when the options for Binary Transmission (RFC856) or End of Record (RFC885) have been negotiated, whether explicitly or implicitly as part of some other negotiated option, such as TN3270E (RFC2355).

(1) When the telnet session is in binary mode the state machine should not be transitioning into 'newline' state when a byte value of '\r' is encountered.

(2) It needs to allow for receiving an IAC EOR command delimiting a data record.

Change History (4)

comment:1 Changed 5 years ago by kench

Suggestion for (1): Define a new attribute, self.binaryMode = False, that can then be overridden to True when an option requiring binary mode is negotiated. Then use that attribute in Telnet.dataReceived to guard the transition to 'newline' state:

            if self.state == 'data':
                if b == IAC:
                ...
-                elif b == '\r':
+                elif b == '\r' and not self.binaryMode:
                    self.state = 'newline'

Suggestion for (2): Define a new command constant for EOR and add another elif clause to the 'escaped' state:

+EOR =            chr(239) # End of record.
            ...
            elif self.state == 'escaped':
                if b == IAC:
                ...
+                elif b == EOR:
+                    self.state = 'data'
+                    appDataBuffer.extend([IAC, EOR])
                else:

comment:2 follow-up: Changed 5 years ago by exarkun

Should IAC EOR really be delivered as application bytes? I have perhaps imagined something more like the commandReceived case for this.

comment:3 in reply to: ↑ 2 Changed 5 years ago by kench

Replying to exarkun:

Should IAC EOR really be delivered as application bytes? I have perhaps imagined something more like the commandReceived case for this.

Despite being implemented as an IAC command, IAC EOR is a delimiter -- more like a CR/LF than a "command".

comment:4 Changed 3 years ago by <automation>

  • Owner z3p deleted
Note: See TracTickets for help on using tickets.