Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/packets/PacketUserauthRequestPassword.java @ 308:42b15aaa7ac7 ganymed
merge
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 14:21:50 -0700 |
parents | 071eccdff8ea |
children |
comparison
equal
deleted
inserted
replaced
306:90e47d99ea54 | 308:42b15aaa7ac7 |
---|---|
28 payload = tw.getBytes(); | 28 payload = tw.getBytes(); |
29 } | 29 } |
30 | 30 |
31 public PacketUserauthRequestPassword(byte payload[]) throws IOException { | 31 public PacketUserauthRequestPassword(byte payload[]) throws IOException { |
32 this.payload = payload; | 32 this.payload = payload; |
33 | |
34 TypesReader tr = new TypesReader(payload); | 33 TypesReader tr = new TypesReader(payload); |
35 | |
36 int packet_type = tr.readByte(); | 34 int packet_type = tr.readByte(); |
37 | 35 |
38 if(packet_type != Packets.SSH_MSG_USERAUTH_REQUEST) { | 36 if (packet_type != Packets.SSH_MSG_USERAUTH_REQUEST) { |
39 throw new PacketTypeException(packet_type); | 37 throw new PacketTypeException(packet_type); |
40 } | 38 } |
39 | |
41 String userName = tr.readString(); | 40 String userName = tr.readString(); |
42 String serviceName = tr.readString(); | 41 String serviceName = tr.readString(); |
43 | |
44 String method = tr.readString(); | 42 String method = tr.readString(); |
45 | 43 |
46 if(!method.equals("password")) { | 44 if (!method.equals("password")) { |
47 throw new IOException(String.format("Unexpected method %s", method)); | 45 throw new IOException(String.format("Unexpected method %s", method)); |
48 } | 46 } |
49 if(tr.remain() != 0) { | 47 |
48 if (tr.remain() != 0) { | |
50 throw new PacketFormatException(String.format("Padding in %s", Packets.getMessageName(packet_type))); | 49 throw new PacketFormatException(String.format("Padding in %s", Packets.getMessageName(packet_type))); |
51 } | 50 } |
52 } | 51 } |
53 | 52 |
54 public byte[] getPayload() { | 53 public byte[] getPayload() { |