1 2 29 30 package com.jcraft.jsch; 31 32 public abstract class UserAuth{ 33 protected static final int SSH_MSG_USERAUTH_REQUEST= 50; 34 protected static final int SSH_MSG_USERAUTH_FAILURE= 51; 35 protected static final int SSH_MSG_USERAUTH_SUCCESS= 52; 36 protected static final int SSH_MSG_USERAUTH_BANNER= 53; 37 protected static final int SSH_MSG_USERAUTH_INFO_REQUEST= 60; 38 protected static final int SSH_MSG_USERAUTH_INFO_RESPONSE= 61; 39 protected static final int SSH_MSG_USERAUTH_PK_OK= 60; 40 41 protected UserInfo userinfo; 42 public boolean start(Session session, UserInfo userinfo) throws Exception { 43 this.userinfo=userinfo; 44 Packet packet=session.packet; 45 Buffer buf=session.buf; 46 packet.reset(); 50 buf.putByte((byte)Session.SSH_MSG_SERVICE_REQUEST); 51 buf.putString("ssh-userauth".getBytes()); 52 session.write(packet); 53 54 if(JSch.getLogger().isEnabled(Logger.INFO)){ 55 JSch.getLogger().log(Logger.INFO, 56 "SSH_MSG_SERVICE_REQUEST sent"); 57 } 58 59 buf=session.read(buf); 63 boolean result=(buf.buffer[5]==6); 65 66 if(JSch.getLogger().isEnabled(Logger.INFO)){ 67 JSch.getLogger().log(Logger.INFO, 68 "SSH_MSG_SERVICE_ACCEPT received"); 69 } 70 71 return result; 72 } 73 } 74 | Popular Tags |