92 |
uint32 g_embed_wnd; |
uint32 g_embed_wnd; |
93 |
uint32 g_rdp5_performanceflags = |
uint32 g_rdp5_performanceflags = |
94 |
RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS; |
RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS; |
95 |
|
/* Session Directory redirection */ |
96 |
|
BOOL g_redirect = False; |
97 |
|
char g_redirect_server[64]; |
98 |
|
char g_redirect_domain[16]; |
99 |
|
char g_redirect_password[64]; |
100 |
|
char g_redirect_username[64]; |
101 |
|
char g_redirect_cookie[128]; |
102 |
|
uint32 g_redirect_flags = 0; |
103 |
|
|
104 |
#ifdef WITH_RDPSND |
#ifdef WITH_RDPSND |
105 |
BOOL g_rdpsnd = False; |
BOOL g_rdpsnd = False; |
283 |
fprintf(stderr, "disconnect: %s.\n", text); |
fprintf(stderr, "disconnect: %s.\n", text); |
284 |
} |
} |
285 |
|
|
286 |
|
static void |
287 |
|
rdesktop_reset_state(void) |
288 |
|
{ |
289 |
|
rdp_reset_state(); |
290 |
|
} |
291 |
|
|
292 |
static BOOL |
static BOOL |
293 |
read_password(char *password, int size) |
read_password(char *password, int size) |
294 |
{ |
{ |
390 |
int c; |
int c; |
391 |
char *locale = NULL; |
char *locale = NULL; |
392 |
int username_option = 0; |
int username_option = 0; |
393 |
|
int run_count = 0; /* Session Directory support */ |
394 |
|
BOOL continue_connect = True; /* Session Directory support */ |
395 |
|
|
396 |
#ifdef HAVE_LOCALE_H |
#ifdef HAVE_LOCALE_H |
397 |
/* Set locale according to environment */ |
/* Set locale according to environment */ |
806 |
#endif |
#endif |
807 |
rdpdr_init(); |
rdpdr_init(); |
808 |
|
|
809 |
if (!rdp_connect(server, flags, domain, password, shell, directory)) |
while (run_count < 2 && continue_connect) /* add support for Session Directory; only reconnect once */ |
810 |
return 1; |
{ |
811 |
|
if (run_count == 0) |
812 |
|
{ |
813 |
|
if (!rdp_connect(server, flags, domain, password, shell, directory)) |
814 |
|
return 1; |
815 |
|
} |
816 |
|
else if (!rdp_reconnect |
817 |
|
(server, flags, domain, password, shell, directory, g_redirect_cookie)) |
818 |
|
return 1; |
819 |
|
|
820 |
/* By setting encryption to False here, we have an encrypted login |
/* By setting encryption to False here, we have an encrypted login |
821 |
packet but unencrypted transfer of other packets */ |
packet but unencrypted transfer of other packets */ |
822 |
if (!packet_encryption) |
if (!packet_encryption) |
823 |
g_encryption = False; |
g_encryption = False; |
824 |
|
|
825 |
|
|
826 |
DEBUG(("Connection successful.\n")); |
DEBUG(("Connection successful.\n")); |
827 |
memset(password, 0, sizeof(password)); |
memset(password, 0, sizeof(password)); |
828 |
|
|
829 |
if (ui_create_window()) |
if (run_count == 0) |
830 |
{ |
if (!ui_create_window()) |
831 |
rdp_main_loop(&deactivated, &ext_disc_reason); |
continue_connect = False; |
832 |
ui_destroy_window(); |
|
833 |
|
if (continue_connect) |
834 |
|
rdp_main_loop(&deactivated, &ext_disc_reason); |
835 |
|
|
836 |
|
DEBUG(("Disconnecting...\n")); |
837 |
|
rdp_disconnect(); |
838 |
|
|
839 |
|
if ((g_redirect == True) && (run_count == 0)) /* Support for Session Directory */ |
840 |
|
{ |
841 |
|
/* reset state of major globals */ |
842 |
|
rdesktop_reset_state(); |
843 |
|
|
844 |
|
STRNCPY(domain, g_redirect_domain, sizeof(domain)); |
845 |
|
STRNCPY(g_username, g_redirect_username, sizeof(g_username)); |
846 |
|
STRNCPY(password, g_redirect_password, sizeof(password)); |
847 |
|
STRNCPY(server, g_redirect_server, sizeof(server)); |
848 |
|
flags |= RDP_LOGON_AUTO; |
849 |
|
|
850 |
|
g_redirect = False; |
851 |
|
} |
852 |
|
else |
853 |
|
{ |
854 |
|
continue_connect = False; |
855 |
|
ui_destroy_window(); |
856 |
|
break; |
857 |
|
} |
858 |
|
|
859 |
|
run_count++; |
860 |
} |
} |
861 |
|
|
|
DEBUG(("Disconnecting...\n")); |
|
|
rdp_disconnect(); |
|
862 |
cache_save_state(); |
cache_save_state(); |
863 |
ui_deinit(); |
ui_deinit(); |
864 |
|
|