1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Ansgar Wiechers points out that known_hosts (at least OpenSSH's) has grown a

means of specifying port numbers, so we should support that.

[originally from svn r8519]
This commit is contained in:
Jacob Nevins 2009-04-26 23:44:28 +00:00
parent 54c3773c91
commit 8b88d653de

View File

@ -132,9 +132,13 @@ for line in fileinput.input(args):
sys.stderr.write("Skipping hashed hostname '%s'\n" % host)
continue
else:
# Slightly bizarre key format: 'type@port:hostname'
# As far as I know, the input never specifies a port.
port = 22
m = re.match (r"\[([^]]*)\]:(\d*)$", host)
if m:
(host, port) = m.group(1,2)
port = int(port)
else:
port = 22
# Slightly bizarre output key format: 'type@port:hostname'
# XXX: does PuTTY do anything useful with literal IP[v4]s?
key = keytype + ("@%d:%s" % (port, host))
value = string.join (map (longtohex, magicnumbers), ',')