Menu

Getting an error with SSH

Help
alakushlaf
2007-06-25
2013-05-28
  • alakushlaf

    alakushlaf - 2007-06-25

    I am using your component for SSH connections and I am getting an error when the server needs the password to be updated. It says (Auth failed). I debugged through the code and I found the lines causing the problem and there is no code to update the password there.

    packet.reset();
                buf.putByte((byte)Session.SSH_MSG_USERAUTH_REQUEST);
                buf.putString(_username);
                buf.putString(Util.getBytes("ssh-connection"));
                buf.putString(Util.getBytes("none"));
                session.write(packet);

                loop:
                    while(true)
                    {
                        // receive
                        // byte      SSH_MSG_USERAUTH_SUCCESS(52)
                        // string    service name
                        buf=session.read(buf);
                        //System.out.println("UserAuthNone: read: 52 ? "+    buf.buffer[5]);
                        if(buf.buffer[5]==Session.SSH_MSG_USERAUTH_SUCCESS)
                        {
                            return true;
                        }
                        if(buf.buffer[5]==Session.SSH_MSG_USERAUTH_BANNER)
                        {
                            buf.getInt(); buf.getByte(); buf.getByte();
                            byte[] _message=buf.getString();
                            byte[] lang=buf.getString();
                            String message=null;
                            try{ message=Util.getStringUTF8(_message); }
                            catch
                            {//(java.io.UnsupportedEncodingException e){
                                message=Util.getString(_message);
                            }
                            if(userinfo!=null)
                            {
                                userinfo.showMessage(message);
                            }
                            goto loop;
                        }
                        if(buf.buffer[5]==Session.SSH_MSG_USERAUTH_FAILURE)
                        {
                            buf.getInt(); buf.getByte(); buf.getByte();
                            byte[] foo=buf.getString();
                            int partial_success=buf.getByte();
                            methods=Util.getString(foo);

    I wonder if you can help with this to update the password. Thanks alot :)

     
    • ClemDogU

      ClemDogU - 2008-02-09

      Couple of things I would need is:
      1) Can I see your code that you use to implement this code.
      2) The above code is in which module?
      3) Any more explaination what you are doing would be nice.

      My objective with this is:
      1) to recreate the issue on my system and debug.
      2) Fix the code if possible.
      3) Write a test case to avoid this problem in the future.

      Please remember that I'm new to this code and haven't parsed all of it yet and any and all help is welcomed.

       
    • Robert Achmann

      Robert Achmann - 2008-08-18

      I'll bet that your UserInfo class isn't defined correctly:

      I'll bet that you have

      public class MyUserInfo : UserInfo

      Define your UserInfo class to be derived from UIKeyboardInteractive

      public class MyUserInfo : UserInfo, UIKeyboardInteractive
      {
      .....
      }

      then when UserAuth hits the methods available, and tries to use keyboard-interactive, it checks that your userinfo class is of this type.

       

Log in to post a comment.

MongoDB Logo MongoDB