i lost who sent this to me (sorry). patches to fix AIX.
This commit is contained in:
parent
f67cea44d0
commit
3242df7f09
|
@ -281,7 +281,8 @@ class SSHClient (object):
|
||||||
addr = sockaddr
|
addr = sockaddr
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise SSHException('No suitable address family for %s' % hostname)
|
# some OS like AIX don't indicate SOCK_STREAM support, so just guess. :(
|
||||||
|
af, _, _, _, addr = socket.getaddrinfo(hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
|
||||||
sock = socket.socket(af, socket.SOCK_STREAM)
|
sock = socket.socket(af, socket.SOCK_STREAM)
|
||||||
if timeout is not None:
|
if timeout is not None:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -39,7 +39,7 @@ class SFTPAttributes (object):
|
||||||
are stored in a dict named C{attr}. Occasionally, the filename is also
|
are stored in a dict named C{attr}. Occasionally, the filename is also
|
||||||
stored, in C{filename}.
|
stored, in C{filename}.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
FLAG_SIZE = 1
|
FLAG_SIZE = 1
|
||||||
FLAG_UIDGID = 2
|
FLAG_UIDGID = 2
|
||||||
FLAG_PERMISSIONS = 4
|
FLAG_PERMISSIONS = 4
|
||||||
|
@ -89,7 +89,7 @@ class SFTPAttributes (object):
|
||||||
|
|
||||||
### internals...
|
### internals...
|
||||||
|
|
||||||
|
|
||||||
def _from_msg(cls, msg, filename=None, longname=None):
|
def _from_msg(cls, msg, filename=None, longname=None):
|
||||||
attr = cls()
|
attr = cls()
|
||||||
attr._unpack(msg)
|
attr._unpack(msg)
|
||||||
|
@ -200,7 +200,7 @@ class SFTPAttributes (object):
|
||||||
else:
|
else:
|
||||||
ks = '?---------'
|
ks = '?---------'
|
||||||
# compute display date
|
# compute display date
|
||||||
if (self.st_mtime is None) or (self.st_mtime == 0xffffffff):
|
if (self.st_mtime is None) or (self.st_mtime == 0xffffffffL):
|
||||||
# shouldn't really happen
|
# shouldn't really happen
|
||||||
datestr = '(unknown date)'
|
datestr = '(unknown date)'
|
||||||
else:
|
else:
|
||||||
|
@ -210,7 +210,7 @@ class SFTPAttributes (object):
|
||||||
else:
|
else:
|
||||||
datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime))
|
datestr = time.strftime('%d %b %H:%M', time.localtime(self.st_mtime))
|
||||||
filename = getattr(self, 'filename', '?')
|
filename = getattr(self, 'filename', '?')
|
||||||
|
|
||||||
# not all servers support uid/gid
|
# not all servers support uid/gid
|
||||||
uid = self.st_uid
|
uid = self.st_uid
|
||||||
gid = self.st_gid
|
gid = self.st_gid
|
||||||
|
@ -218,6 +218,6 @@ class SFTPAttributes (object):
|
||||||
uid = 0
|
uid = 0
|
||||||
if gid is None:
|
if gid is None:
|
||||||
gid = 0
|
gid = 0
|
||||||
|
|
||||||
return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename)
|
return '%s 1 %-8d %-8d %8d %-12s %s' % (ks, uid, gid, self.st_size, datestr, filename)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue