mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-06 07:10:53 +03:00
Fixed bug in SFTP FileMode for AIX/Unix directory mask
This commit is contained in:
@@ -74,7 +74,7 @@ public class FileMode {
|
||||
}
|
||||
|
||||
public int getTypeMask() {
|
||||
return mask & 0770000;
|
||||
return mask & 0170000;
|
||||
}
|
||||
|
||||
public int getPermissionsMask() {
|
||||
|
||||
23
src/test/java/net/schmizz/sshj/sftp/FileModeTest.java
Normal file
23
src/test/java/net/schmizz/sshj/sftp/FileModeTest.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package net.schmizz.sshj.sftp;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class FileModeTest {
|
||||
|
||||
@Test
|
||||
public void shouldDetectDirectoryWithLinuxMask() {
|
||||
FileMode fileMode = new FileMode(040755);
|
||||
assertThat(fileMode.toString(), equalTo("[mask=40755]"));
|
||||
assertThat(fileMode.getType(), equalTo(FileMode.Type.DIRECTORY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldDetectDirectoryWithAixUnixMask() {
|
||||
FileMode fileMode = new FileMode(0240755);
|
||||
assertThat(fileMode.toString(), equalTo("[mask=240755]"));
|
||||
assertThat(fileMode.getType(), equalTo(FileMode.Type.DIRECTORY));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user