mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 07:40:55 +03:00
Merge pull request #150 from dkocher/master
Change handle to byte[]. Fix interoperability issue with Tectia SSH Serv...
This commit is contained in:
@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class RemoteDirectory
|
public class RemoteDirectory
|
||||||
extends RemoteResource {
|
extends RemoteResource {
|
||||||
|
|
||||||
public RemoteDirectory(Requester requester, String path, String handle) {
|
public RemoteDirectory(Requester requester, String path, byte[] handle) {
|
||||||
super(requester, path, handle);
|
super(requester, path, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class RemoteFile
|
public class RemoteFile
|
||||||
extends RemoteResource {
|
extends RemoteResource {
|
||||||
|
|
||||||
public RemoteFile(Requester requester, String path, String handle) {
|
public RemoteFile(Requester requester, String path, byte[] handle) {
|
||||||
super(requester, path, handle);
|
super(requester, path, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public class RemoteFile
|
|||||||
return 1 + // packet type
|
return 1 + // packet type
|
||||||
4 + // request id
|
4 + // request id
|
||||||
4 + // next length
|
4 + // next length
|
||||||
handle.length() + // next
|
handle.length + // next
|
||||||
8 + // file offset
|
8 + // file offset
|
||||||
4 + // data length
|
4 + // data length
|
||||||
4; // packet length
|
4; // packet length
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ public abstract class RemoteResource
|
|||||||
|
|
||||||
protected final Requester requester;
|
protected final Requester requester;
|
||||||
protected final String path;
|
protected final String path;
|
||||||
protected final String handle;
|
protected final byte[] handle;
|
||||||
|
|
||||||
protected RemoteResource(Requester requester, String path, String handle) {
|
protected RemoteResource(Requester requester, String path, byte[] handle) {
|
||||||
this.requester = requester;
|
this.requester = requester;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.handle = handle;
|
this.handle = handle;
|
||||||
|
|||||||
@@ -132,9 +132,9 @@ public class SFTPEngine
|
|||||||
|
|
||||||
public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa)
|
public RemoteFile open(String path, Set<OpenMode> modes, FileAttributes fa)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final String handle = doRequest(
|
final byte[] handle = doRequest(
|
||||||
newRequest(PacketType.OPEN).putString(path).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa)
|
newRequest(PacketType.OPEN).putString(path).putUInt32(OpenMode.toMask(modes)).putFileAttributes(fa)
|
||||||
).ensurePacketTypeIs(PacketType.HANDLE).readString();
|
).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
|
||||||
return new RemoteFile(this, path, handle);
|
return new RemoteFile(this, path, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,9 +150,9 @@ public class SFTPEngine
|
|||||||
|
|
||||||
public RemoteDirectory openDir(String path)
|
public RemoteDirectory openDir(String path)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final String handle = doRequest(
|
final byte[] handle = doRequest(
|
||||||
newRequest(PacketType.OPENDIR).putString(path)
|
newRequest(PacketType.OPENDIR).putString(path)
|
||||||
).ensurePacketTypeIs(PacketType.HANDLE).readString();
|
).ensurePacketTypeIs(PacketType.HANDLE).readBytes();
|
||||||
return new RemoteDirectory(this, path, handle);
|
return new RemoteDirectory(this, path, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user