Fix error in SSH TTYPE parsing that made text not go through correctly on an SSH connection.
This commit is contained in:
parent
da4e35ee9a
commit
301efe4467
1 changed files with 15 additions and 6 deletions
|
|
@ -17,13 +17,22 @@ from twisted.cred.checkers import credentials
|
||||||
from twisted.cred.portal import Portal
|
from twisted.cred.portal import Portal
|
||||||
from twisted.conch.interfaces import IConchUser
|
from twisted.conch.interfaces import IConchUser
|
||||||
|
|
||||||
|
_SSH_IMPORT_ERROR = """
|
||||||
|
ERROR: Missing crypto library for SSH. Install it with
|
||||||
|
|
||||||
|
pip install cryptography
|
||||||
|
|
||||||
|
(On older Twisted versions you may have to do 'pip install pycrypto pyasn1 instead).
|
||||||
|
|
||||||
|
If you get a compilation error you must install a C compiler and the
|
||||||
|
SSL dev headers (On Debian-derived systems this is the gcc and libssl-dev
|
||||||
|
packages).
|
||||||
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from twisted.conch.ssh.keys import Key
|
from twisted.conch.ssh.keys import Key
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError ("To use SSH, you need to install the crypto libraries:\n"
|
raise ImportError (_SSH_IMPORT_ERROR)
|
||||||
" pip install cryptography\n"
|
|
||||||
"(on older Twisted versions you may instead have to try "
|
|
||||||
"pip install pycrypto pyasn1)\n")
|
|
||||||
|
|
||||||
from twisted.conch.ssh.userauth import SSHUserAuthServer
|
from twisted.conch.ssh.userauth import SSHUserAuthServer
|
||||||
from twisted.conch.ssh import common
|
from twisted.conch.ssh import common
|
||||||
|
|
@ -256,8 +265,8 @@ class SshProtocol(Manhole, session.Session):
|
||||||
# handle arguments
|
# handle arguments
|
||||||
options = kwargs.get("options", {})
|
options = kwargs.get("options", {})
|
||||||
flags = self.protocol_flags
|
flags = self.protocol_flags
|
||||||
xterm256 = options.get("xterm256", flags.get('XTERM256', False) if flags["TTYPE"] else True)
|
xterm256 = options.get("xterm256", flags.get('XTERM256', False) if flags.get("TTYPE") else True)
|
||||||
useansi = options.get("ansi", flags.get('ANSI', False) if flags["TTYPE"] else True)
|
useansi = options.get("ansi", flags.get('ANSI', False) if flags.get("TTYPE") else True)
|
||||||
raw = options.get("raw", flags.get("RAW", False))
|
raw = options.get("raw", flags.get("RAW", False))
|
||||||
nomarkup = options.get("nomarkup", flags.get("NOMARKUP", not (xterm256 or useansi)))
|
nomarkup = options.get("nomarkup", flags.get("NOMARKUP", not (xterm256 or useansi)))
|
||||||
#echo = options.get("echo", None)
|
#echo = options.get("echo", None)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue