Skip to content

Commit

Permalink
let all directory be readable if it is executable, revert using isExe…
Browse files Browse the repository at this point in the history
…cutable in the server
  • Loading branch information
lmagyar committed Jun 2, 2024
1 parent e2bc355 commit 2ac77ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions primitiveFTPd/src/org/primftpd/filesystem/FsSshFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public SshFile getParentFile() {
return new FsSshFile(file.getParentFile(), pftpdService, session);
}

@Override
public boolean isReadable() {
return super.isReadable() || isDirectory() && isExecutable();
}

@Override
public boolean isExecutable() {
logger.trace("[{}] isExecutable()", name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ protected void process(Buffer buffer) throws IOException {
sendStatus(id, SSH_FX_NO_SUCH_FILE, path);
} else if (!p.isDirectory()) {
sendStatus(id, SSH_FX_NO_SUCH_FILE, path);
} else if (!p.isExecutable()) {
} else if (!p.isReadable()) {
sendStatus(id, SSH_FX_PERMISSION_DENIED, path);
} else {
String handle = UUID.randomUUID().toString();
Expand All @@ -714,7 +714,7 @@ protected void process(Buffer buffer) throws IOException {
sendStatus(id, SSH_FX_NO_SUCH_FILE, p.getFile().getAbsolutePath());
} else if (!p.getFile().isDirectory()) {
sendStatus(id, SSH_FX_NO_SUCH_FILE, p.getFile().getAbsolutePath());
} else if (!p.getFile().isExecutable()) {
} else if (!p.getFile().isReadable()) {
sendStatus(id, SSH_FX_PERMISSION_DENIED, p.getFile().getAbsolutePath());
} else {
DirectoryHandle dh = (DirectoryHandle) p;
Expand Down

0 comments on commit 2ac77ac

Please sign in to comment.