Added tcp_ui_run() to prevent ui_select() push data on transport
which corrupts the stream and prevents a SSL reconnect to work. git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/rdesktop/trunk@1720 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
dc3be1486d
commit
e6b10f6bcb
1
proto.h
1
proto.h
@ -227,6 +227,7 @@ RD_BOOL tcp_is_connected(void);
|
||||
void tcp_reset_state(void);
|
||||
RD_BOOL tcp_tls_connect(void);
|
||||
RD_BOOL tcp_tls_get_server_pubkey(STREAM s);
|
||||
void tcp_run_ui(RD_BOOL run);
|
||||
|
||||
/* asn.c */
|
||||
RD_BOOL ber_in_header(STREAM s, int *tagval, int *length);
|
||||
|
@ -1121,8 +1121,6 @@ main(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
g_network_error = False;
|
||||
|
||||
|
||||
/* By setting encryption to False here, we have an encrypted login
|
||||
packet but unencrypted transfer of other packets */
|
||||
@ -1140,13 +1138,16 @@ main(int argc, char *argv[])
|
||||
return EX_OSERR;
|
||||
}
|
||||
|
||||
tcp_run_ui(True);
|
||||
|
||||
g_redirect = False;
|
||||
g_reconnect_loop = False;
|
||||
rdp_main_loop(&deactivated, &ext_disc_reason);
|
||||
|
||||
tcp_run_ui(False);
|
||||
|
||||
DEBUG(("Disconnecting...\n"));
|
||||
if (!tcp_is_connected())
|
||||
rdp_disconnect();
|
||||
rdp_disconnect();
|
||||
|
||||
if (g_redirect)
|
||||
continue;
|
||||
|
28
tcp.c
28
tcp.c
@ -61,6 +61,7 @@ static RD_BOOL g_ssl_initialized = False;
|
||||
static SSL *g_ssl = NULL;
|
||||
static SSL_CTX *g_ssl_ctx = NULL;
|
||||
static int g_sock;
|
||||
static RD_BOOL g_run_ui = False;
|
||||
static struct stream g_in;
|
||||
static struct stream g_out[STREAM_COUNT];
|
||||
int g_tcp_port_rdp = TCP_PORT_RDP;
|
||||
@ -123,7 +124,7 @@ tcp_send(STREAM s)
|
||||
int length = s->end - s->data;
|
||||
int sent, total = 0;
|
||||
|
||||
if (g_network_error)
|
||||
if (g_network_error == True)
|
||||
return;
|
||||
|
||||
#ifdef WITH_SCARD
|
||||
@ -148,8 +149,6 @@ tcp_send(STREAM s)
|
||||
#ifdef WITH_SCARD
|
||||
scard_unlock(SCARD_LOCK_TCP);
|
||||
#endif
|
||||
if (g_network_error == True)
|
||||
return;
|
||||
|
||||
error("SSL_write: %d (%s)\n", ssl_err, TCP_STRERROR);
|
||||
g_network_error = True;
|
||||
@ -172,8 +171,6 @@ tcp_send(STREAM s)
|
||||
#ifdef WITH_SCARD
|
||||
scard_unlock(SCARD_LOCK_TCP);
|
||||
#endif
|
||||
if (g_network_error == True)
|
||||
return;
|
||||
|
||||
error("send: %s\n", TCP_STRERROR);
|
||||
g_network_error = True;
|
||||
@ -195,8 +192,8 @@ tcp_recv(STREAM s, uint32 length)
|
||||
uint32 new_length, end_offset, p_offset;
|
||||
int rcvd = 0, ssl_err;
|
||||
|
||||
if (g_network_error)
|
||||
return NULL;
|
||||
if (g_network_error == True)
|
||||
return;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
@ -226,11 +223,14 @@ tcp_recv(STREAM s, uint32 length)
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
if ((!g_ssl || SSL_pending(g_ssl) <= 0) && !ui_select(g_sock))
|
||||
if ((!g_ssl || SSL_pending(g_ssl) <= 0) && g_run_ui)
|
||||
{
|
||||
/* User quit */
|
||||
g_user_quit = True;
|
||||
return NULL;
|
||||
if (!ui_select(g_sock))
|
||||
{
|
||||
/* User quit */
|
||||
g_user_quit = True;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_ssl)
|
||||
@ -603,3 +603,9 @@ tcp_reset_state(void)
|
||||
g_out[i].channel_hdr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tcp_run_ui(RD_BOOL run)
|
||||
{
|
||||
g_run_ui = run;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user