Author: gnodet Date: Mon Mar 30 19:11:29 2009 New Revision: 760110 URL: http://svn.apache.org/viewvc?rev=760110&view=rev Log: SSHD-16: fix problem when login from OpenSolaris ssh client
Modified: mina/sshd/trunk/src/main/java/org/apache/sshd/common/session/AbstractSession.java mina/sshd/trunk/src/test/java/org/apache/sshd/ServerTest.java Modified: mina/sshd/trunk/src/main/java/org/apache/sshd/common/session/AbstractSession.java URL: http://svn.apache.org/viewvc/mina/sshd/trunk/src/main/java/org/apache/sshd/common/session/AbstractSession.java?rev=760110&r1=760109&r2=760110&view=diff ============================================================================== --- mina/sshd/trunk/src/main/java/org/apache/sshd/common/session/AbstractSession.java (original) +++ mina/sshd/trunk/src/main/java/org/apache/sshd/common/session/AbstractSession.java Mon Mar 30 19:11:29 2009 @@ -849,7 +849,7 @@ break; } } - if (guess[i] == null) { + if (guess[i] == null && i != SshConstants.PROPOSAL_LANG_CTOS && i != SshConstants.PROPOSAL_LANG_STOC) { throw new IllegalStateException("Unable to negociate"); } } Modified: mina/sshd/trunk/src/test/java/org/apache/sshd/ServerTest.java URL: http://svn.apache.org/viewvc/mina/sshd/trunk/src/test/java/org/apache/sshd/ServerTest.java?rev=760110&r1=760109&r2=760110&view=diff ============================================================================== --- mina/sshd/trunk/src/test/java/org/apache/sshd/ServerTest.java (original) +++ mina/sshd/trunk/src/test/java/org/apache/sshd/ServerTest.java Mon Mar 30 19:11:29 2009 @@ -21,12 +21,17 @@ import java.net.ServerSocket; import org.apache.sshd.common.keyprovider.FileKeyPairProvider; +import org.apache.sshd.common.session.AbstractSession; +import org.apache.sshd.common.SshConstants; import org.apache.sshd.util.EchoShellFactory; import org.apache.sshd.util.BogusPasswordAuthenticator; import org.apache.sshd.server.command.ScpCommandFactory; import org.apache.sshd.ClientSession; import org.apache.sshd.SshClient; import org.apache.sshd.SshServer; +import org.apache.sshd.client.SessionFactory; +import org.apache.sshd.client.session.ClientSessionImpl; +import org.apache.mina.core.session.IoSession; import org.junit.Before; import org.junit.Test; import org.junit.Assert; @@ -94,6 +99,28 @@ Assert.assertTrue((res & ClientSession.CLOSED) != 0); } + @Test + public void testLanguage() throws Exception { + SshClient client = SshClient.setUpDefaultClient(); + client.setSessionFactory(new SessionFactory() { + @Override + protected AbstractSession createSession(IoSession ioSession) throws Exception { + return new ClientSessionImpl(client, ioSession) { + @Override + protected String[] createProposal(String hostKeyTypes) { + String[] proposal = super.createProposal(hostKeyTypes); + proposal[SshConstants.PROPOSAL_LANG_CTOS] = "en-US"; + proposal[SshConstants.PROPOSAL_LANG_STOC] = "en-US"; + return proposal; + } + }; + } + }); + client.start(); + ClientSession s = client.connect("localhost", port).await().getSession(); + s.close(false); + } + public static void main(String[] args) throws Exception { SshServer sshd = SshServer.setUpDefaultServer(); sshd.setPort(8000);