01: package ch.ethz.ssh2.packets;
02:
03: import java.io.IOException;
04:
05: /**
06: * PacketUserauthInfoRequest.
07: *
08: * @author Christian Plattner, plattner@inf.ethz.ch
09: * @version $Id: PacketUserauthInfoRequest.java,v 1.2 2005/07/21 15:28:51 cplattne Exp $
10: */
11: public class PacketUserauthInfoRequest {
12: byte[] payload;
13:
14: String name;
15: String instruction;
16: String languageTag;
17: int numPrompts;
18:
19: String prompt[];
20: boolean echo[];
21:
22: public PacketUserauthInfoRequest(byte payload[], int off, int len)
23: throws IOException {
24: this .payload = new byte[len];
25: System.arraycopy(payload, off, this .payload, 0, len);
26:
27: TypesReader tr = new TypesReader(payload, off, len);
28:
29: int packet_type = tr.readByte();
30:
31: if (packet_type != Packets.SSH_MSG_USERAUTH_INFO_REQUEST)
32: throw new IOException(
33: "This is not a SSH_MSG_USERAUTH_INFO_REQUEST! ("
34: + packet_type + ")");
35:
36: name = tr.readString();
37: instruction = tr.readString();
38: languageTag = tr.readString();
39:
40: numPrompts = tr.readUINT32();
41:
42: prompt = new String[numPrompts];
43: echo = new boolean[numPrompts];
44:
45: for (int i = 0; i < numPrompts; i++) {
46: prompt[i] = tr.readString();
47: echo[i] = tr.readBoolean();
48: }
49:
50: if (tr.remain() != 0)
51: throw new IOException(
52: "Padding in SSH_MSG_USERAUTH_INFO_REQUEST packet!");
53: }
54:
55: public boolean[] getEcho() {
56: return echo;
57: }
58:
59: public String getInstruction() {
60: return instruction;
61: }
62:
63: public String getLanguageTag() {
64: return languageTag;
65: }
66:
67: public String getName() {
68: return name;
69: }
70:
71: public int getNumPrompts() {
72: return numPrompts;
73: }
74:
75: public String[] getPrompt() {
76: return prompt;
77: }
78: }
|