czldb2 opened a new issue, #751:
URL: https://github.com/apache/mina-sshd/issues/751

   ### Environment
   version:2.13.0
   target:centos7   openssh 7.4   sftp version 3
   client: xshell5    sftp version:3
   
   ### Phenomenon
   I wrote an sftp server using sshd-sftp, which then received a port 2202 to 
request and forwarded it to the filesystem of another target linux machine. I 
found a problem with the owner and group display during testing, as follows:
   
![Image](https://github.com/user-attachments/assets/c5c25833-5505-4246-ad78-6cc4e02cabe4)
   
   ### Attachment
   Here is my test code:
   
[sftpTestDemo.zip](https://github.com/user-attachments/files/20099028/sftpTestDemo.zip)
   
   ### Others
   AbstractSftpSubsystemHelper.writeDirEntry() 
   ```java
   protected void writeDirEntry(
           int id, DirectoryHandle dir, Map<String, Path> entries, Buffer 
buffer, int index, Path f, String shortName, LinkOption... options)
                   throws IOException {
       Map<String, ?> attrs = resolveFileAttributes(f, 
SftpConstants.SSH_FILEXFER_ATTR_ALL, options);
       entries.put(shortName, f);
   
       buffer.putString(shortName);
       int version = getVersion();
       if (version == SftpConstants.SFTP_V3) {
           String longName = getLongName(f, shortName, options);
           buffer.putString(longName);
           if (log.isTraceEnabled()) {
               log.trace("writeDirEntry(" + getServerSession() + ") id=" + id + 
")[" + index + "] - "
                       + shortName + " [" + longName + "]: " + attrs);
           }
       } else {
           if (log.isTraceEnabled()) {
               log.trace("writeDirEntry(" + getServerSession() + "(id=" + id + 
")[" + index + "] - "
                       + shortName + ": " + attrs);
           }
       }
   
       writeAttrs(buffer, attrs);
   }
   
   ```
   I found that the getLongName method always uses "owner" and "group" in 
attributes as null internally, in the sftp version 3 scenario.
   
   
   AbstractSftpClient.checkDirResponse()
   ```java
   if (version == SftpConstants.SFTP_V3) {
       longName = getReferencedName(cmd, buffer, nameIndex.getAndIncrement());
   }
   
   ```
   But I see that there is a LongName fetching, and that the data contains the 
correct owner and group information.
   
   ### Problem
   I would like to ask how to ensure that the owner and group under the sftp3 
version display properly?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to