diff --git a/common/ssl_calls.c b/common/ssl_calls.c index d44f878b..42155a70 100644 --- a/common/ssl_calls.c +++ b/common/ssl_calls.c @@ -1026,7 +1026,8 @@ log_encrypted_file_unsupported(char *buf, int size, int rwflag, void *u) int ssl_tls_accept(struct ssl_tls *self, long ssl_protocols, - const char *tls_ciphers) + const char *tls_ciphers, + int (*is_term)(void)) { int connection_status; long options = 0; @@ -1213,6 +1214,11 @@ ssl_tls_accept(struct ssl_tls *self, long ssl_protocols, g_sck_can_send(self->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT); break; } + + if (is_term != NULL && (*is_term)()) + { + return 1; + } } else { diff --git a/common/ssl_calls.h b/common/ssl_calls.h index 5b9c1e7f..0c94cb08 100644 --- a/common/ssl_calls.h +++ b/common/ssl_calls.h @@ -90,7 +90,8 @@ struct ssl_tls * ssl_tls_create(struct trans *trans, const char *key, const char *cert); int ssl_tls_accept(struct ssl_tls *self, long ssl_protocols, - const char *tls_ciphers); + const char *tls_ciphers, + int (*is_term)(void)); int ssl_tls_disconnect(struct ssl_tls *self); void diff --git a/common/trans.c b/common/trans.c index a97f87c4..cea9f9e8 100644 --- a/common/trans.c +++ b/common/trans.c @@ -1053,7 +1053,8 @@ trans_set_tls_mode(struct trans *self, const char *key, const char *cert, return 1; } - if (ssl_tls_accept(self->tls, ssl_protocols, tls_ciphers) != 0) + if (ssl_tls_accept(self->tls, ssl_protocols, + tls_ciphers, self->is_term) != 0) { LOG(LOG_LEVEL_ERROR, "trans_set_tls_mode: ssl_tls_accept failed"); return 1; diff --git a/xrdp/xrdp_listen.c b/xrdp/xrdp_listen.c index c13d06fb..8757f4c2 100644 --- a/xrdp/xrdp_listen.c +++ b/xrdp/xrdp_listen.c @@ -674,6 +674,7 @@ xrdp_listen_init(struct xrdp_listen *self) } ltrans->trans_conn_in = xrdp_listen_conn_in; ltrans->callback_data = self; + ltrans->is_term = g_is_term; list_add_item(self->trans_list, (intptr_t) ltrans); } return 0;