|
@@ -22,7 +22,10 @@ ErhaltungServer::ErhaltungServer( InitDatei *zIni )
|
|
|
ini = zIni->getThis();
|
|
|
id = *zIni->zWert( "ServerId" );
|
|
|
server = new Server();
|
|
|
- aServer = new Server();
|
|
|
+ aServer = new SSLServer();
|
|
|
+ aServer->setPrivateKeyPassword( zIni->zWert( "SSLPasswort" )->getText() );
|
|
|
+ aServer->setCertificateFile( zIni->zWert( "SSLCert" )->getText() );
|
|
|
+ aServer->setPrivateKeyFile( zIni->zWert( "SSLKey" )->getText() );
|
|
|
std::cout << "ES: Starten des Admin Servers...\n";
|
|
|
if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
|
|
|
{
|
|
@@ -56,7 +59,7 @@ void ErhaltungServer::runn()
|
|
|
{
|
|
|
while( !end )
|
|
|
{
|
|
|
- SKlient *klient;
|
|
|
+ SSLSKlient *klient;
|
|
|
klient = aServer->getKlient();
|
|
|
if( end && klient )
|
|
|
{
|
|
@@ -259,13 +262,10 @@ ErhaltungServer *ErhaltungServer::release()
|
|
|
|
|
|
// Inhalt der RSAKlient Klasse aus RegisterServer.h
|
|
|
// Konstruktor
|
|
|
-ESAKlient::ESAKlient( SKlient *klient, ErhaltungServer *es )
|
|
|
+ESAKlient::ESAKlient( SSLSKlient *klient, ErhaltungServer *es )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
- unsigned char key[ 20 ] = { 139, 91, 188, 189, 188, 165, 72, 233, 199, 10, 253, 197, 61, 125, 201, 251, 37, 22, 161, 187 };
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
name = new Text( "" );
|
|
|
passwort = new Text( "" );
|
|
|
adminId = 0;
|
|
@@ -289,7 +289,7 @@ void ESAKlient::thread()
|
|
|
while( 1 )
|
|
|
{
|
|
|
char c = 0;
|
|
|
- if( !klient->getNachrichtEncrypted( &c, 1 ) )
|
|
|
+ if( !klient->getNachricht( &c, 1 ) )
|
|
|
break;
|
|
|
else
|
|
|
{
|
|
@@ -299,23 +299,23 @@ void ESAKlient::thread()
|
|
|
case 1: // Login
|
|
|
if( 1 )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
unsigned char nLen = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&nLen, 1 );
|
|
|
+ klient->getNachricht( (char*)&nLen, 1 );
|
|
|
char *n = new char[ nLen + 1 ];
|
|
|
n[ (int)nLen ] = 0;
|
|
|
if( nLen )
|
|
|
- klient->getNachrichtEncrypted( n, nLen );
|
|
|
+ klient->getNachricht( n, nLen );
|
|
|
unsigned char pLen = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&pLen, 1 );
|
|
|
+ klient->getNachricht( (char*)&pLen, 1 );
|
|
|
char *p = new char[ pLen + 1 ];
|
|
|
p[ (int)pLen ] = 0;
|
|
|
if( pLen )
|
|
|
- klient->getNachrichtEncrypted( p, pLen );
|
|
|
+ klient->getNachricht( p, pLen );
|
|
|
int adminId = es->zDB()->istAdministrator( n, p );
|
|
|
if( adminId )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
name->setText( n );
|
|
|
passwort->setText( p );
|
|
|
this->adminId = adminId;
|
|
@@ -330,11 +330,11 @@ void ESAKlient::thread()
|
|
|
adminId = 0;
|
|
|
name->setText( "" );
|
|
|
passwort->setText( "" );
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
break;
|
|
|
case 3: // Trennen
|
|
|
br = 1;
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
break;
|
|
|
case 4: // Server starten
|
|
|
if( !adminId )
|
|
@@ -351,7 +351,7 @@ void ESAKlient::thread()
|
|
|
err->release();
|
|
|
}
|
|
|
else
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht berechtigt den Server zu starten." );
|
|
@@ -365,7 +365,7 @@ void ESAKlient::thread()
|
|
|
if( es->zDB()->adminHatRecht( adminId, Admin_Recht::LSBeenden ) )
|
|
|
{
|
|
|
if( es->serverBeenden() )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -410,7 +410,7 @@ void ESAKlient::thread()
|
|
|
}
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "IS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
|
es->close();
|
|
|
br = 1;
|
|
@@ -437,7 +437,7 @@ void ESAKlient::thread()
|
|
|
ok = 1;
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "IS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
|
es->close();
|
|
|
br = 1;
|
|
@@ -454,8 +454,8 @@ void ESAKlient::thread()
|
|
|
if( es->istAn() )
|
|
|
status = 2;
|
|
|
}
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
- klient->sendeEncrypted( &status, 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
+ klient->sende( &status, 1 );
|
|
|
}
|
|
|
break;
|
|
|
case 9: // Server pausieren
|
|
@@ -463,9 +463,9 @@ void ESAKlient::thread()
|
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
|
else
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
char pause = 0;
|
|
|
- klient->getNachrichtEncrypted( &pause, 1 );
|
|
|
+ klient->getNachricht( &pause, 1 );
|
|
|
if( es->zDB()->adminHatRecht( adminId, Admin_Recht::LSPausieren ) )
|
|
|
{
|
|
|
bool ok = 0;
|
|
@@ -474,7 +474,7 @@ void ESAKlient::thread()
|
|
|
else
|
|
|
ok = es->serverFortsetzen();
|
|
|
if( ok )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -497,13 +497,13 @@ void ESAKlient::thread()
|
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
|
else
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
int maxC = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&maxC, 4 );
|
|
|
+ klient->getNachricht( (char*)&maxC, 4 );
|
|
|
if( es->zDB()->adminHatRecht( adminId, Admin_Recht::LSMCChange ) )
|
|
|
{
|
|
|
if( es->setMaxKlients( (unsigned char)maxC ) )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -533,10 +533,10 @@ void ESAKlient::thread()
|
|
|
|
|
|
void ESAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\3", 1 );
|
|
|
+ klient->sende( "\3", 1 );
|
|
|
char len = (char)textLength( nachricht );
|
|
|
- klient->sendeEncrypted( &len, 1 );
|
|
|
- klient->sendeEncrypted( nachricht, len );
|
|
|
+ klient->sende( &len, 1 );
|
|
|
+ klient->sende( nachricht, len );
|
|
|
}
|
|
|
|
|
|
|