Mercurial > 510Connectbot
annotate src/net/sourceforge/jsocks/server/Ident.java @ 402:14aa0621aa7d stable-1.9.0
Backed out changeset 2f2b5a244a4d
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 20 Oct 2014 19:14:39 -0700 |
parents | 72de889ecfe7 |
children |
rev | line source |
---|---|
350
72de889ecfe7
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
349
diff
changeset
|
1 package net.sourceforge.jsocks.server; |
349
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
2 import net.sourceforge.jsocks.*; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 import java.net.*; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 import java.io.*; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 import java.util.StringTokenizer; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
8 Class Ident provides means to obtain user name of the owner of the socket |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
9 on remote machine, providing remote machine runs identd daemon. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
10 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
11 To use it: |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
12 <tt><pre> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
13 Socket s = ss.accept(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
14 Ident id = new Ident(s); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 if(id.successful) goUseUser(id.userName); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
16 else handleIdentError(id.errorCode,id.errorMessage) |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
17 </pre></tt> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
18 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
19 public class Ident{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
20 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 /** Error Message can be null.*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 public String errorMessage; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
23 /** Host type as returned by daemon, can be null, if error happened*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
24 public String hostType; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 /** User name as returned by the identd daemon, or null, if it failed*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
26 public String userName; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
28 /** If this is true then userName and hostType contain valid values. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 Else errorCode contain the error code, and errorMessage contains |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
30 the corresponding message. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
31 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
32 public boolean successful; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
33 /** Error code*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
34 public int errorCode; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
35 /** Identd on port 113 can't be contacted*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
36 public static final int ERR_NO_CONNECT = 1; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 /** Connection timed out*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
38 public static final int ERR_TIMEOUT = 2; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
39 /** Identd daemon responded with ERROR, in this case errorMessage |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
40 contains the string explanation, as send by the daemon. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
41 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
42 public static final int ERR_PROTOCOL = 3; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
43 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
44 When parsing server response protocol error happened. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
45 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
46 public static final int ERR_PROTOCOL_INCORRECT = 4; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
47 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
48 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
49 /** Maximum amount of time we should wait before dropping the |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
50 connection to identd server.Setting it to 0 implies infinit |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
51 timeout. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
53 public static final int connectionTimeout = 10000; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
55 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
56 /** |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 Constructor tries to connect to Identd daemon on the host of the |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
58 given socket, and retrieve user name of the owner of given socket |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 connection on remote machine. After constructor returns public |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
60 fields are initialised to whatever the server returned. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
61 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 If user name was successfully retrieved successful is set to true, |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
63 and userName and hostType are set to whatever server returned. If |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
64 however for some reason user name was not obtained, successful is set |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
65 to false and errorCode contains the code explaining the reason of |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 failure, and errorMessage contains human readable explanation. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
67 <p> |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
68 Constructor may block, for a while. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 @param s Socket whose ownership on remote end should be obtained. |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
70 */ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
71 public Ident(Socket s ){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 Socket sock = null; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 successful = false; //We are pessimistic |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
74 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 try{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 sock = new Socket(s.getInetAddress(),113); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
77 sock.setSoTimeout(connectionTimeout); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
78 byte[] request = (""+s.getPort()+" , "+ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
79 s.getLocalPort()+"\r\n").getBytes(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
80 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
81 sock.getOutputStream().write(request); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
82 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 BufferedReader in = new BufferedReader( |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
84 new InputStreamReader(sock.getInputStream())); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
85 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 parseResponse(in.readLine()); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
87 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
88 }catch(InterruptedIOException iioe){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 errorCode = ERR_TIMEOUT; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 errorMessage = "Connection to identd timed out."; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 }catch(ConnectException ce){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
92 errorCode = ERR_NO_CONNECT; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
93 errorMessage = "Connection to identd server failed."; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
94 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
95 }catch(IOException ioe){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 errorCode = ERR_NO_CONNECT; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
97 errorMessage = ""+ioe; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
98 }finally{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
99 try{ if(sock!=null) sock.close();}catch(IOException ioe){}; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
100 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
101 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
102 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
103 private void parseResponse(String response){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
104 if(response == null){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
105 errorCode = ERR_PROTOCOL_INCORRECT; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 errorMessage = "Identd server closed connection."; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
108 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
109 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
110 StringTokenizer st = new StringTokenizer(response,":"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
111 if(st.countTokens() < 3){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
112 errorCode = ERR_PROTOCOL_INCORRECT; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
113 errorMessage = "Can't parse server response."; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
114 return; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
115 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
116 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
117 st.nextToken(); //Discard first token, it's basically what we have send |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
118 String command = st.nextToken().trim().toUpperCase(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
119 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
120 if(command.equals("USERID") && st.countTokens() >= 2){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
121 successful = true; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
122 hostType = st.nextToken().trim(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
123 userName = st.nextToken("").substring(1);//Get all that is left |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
124 }else if(command.equals("ERROR")){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
125 errorCode = ERR_PROTOCOL; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
126 errorMessage = st.nextToken(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
127 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
128 errorCode = ERR_PROTOCOL_INCORRECT; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
129 System.out.println("Opa!"); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
130 errorMessage = "Can't parse server response."; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
131 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
132 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
133 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
134 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
135 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
136 /////////////////////////////////////////////// |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
137 //USED for Testing |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 /* |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 public static void main(String[] args) throws IOException{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
140 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 Socket s = null; |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 s = new Socket("gp101-16", 1391); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
143 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
144 Ident id = new Ident(s); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
145 if(id.successful){ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
146 System.out.println("User: "+id.userName); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
147 System.out.println("HostType: "+id.hostType); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
148 }else{ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
149 System.out.println("ErrorCode: "+id.errorCode); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
150 System.out.println("ErrorMessage: "+id.errorMessage); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
151 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
152 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
153 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
154 if(s!= null) s.close(); |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
155 } |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
156 //*/ |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
157 |
205ee2873330
update jsocks to 2011-03-19
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
158 } |