148 |
fprintf(stderr, " -5: use RDP version 5 (default)\n"); |
fprintf(stderr, " -5: use RDP version 5 (default)\n"); |
149 |
} |
} |
150 |
|
|
151 |
|
void |
152 |
|
print_disconnect_reason(uint16 reason) |
153 |
|
{ |
154 |
|
char *text; |
155 |
|
|
156 |
|
switch (reason) |
157 |
|
{ |
158 |
|
case exDiscReasonNoInfo: |
159 |
|
text = "No information available"; |
160 |
|
break; |
161 |
|
|
162 |
|
case exDiscReasonAPIInitiatedDisconnect: |
163 |
|
text = "Server initiated disconnect"; |
164 |
|
break; |
165 |
|
|
166 |
|
case exDiscReasonAPIInitiatedLogoff: |
167 |
|
text = "Server initiated logoff"; |
168 |
|
break; |
169 |
|
|
170 |
|
case exDiscReasonServerIdleTimeout: |
171 |
|
text = "Server idle timeout reached"; |
172 |
|
break; |
173 |
|
|
174 |
|
case exDiscReasonServerLogonTimeout: |
175 |
|
text = "Server logon timeout reached"; |
176 |
|
break; |
177 |
|
|
178 |
|
case exDiscReasonReplacedByOtherConnection: |
179 |
|
text = "The session was replaced"; |
180 |
|
break; |
181 |
|
|
182 |
|
case exDiscReasonOutOfMemory: |
183 |
|
text = "The server is out of memory"; |
184 |
|
break; |
185 |
|
|
186 |
|
case exDiscReasonServerDeniedConnection: |
187 |
|
text = "The server denied the connection"; |
188 |
|
break; |
189 |
|
|
190 |
|
case exDiscReasonServerDeniedConnectionFips: |
191 |
|
text = "The server denied the connection for security reason"; |
192 |
|
break; |
193 |
|
|
194 |
|
case exDiscReasonLicenseInternal: |
195 |
|
text = "Internal licensing error"; |
196 |
|
break; |
197 |
|
|
198 |
|
case exDiscReasonLicenseNoLicenseServer: |
199 |
|
text = "No license server available"; |
200 |
|
break; |
201 |
|
|
202 |
|
case exDiscReasonLicenseNoLicense: |
203 |
|
text = "No valid license available"; |
204 |
|
break; |
205 |
|
|
206 |
|
case exDiscReasonLicenseErrClientMsg: |
207 |
|
text = "Invalid licensing message"; |
208 |
|
break; |
209 |
|
|
210 |
|
case exDiscReasonLicenseHwidDoesntMatchLicense: |
211 |
|
text = "Hardware id doesn't match software license"; |
212 |
|
break; |
213 |
|
|
214 |
|
case exDiscReasonLicenseErrClientLicense: |
215 |
|
text = "Client license error"; |
216 |
|
break; |
217 |
|
|
218 |
|
case exDiscReasonLicenseCantFinishProtocol: |
219 |
|
text = "Network error during licensing protocol"; |
220 |
|
break; |
221 |
|
|
222 |
|
case exDiscReasonLicenseClientEndedProtocol: |
223 |
|
text = "Licensing protocol was not completed"; |
224 |
|
break; |
225 |
|
|
226 |
|
case exDiscReasonLicenseErrClientEncryption: |
227 |
|
text = "Incorrect client license enryption"; |
228 |
|
break; |
229 |
|
|
230 |
|
case exDiscReasonLicenseCantUpgradeLicense: |
231 |
|
text = "Can't upgrade license"; |
232 |
|
break; |
233 |
|
|
234 |
|
case exDiscReasonLicenseNoRemoteConnections: |
235 |
|
text = "The server is not licensed to accept remote connections"; |
236 |
|
break; |
237 |
|
|
238 |
|
default: |
239 |
|
if (reason > 0x1000 && reason < 0x7fff) |
240 |
|
{ |
241 |
|
text = "Internal protocol error"; |
242 |
|
} |
243 |
|
else |
244 |
|
{ |
245 |
|
text = "Unknown reason"; |
246 |
|
} |
247 |
|
} |
248 |
|
fprintf(stderr, "disconnect: %s.\n", text); |
249 |
|
} |
250 |
|
|
251 |
static BOOL |
static BOOL |
252 |
read_password(char *password, int size) |
read_password(char *password, int size) |
253 |
{ |
{ |
342 |
char password[64]; |
char password[64]; |
343 |
char shell[128]; |
char shell[128]; |
344 |
char directory[32]; |
char directory[32]; |
345 |
BOOL prompt_password, rdp_retval = False; |
BOOL prompt_password, deactivated; |
346 |
struct passwd *pw; |
struct passwd *pw; |
347 |
uint32 flags; |
uint32 flags, ext_disc_reason = 0; |
348 |
char *p; |
char *p; |
349 |
int c; |
int c; |
350 |
|
|
704 |
|
|
705 |
if (ui_create_window()) |
if (ui_create_window()) |
706 |
{ |
{ |
707 |
rdp_retval = rdp_main_loop(); |
rdp_main_loop(&deactivated, &ext_disc_reason); |
708 |
ui_destroy_window(); |
ui_destroy_window(); |
709 |
} |
} |
710 |
|
|
712 |
rdp_disconnect(); |
rdp_disconnect(); |
713 |
ui_deinit(); |
ui_deinit(); |
714 |
|
|
715 |
if (True == rdp_retval) |
if (ext_disc_reason >= 2) |
716 |
|
print_disconnect_reason(ext_disc_reason); |
717 |
|
|
718 |
|
if (deactivated) |
719 |
|
{ |
720 |
|
/* clean disconnect */ |
721 |
return 0; |
return 0; |
722 |
|
} |
723 |
else |
else |
724 |
return 2; |
{ |
725 |
|
if (ext_disc_reason == exDiscReasonAPIInitiatedDisconnect |
726 |
|
|| ext_disc_reason == exDiscReasonAPIInitiatedLogoff) |
727 |
|
{ |
728 |
|
/* not so clean disconnect, but nothing to worry about */ |
729 |
|
return 0; |
730 |
|
} |
731 |
|
else |
732 |
|
{ |
733 |
|
/* return error */ |
734 |
|
return 2; |
735 |
|
} |
736 |
|
} |
737 |
|
|
738 |
#endif |
#endif |
739 |
|
|