You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2013/07/17 21:33:25 UTC
[1/2] git commit: [SSHD-221] Don't hardwire the service in the user
auth code
Updated Branches:
refs/heads/master bf7c8b885 -> e6005dc31
[SSHD-221] Don't hardwire the service in the user auth code
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/ce434ed0
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/ce434ed0
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/ce434ed0
Branch: refs/heads/master
Commit: ce434ed04f4615e5582e554054ee57376139a32b
Parents: bf7c8b8
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Jul 17 21:31:58 2013 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Jul 17 21:31:58 2013 +0200
----------------------------------------------------------------------
.../src/main/java/org/apache/sshd/client/auth/UserAuthAgent.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/ce434ed0/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthAgent.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthAgent.java b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthAgent.java
index 35793ef..fa68ff9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthAgent.java
+++ b/sshd-core/src/main/java/org/apache/sshd/client/auth/UserAuthAgent.java
@@ -61,7 +61,7 @@ public class UserAuthAgent extends AbstractUserAuth {
bs.putString(session.getKex().getH());
bs.putCommand(SshConstants.Message.SSH_MSG_USERAUTH_REQUEST);
bs.putString(username);
- bs.putString(AUTHENTICATION_SERVICE);
+ bs.putString(service);
bs.putString("publickey");
bs.putByte((byte) 1);
bs.putString((key instanceof RSAPublicKey) ? KeyPairProvider.SSH_RSA : KeyPairProvider.SSH_DSS);
[2/2] git commit: [SSHD-229] SFTP download reopen files issue
Posted by gn...@apache.org.
[SSHD-229] SFTP download reopen files issue
Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/e6005dc3
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/e6005dc3
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/e6005dc3
Branch: refs/heads/master
Commit: e6005dc315e0d879b5a9e20325d9598e4d66b8b9
Parents: ce434ed
Author: Guillaume Nodet <gn...@apache.org>
Authored: Wed Jul 17 21:32:25 2013 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Wed Jul 17 21:32:25 2013 +0200
----------------------------------------------------------------------
.../main/java/org/apache/sshd/server/sftp/SftpSubsystem.java | 8 ++++++++
.../main/java/org/apache/sshd/sftp/subsystem/FileHandle.java | 8 ++++++++
2 files changed, 16 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e6005dc3/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
index 4758e9e..5615063 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/sftp/SftpSubsystem.java
@@ -397,6 +397,7 @@ public class SftpSubsystem implements Command, Runnable, SessionAware, FileSyste
long outputPos;
InputStream input;
long inputPos;
+ long length;
public FileHandle(SshFile sshFile, int flags) {
super(sshFile);
@@ -408,14 +409,21 @@ public class SftpSubsystem implements Command, Runnable, SessionAware, FileSyste
}
public int read(byte[] data, long offset) throws IOException {
+ if (input != null && offset >= length) {
+ return -1;
+ }
if (input != null && offset != inputPos) {
IoUtils.closeQuietly(input);
input = null;
}
if (input == null) {
input = file.createInputStream(offset);
+ length = file.getSize();
inputPos = offset;
}
+ if (offset >= length) {
+ return -1;
+ }
int read = input.read(data);
inputPos += read;
return read;
http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/e6005dc3/sshd-sftp/src/main/java/org/apache/sshd/sftp/subsystem/FileHandle.java
----------------------------------------------------------------------
diff --git a/sshd-sftp/src/main/java/org/apache/sshd/sftp/subsystem/FileHandle.java b/sshd-sftp/src/main/java/org/apache/sshd/sftp/subsystem/FileHandle.java
index b1b66af..fb0bb77 100644
--- a/sshd-sftp/src/main/java/org/apache/sshd/sftp/subsystem/FileHandle.java
+++ b/sshd-sftp/src/main/java/org/apache/sshd/sftp/subsystem/FileHandle.java
@@ -32,6 +32,7 @@ public class FileHandle extends BaseHandle {
long outputPos;
InputStream input;
long inputPos;
+ long length;
public FileHandle(String id, SshFile sshFile, int flags) {
super(id, sshFile);
@@ -43,14 +44,21 @@ public class FileHandle extends BaseHandle {
}
public int read(byte[] data, long offset) throws IOException {
+ if (input != null && offset >= length) {
+ return -1;
+ }
if (input != null && offset != inputPos) {
IoUtils.closeQuietly(input);
input = null;
}
if (input == null) {
input = getFile().createInputStream(offset);
+ length = getFile().getSize();
inputPos = offset;
}
+ if (offset >= length) {
+ return -1;
+ }
int read = input.read(data);
inputPos += read;
return read;