Revert "sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN"
This reverts commit 04e79e0c798674a0796be8a55f63dd92e6877790.
This commit is contained in:
parent
04e79e0c79
commit
50e37bdadc
@ -1024,7 +1024,9 @@ sftp_open(LIBSSH2_SFTP *sftp, const char *filename,
|
|||||||
LIBSSH2_CHANNEL *channel = sftp->channel;
|
LIBSSH2_CHANNEL *channel = sftp->channel;
|
||||||
LIBSSH2_SESSION *session = channel->session;
|
LIBSSH2_SESSION *session = channel->session;
|
||||||
LIBSSH2_SFTP_HANDLE *fp;
|
LIBSSH2_SFTP_HANDLE *fp;
|
||||||
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
LIBSSH2_SFTP_ATTRIBUTES attrs = {
|
||||||
|
LIBSSH2_SFTP_ATTR_PERMISSIONS, 0, 0, 0, 0, 0, 0
|
||||||
|
};
|
||||||
unsigned char *s;
|
unsigned char *s;
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
int open_file = (open_type == LIBSSH2_SFTP_OPENFILE)?1:0;
|
int open_file = (open_type == LIBSSH2_SFTP_OPENFILE)?1:0;
|
||||||
@ -1044,15 +1046,10 @@ sftp_open(LIBSSH2_SFTP *sftp, const char *filename,
|
|||||||
"FXP_OPENDIR packet");
|
"FXP_OPENDIR packet");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags != LIBSSH2_FXF_READ) {
|
|
||||||
attrs.flags |= LIBSSH2_SFTP_ATTR_PERMISSIONS;
|
|
||||||
|
|
||||||
/* Filetype in SFTP 3 and earlier */
|
/* Filetype in SFTP 3 and earlier */
|
||||||
attrs.permissions = mode |
|
attrs.permissions = mode |
|
||||||
(open_file ? LIBSSH2_SFTP_ATTR_PFILETYPE_FILE :
|
(open_file ? LIBSSH2_SFTP_ATTR_PFILETYPE_FILE :
|
||||||
LIBSSH2_SFTP_ATTR_PFILETYPE_DIR);
|
LIBSSH2_SFTP_ATTR_PFILETYPE_DIR);
|
||||||
}
|
|
||||||
|
|
||||||
_libssh2_store_u32(&s, sftp->open_packet_len - 4);
|
_libssh2_store_u32(&s, sftp->open_packet_len - 4);
|
||||||
*(s++) = open_file? SSH_FXP_OPEN : SSH_FXP_OPENDIR;
|
*(s++) = open_file? SSH_FXP_OPEN : SSH_FXP_OPENDIR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user