Re: [JSch-users] Getting "Auth fail" after 7 successful connections.
Status: Alpha
Brought to you by:
ymnk
From: Andrei T. <an...@tc...> - 2006-05-19 11:04:12
|
Excellent!!! This is exactly what is happening. May I make a small suggestion? It looks like JSch.addIdentity attempts to prevent same identity file been added multiple times : public void addIdentity(String foo, String bar) throws JSchException { Identity identity = new IdentityFile(foo, this); if (bar != null) { identity.setPassphrase(bar); } synchronized (identities) { if (!identities.contains(identity)) { // This will not work, unless IdentityFile implements equals() identities.addElement(identity); } } } But unfortunately IdentityFile class lucks "equals( Object o )" method which makes "contains" method return false every time. As soon as I added this public boolean equals( Object o ) { if( o instanceof IdentityFile ) { return identity.equals( ((IdentityFile)o).identity); } else { return super.equals( o ); } } to com.jcraft.jsch.IdenityFile class, my problem went away. Thank you very much for quick response. Andrei Tchijov On May 18, 2006, at 11:53 PM, Atsuhiko Yamanaka wrote: > Hi, > > +-From: Andrei Tchijov <an...@tc...> -- > |_Date: Thu, 18 May 2006 23:01:23 -0400 ______ > | > |I am experiencing very strange problem. In my application I > connect > |to remote server and setting up local tunnel. I can do it 7 > times in > |a row. On 8th attempt I am getting > |... > |Caused by: com.jcraft.jsch.JSchException: Auth fail > | at com.jcraft.jsch.Session.connect(Session.java:390) > | at com.jcraft.jsch.Session.connect(Session.java:143) > |... > |Once I get into this state, all consecutive attempts end up the > same > |way. > ... > |PS I am using JSch 1.28 on Mac OS X (both client and server side). > |Authentication is password base. > > It seems an exception has occurred in a trial for public-key > authentication. > Have you invoked "jsch.addIdentity" method? If you don't invoke it, > public-key authentication will not be tried. > > I guess that you have invoked "jsch.addIdentity" 8 times. > Is this guess correct? By invoking that method, 8 key will be cached > internally and the "UserAuthPublicKey.start" method has tried > public-key > authentication 8 times with wrong keys, and sshd has rejected the > connection > because of so many failures. 7 times failure may be acceptable for > that > sshd, but 8 times failure not. Such a behavior must be depended on its > implementation, I guess. > > > > Sincerely, > -- > Atsuhiko Yamanaka > JCraft,Inc. > 1-14-20 HONCHO AOBA-KU, > SENDAI, MIYAGI 980-0014 Japan. > Tel +81-22-723-2150 > +1-415-578-3454 > Fax +81-22-224-8773 > Skype callto://jcraft/ > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > JSch-users mailing list > JSc...@li... > https://lists.sourceforge.net/lists/listinfo/jsch-users |