From f857d4aff78fb79a532fe0b4f726d689d83a7917 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 24 Feb 2010 00:25:38 +0100 Subject: Fixed longname parsing, this only workings with readdir. --- libssh/sftp.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/libssh/sftp.c b/libssh/sftp.c index 4f2f4eb3..f737958e 100644 --- a/libssh/sftp.c +++ b/libssh/sftp.c @@ -1196,6 +1196,19 @@ static sftp_attributes sftp_parse_attr_3(sftp_session sftp, ssh_buffer buf, break; } string_free(longname); + + /* Set owner and group if we talk to openssh and have the longname */ + if (ssh_get_openssh_version(sftp->session)) { + attr->owner = sftp_parse_longname(attr->longname, SFTP_LONGNAME_OWNER); + if (attr->owner == NULL) { + break; + } + + attr->group = sftp_parse_longname(attr->longname, SFTP_LONGNAME_GROUP); + if (attr->group == NULL) { + break; + } + } } if (buffer_get_u32(buf, &flags) != sizeof(uint32_t)) { @@ -1225,18 +1238,6 @@ static sftp_attributes sftp_parse_attr_3(sftp_session sftp, ssh_buffer buf, } attr->uid = ntohl(attr->uid); attr->gid = ntohl(attr->gid); - - if (ssh_get_openssh_version(sftp->session)) { - attr->owner = sftp_parse_longname(attr->longname, SFTP_LONGNAME_OWNER); - if (attr->owner == NULL) { - break; - } - - attr->group = sftp_parse_longname(attr->longname, SFTP_LONGNAME_GROUP); - if (attr->group == NULL) { - break; - } - } } if (flags & SSH_FILEXFER_ATTR_PERMISSIONS) { -- cgit v1.2.3