Simplification of TLS Init and bugfixes

This commit is contained in:
René Linder 2020-11-28 10:42:10 +01:00
parent 402feb568c
commit 880246c0fb
1 changed files with 4 additions and 9 deletions

View File

@ -237,7 +237,6 @@ Module lhs_web
Procedure start_server()
Global NewMap m_clients.s_clients(conf_max_clients)
Protected settings.ltls::s_tls_server
Protected tlsresponse.i
;TODO: Create SSL Server
@ -246,15 +245,11 @@ Module lhs_web
If conf_TLS_enable = 1
server_SSL_id = lsocket::CreateSocket(conf_TLS_Port, conf_max_clients, lsocket::#SOCK_STREAM, lsocket::#AF_INET, conf_TLS_binding)
If server_SSL_id
settings\CA = conf_TLS_CA
settings\Cert = conf_TLS_Cert
settings\Key = conf_TLS_Key
settings\Password = conf_TLS_Key_Pass
tlsresponse = ltls::InitTLS(@settings)
Debug "TLS Fehler:"+Str(tlsresponse)
tlsresponse = ltls::InitSimpleTLS(conf_TLS_CA, conf_TLS_Cert, conf_TLS_Key, conf_TLS_Key_Pass)
If tlsresponse > 0
CreateThread(@server_SSL(), server_SSL_id)
Else
Debug "TLS Fehler:"+Str(tlsresponse)
ProcedureReturn #False
EndIf
@ -298,13 +293,13 @@ Module lhs_web
count_client + 1
Else
Debug "Max TLS Clients reached..."
CloseNetworkConnection(client_id)
ltls::CloseTLSSocket(client_id)
EndIf
Else
Break
EndIf
ForEver
ltls::CloseTLS(network_server_id)
EndProcedure