Skip to content

Commit

Permalink
Don't actually set the owner or group
Browse files Browse the repository at this point in the history
  • Loading branch information
robtimus committed Mar 2, 2023
1 parent 9c5cdf2 commit d5f18dc
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.github.robtimus.filesystems.sftp.server;

import java.io.IOException;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
Expand All @@ -39,7 +40,7 @@
*
* @author Rob Spoor
*/
@SuppressWarnings("javadoc")
@SuppressWarnings({ "javadoc", "nls" })
public class FixedSftpSubsystem extends SftpSubsystem {

public FixedSftpSubsystem(ChannelSession channel, SftpSubsystemConfigurator configurator) {
Expand All @@ -52,6 +53,15 @@ protected Map<String, Object> doStat(int id, String path, int flags) throws IOEx
return resolveFileAttributes(p, flags, IoUtils.getLinkOptions(true));
}

@Override
protected void setFileAttribute(Path file, String view, String attribute, Object value, LinkOption... options) throws IOException {
if ("uid".equals(attribute) || "gid".equals(attribute)) {
// Don't actually set the owner or group; it will be ignored on Windows but fails on Linux due to non-matching values
return;
}
super.setFileAttribute(file, view, attribute, value, options);
}

public static final class Factory extends SftpSubsystemFactory {

@Override
Expand Down

0 comments on commit d5f18dc

Please sign in to comment.