diff --git a/README b/README index 032012a..bb83998 100644 --- a/README +++ b/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. diff --git a/src/sftp.c b/src/sftp.c index 22e5d82..f25327e 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -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;