projects
/
mirror
/
userdir-ldap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
26042a7
)
Add IPv6-Adresses (and IPv4 in both ways) into ssh_known_hosts
author
Andreas Barth
<aba@alioth>
Sat, 10 May 2008 21:49:42 +0000
(21:49 +0000)
committer
Andreas Barth
<aba@alioth>
Sat, 10 May 2008 21:49:42 +0000
(21:49 +0000)
ud-generate
patch
|
blob
|
history
diff --git
a/ud-generate
b/ud-generate
index
b5594fe
..
30a1111
100755
(executable)
--- a/
ud-generate
+++ b/
ud-generate
@@
-718,12
+718,20
@@
def GenSSHKnown(l,File):
x[1].has_key("sshRSAHostKey") == 0:
continue;
Host = GetAttr(x,"hostname");
x[1].has_key("sshRSAHostKey") == 0:
continue;
Host = GetAttr(x,"hostname");
+ HostNames = [ Host ]
SHost = Host.find(".")
SHost = Host.find(".")
+ if SHost != None: HostNames += [Host[0:SHost]]
+
+ IPAdressesT = None
+ try:
+ IPAdressesT = set([ (a[0],a[4][0]) for a in socket.getaddrinfo(Host, None)])
+ except:
+ if code[0] != -2: raise
+ for addr in IPAdressesT:
+ if addr[0] == socket.AF_INET: IPAdresses += [addr[1], "::ffff:"+addr[1]]
+ else: IPAdresses += [addr[1]]
for I in x[1]["sshRSAHostKey"]:
for I in x[1]["sshRSAHostKey"]:
- if SHost == None:
- Line = "%s,%s %s" %(Host,socket.gethostbyname(Host),I);
- else:
- Line = "%s,%s,%s %s" %(Host,Host[0:SHost],socket.gethostbyname(Host),I);
+ Line = "%s,%s %s" %(",".join(HostNames + IPAdresses), I);
Line = Sanitize(Line) + "\n";
F.write(Line);
# Oops, something unspeakable happened.
Line = Sanitize(Line) + "\n";
F.write(Line);
# Oops, something unspeakable happened.