Fix setstat calls. libssh2_attr2bin was masking out flags
This commit is contained in:
parent
ecd83df6a7
commit
308d59910f
2
README
2
README
@ -7,6 +7,8 @@ Version 0.5
|
||||
*** BC Break ***
|
||||
Reimplemented libssh2_session_methods() to match libssh2_session_method_pref() style
|
||||
|
||||
Fixed libssh2_attr2bin() (effects any setstat style call).
|
||||
|
||||
Fixed authenticating with encrypted private key.
|
||||
|
||||
Fixed authenticating via ssh-dss public key.
|
||||
|
@ -318,13 +318,16 @@ static int libssh2_sftp_attrsize(LIBSSH2_SFTP_ATTRIBUTES *attrs)
|
||||
static int libssh2_sftp_attr2bin(unsigned char *p, LIBSSH2_SFTP_ATTRIBUTES *attrs)
|
||||
{
|
||||
unsigned char *s = p;
|
||||
unsigned long flag_mask = LIBSSH2_SFTP_ATTR_SIZE | LIBSSH2_SFTP_ATTR_UIDGID | LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME;
|
||||
|
||||
/* TODO: When we add SFTP4+ functionality flag_mask can get additional bits */
|
||||
|
||||
if (!attrs) {
|
||||
libssh2_htonu32(s, 0);
|
||||
return 4;
|
||||
}
|
||||
|
||||
libssh2_htonu32(s, attrs->flags & 0x0000000); s += 4;
|
||||
libssh2_htonu32(s, attrs->flags & flag_mask); s += 4;
|
||||
|
||||
if (attrs->flags & LIBSSH2_SFTP_ATTR_SIZE) {
|
||||
libssh2_htonu64(s, attrs->filesize); s += 8;
|
||||
|
Loading…
x
Reference in New Issue
Block a user