common: xrdp_tls, indentation fix
This commit is contained in:
parent
c612683119
commit
be51fb739c
@ -22,7 +22,8 @@
|
||||
#include "ssl_calls.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct xrdp_tls *APP_CC
|
||||
struct xrdp_tls *
|
||||
APP_CC
|
||||
xrdp_tls_create(struct trans *trans, const char *key, const char *cert)
|
||||
{
|
||||
struct xrdp_tls *self;
|
||||
@ -81,41 +82,49 @@ xrdp_tls_accept(struct xrdp_tls *self)
|
||||
|
||||
self->ctx = SSL_CTX_new(SSLv23_server_method());
|
||||
/* set context options */
|
||||
SSL_CTX_set_mode(self->ctx, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | SSL_MODE_ENABLE_PARTIAL_WRITE);
|
||||
SSL_CTX_set_mode(self->ctx,
|
||||
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
|
||||
| SSL_MODE_ENABLE_PARTIAL_WRITE);
|
||||
SSL_CTX_set_options(self->ctx, options);
|
||||
SSL_CTX_set_read_ahead(self->ctx, 1);
|
||||
|
||||
if (self->ctx == NULL) {
|
||||
if (self->ctx == NULL)
|
||||
{
|
||||
g_writeln("xrdp_tls_accept: SSL_CTX_new failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (SSL_CTX_use_RSAPrivateKey_file(self->ctx, self->key, SSL_FILETYPE_PEM)
|
||||
<= 0) {
|
||||
<= 0)
|
||||
{
|
||||
g_writeln("xrdp_tls_accept: SSL_CTX_use_RSAPrivateKey_file failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
self->ssl = SSL_new(self->ctx);
|
||||
|
||||
if (self->ssl == NULL) {
|
||||
if (self->ssl == NULL)
|
||||
{
|
||||
g_writeln("xrdp_tls_accept: SSL_new failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (SSL_use_certificate_file(self->ssl, self->cert, SSL_FILETYPE_PEM) <= 0) {
|
||||
if (SSL_use_certificate_file(self->ssl, self->cert, SSL_FILETYPE_PEM) <= 0)
|
||||
{
|
||||
g_writeln("xrdp_tls_accept: SSL_use_certificate_file failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (SSL_set_fd(self->ssl, self->trans->sck) < 1) {
|
||||
if (SSL_set_fd(self->ssl, self->trans->sck) < 1)
|
||||
{
|
||||
g_writeln("xrdp_tls_accept: SSL_set_fd failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
connection_status = SSL_accept(self->ssl);
|
||||
|
||||
if (connection_status <= 0) {
|
||||
if (connection_status <= 0)
|
||||
{
|
||||
if (xrdp_tls_print_error("SSL_accept", self->ssl, connection_status))
|
||||
{
|
||||
return 1;
|
||||
@ -133,7 +142,8 @@ xrdp_tls_print_error(char *func, SSL *connection, int value)
|
||||
switch (SSL_get_error(connection, value))
|
||||
{
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
g_writeln("xrdp_tls_print_error: %s: Server closed TLS connection", func);
|
||||
g_writeln("xrdp_tls_print_error: %s: Server closed TLS connection",
|
||||
func);
|
||||
return 1;
|
||||
|
||||
case SSL_ERROR_WANT_READ:
|
||||
@ -149,7 +159,9 @@ xrdp_tls_print_error(char *func, SSL *connection, int value)
|
||||
return 1;
|
||||
|
||||
case SSL_ERROR_SSL:
|
||||
g_writeln("xrdp_tls_print_error: %s: Failure in SSL library (protocol error?)", func);
|
||||
g_writeln(
|
||||
"xrdp_tls_print_error: %s: Failure in SSL library (protocol error?)",
|
||||
func);
|
||||
return 1;
|
||||
|
||||
default:
|
||||
@ -166,7 +178,8 @@ xrdp_tls_disconnect(struct xrdp_tls *self)
|
||||
{
|
||||
status = SSL_shutdown(self->ssl);
|
||||
|
||||
if (status <= 0) {
|
||||
if (status <= 0)
|
||||
{
|
||||
if (xrdp_tls_print_error("SSL_shutdown", self->ssl, status))
|
||||
{
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user