Skip to content

Commit b00a4da

Browse files
author
Pan
committed
Use SFTP flags for reading
1 parent 2420134 commit b00a4da

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Fixes
1414
--------
1515

1616
* ``ParallelSSH2Client.join`` timeout duration was incorrectly for per-host rather than total.
17+
* SFTP read flags were not fully portable.
1718

1819
1.3.2
1920
++++++

pssh/ssh2_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from ssh2.exceptions import AuthenticationError, AgentError, \
3232
SessionHandshakeError, SFTPHandleError, SFTPIOError as SFTPIOError_ssh2
3333
from ssh2.session import Session
34-
from ssh2.sftp import LIBSSH2_FXF_CREAT, LIBSSH2_FXF_WRITE, \
34+
from ssh2.sftp import LIBSSH2_FXF_READ, LIBSSH2_FXF_CREAT, LIBSSH2_FXF_WRITE, \
3535
LIBSSH2_FXF_TRUNC, LIBSSH2_SFTP_S_IRUSR, LIBSSH2_SFTP_S_IRGRP, \
3636
LIBSSH2_SFTP_S_IWUSR, LIBSSH2_SFTP_S_IXUSR, LIBSSH2_SFTP_S_IROTH, \
3737
LIBSSH2_SFTP_S_IXGRP, LIBSSH2_SFTP_S_IXOTH
@@ -587,7 +587,9 @@ def _sftp_get(self, remote_fh, local_file):
587587
local_fh.write(data)
588588

589589
def sftp_get(self, sftp, remote_file, local_file):
590-
with self._sftp_openfh(sftp.open, remote_file, 0, 0) as remote_fh:
590+
with self._sftp_openfh(
591+
sftp.open, remote_file,
592+
LIBSSH2_FXF_READ, LIBSSH2_SFTP_S_IRUSR) as remote_fh:
591593
try:
592594
self._sftp_get(remote_fh, local_file)
593595
# THREAD_POOL.apply(

0 commit comments

Comments
 (0)