[Python-bugs-list] [ python-Bugs-610692 ] telnetlib.py exception in process_rawq
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 17 Sep 2002 11:13:01 -0700
Bugs item #610692, was opened at 2002-09-18 02:13
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=610692&group_id=5470
Category: Python Library
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Williams (andreww5)
Assigned to: Nobody/Anonymous (nobody)
Summary: telnetlib.py exception in process_rawq
Initial Comment:
An unrecognised IAC in the process_rawq method in
telnetlib.py throws an exception. The final 'else' clause
in the if/elif structure uses a local variable ('opt') that is
guaranteed not to have been assigned if that block is
executed.
In versions 2.2 and up, the offending lines look like:
c = self.rawq_getchar()
...
if c == IAC:
buf = buf + c
elif c in (DO, DONT):
opt = self.rawq_getchar()
...
elif c in (WILL, WONT):
opt = self.rawq_getchar()
...
else:
self.msg('IAC %d not recognized' % ord(opt))
The 1.5.2 and 2.1 telnetlib.py work, becuase the if/elif
structure ends with
else:
self.msg('IAC %s not recognized' % `c`)
Changing that line in the new code to refer to 'c' instead
of 'opt' seems to fix the problem (and looks like what
you want to report anyway, although I don't understand
the telnet protocol).
It looks like it's only a problem with wierd telnet servers -
in particular, an LP-Mud based system on port 4242 at
flame.ucc.gu.uwa.edu.au, if you want to reproduce the
bug.
I've attached a program that demonstrates the exception
(it happens after successful login - choose an initial
username or use 'test').
The same exception happens in windows, MacOS X,
and unix, although CR/LF issues cause a few problems
actually logging in under windows.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=610692&group_id=5470