MCPcopy Create free account
hub / github.com/TigerVNC/tigervnc / start

Method start

java/com/jcraft/jsch/UserAuthPassword.java:35–192  ·  view source on GitHub ↗
(Session session)

Source from the content-addressed store, hash-verified

33 private final int SSH_MSG_USERAUTH_PASSWD_CHANGEREQ=60;
34
35 public boolean start(Session session) throws Exception{
36 super.start(session);
37
38 byte[] password=session.password;
39 String dest=username+"@"+session.host;
40 if(session.port!=22){
41 dest+=(":"+session.port);
42 }
43
44 try{
45
46 while(true){
47
48 if(session.auth_failures >= session.max_auth_tries){
49 return false;
50 }
51
52 if(password==null){
53 if(userinfo==null){
54 //throw new JSchException("USERAUTH fail");
55 return false;
56 }
57 if(!userinfo.promptPassword("Password for "+dest)){
58 throw new JSchAuthCancelException("password");
59 //break;
60 }
61
62 String _password=userinfo.getPassword();
63 if(_password==null){
64 throw new JSchAuthCancelException("password");
65 //break;
66 }
67 password=Util.str2byte(_password);
68 }
69
70 byte[] _username=null;
71 _username=Util.str2byte(username);
72
73 // send
74 // byte SSH_MSG_USERAUTH_REQUEST(50)
75 // string user name
76 // string service name ("ssh-connection")
77 // string "password"
78 // boolen FALSE
79 // string plaintext password (ISO-10646 UTF-8)
80 packet.reset();
81 buf.putByte((byte)SSH_MSG_USERAUTH_REQUEST);
82 buf.putString(_username);
83 buf.putString(Util.str2byte("ssh-connection"));
84 buf.putString(Util.str2byte("password"));
85 buf.putByte((byte)0);
86 buf.putString(password);
87 session.write(packet);
88
89 loop:
90 while(true){
91 buf=session.read(buf);
92 int command=buf.getCommand()&0xff;

Callers

nothing calls this directly

Calls 15

str2byteMethod · 0.95
byte2strMethod · 0.95
bzeroMethod · 0.95
putByteMethod · 0.80
putStringMethod · 0.80
getCommandMethod · 0.80
promptPasswordMethod · 0.65
getPasswordMethod · 0.65
resetMethod · 0.65
writeMethod · 0.65
readMethod · 0.65

Tested by

no test coverage detected