comparison src/com/trilead/ssh2/packets/PacketUserauthInfoRequest.java @ 0:0ce5cc452d02

initial version
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 10:41:19 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0ce5cc452d02
1
2 package com.trilead.ssh2.packets;
3
4 import java.io.IOException;
5
6 /**
7 * PacketUserauthInfoRequest.
8 *
9 * @author Christian Plattner, plattner@trilead.com
10 * @version $Id: PacketUserauthInfoRequest.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
11 */
12 public class PacketUserauthInfoRequest {
13 byte[] payload;
14
15 String name;
16 String instruction;
17 String languageTag;
18 int numPrompts;
19
20 String prompt[];
21 boolean echo[];
22
23 public PacketUserauthInfoRequest(byte payload[], int off, int len) throws IOException {
24 this.payload = new byte[len];
25 System.arraycopy(payload, off, this.payload, 0, len);
26 TypesReader tr = new TypesReader(payload, off, len);
27 int packet_type = tr.readByte();
28
29 if (packet_type != Packets.SSH_MSG_USERAUTH_INFO_REQUEST)
30 throw new IOException("This is not a SSH_MSG_USERAUTH_INFO_REQUEST! (" + packet_type + ")");
31
32 name = tr.readString();
33 instruction = tr.readString();
34 languageTag = tr.readString();
35 numPrompts = tr.readUINT32();
36 prompt = new String[numPrompts];
37 echo = new boolean[numPrompts];
38
39 for (int i = 0; i < numPrompts; i++) {
40 prompt[i] = tr.readString();
41 echo[i] = tr.readBoolean();
42 }
43
44 if (tr.remain() != 0)
45 throw new IOException("Padding in SSH_MSG_USERAUTH_INFO_REQUEST packet!");
46 }
47
48 public boolean[] getEcho() {
49 return echo;
50 }
51
52 public String getInstruction() {
53 return instruction;
54 }
55
56 public String getLanguageTag() {
57 return languageTag;
58 }
59
60 public String getName() {
61 return name;
62 }
63
64 public int getNumPrompts() {
65 return numPrompts;
66 }
67
68 public String[] getPrompt() {
69 return prompt;
70 }
71 }