Skip to content

Commit

Permalink
bug 411910: when asking for a sockaddr, ask for streams only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robey Pointer committed Nov 2, 2009
1 parent a60c69c commit c628faa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion paramiko/client.py
Expand Up @@ -273,7 +273,7 @@ def connect(self, hostname, port=22, username=None, password=None, pkey=None,
establishing an SSH session
@raise socket.error: if a socket error occurred while connecting
"""
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port):
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
if socktype == socket.SOCK_STREAM:
af = family
addr = sockaddr
Expand Down
2 changes: 1 addition & 1 deletion paramiko/transport.py
Expand Up @@ -285,7 +285,7 @@ def __init__(self, sock):
if type(sock) is tuple:
# connect to the given (host, port)
hostname, port = sock
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port):
for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM):
if socktype == socket.SOCK_STREAM:
af = family
addr = sockaddr
Expand Down

0 comments on commit c628faa

Please sign in to comment.