|
@@ -20,7 +20,10 @@ InformationServer::InformationServer( InitDatei *zIni )
|
|
ini = zIni->getThis();
|
|
ini = zIni->getThis();
|
|
id = *zIni->zWert( "ServerId" );
|
|
id = *zIni->zWert( "ServerId" );
|
|
server = new Server();
|
|
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 << "IS: Starten des Admin Servers...\n";
|
|
std::cout << "IS: Starten des Admin Servers...\n";
|
|
if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
|
|
if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
|
|
{
|
|
{
|
|
@@ -59,7 +62,7 @@ void InformationServer::runn()
|
|
{
|
|
{
|
|
while( !end )
|
|
while( !end )
|
|
{
|
|
{
|
|
- SKlient *klient;
|
|
|
|
|
|
+ SSLSKlient *klient;
|
|
klient = aServer->getKlient();
|
|
klient = aServer->getKlient();
|
|
if( end && klient )
|
|
if( end && klient )
|
|
{
|
|
{
|
|
@@ -299,13 +302,10 @@ InformationServer *InformationServer::release()
|
|
|
|
|
|
// Inhalt der ISAKlient Klasse aus InformationServer.h
|
|
// Inhalt der ISAKlient Klasse aus InformationServer.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
-ISAKlient::ISAKlient( SKlient *klient, InformationServer *is )
|
|
|
|
|
|
+ISAKlient::ISAKlient( SSLSKlient *klient, InformationServer *is )
|
|
: Thread()
|
|
: Thread()
|
|
{
|
|
{
|
|
this->klient = klient;
|
|
this->klient = klient;
|
|
- unsigned char key[ 20 ] = { 37, 231, 77, 95, 83, 98, 112, 98, 11, 225, 186, 227, 172, 168, 11, 22, 254, 142, 14, 22 };
|
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
|
name = new Text( "" );
|
|
name = new Text( "" );
|
|
passwort = new Text( "" );
|
|
passwort = new Text( "" );
|
|
adminId = 0;
|
|
adminId = 0;
|
|
@@ -328,7 +328,7 @@ void ISAKlient::thread()
|
|
while( 1 )
|
|
while( 1 )
|
|
{
|
|
{
|
|
char c = 0;
|
|
char c = 0;
|
|
- if( !klient->getNachrichtEncrypted( &c, 1 ) )
|
|
|
|
|
|
+ if( !klient->getNachricht( &c, 1 ) )
|
|
break;
|
|
break;
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -338,23 +338,23 @@ void ISAKlient::thread()
|
|
case 1: // Login
|
|
case 1: // Login
|
|
if( 1 )
|
|
if( 1 )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
unsigned char nLen = 0;
|
|
unsigned char nLen = 0;
|
|
- klient->getNachrichtEncrypted( (char*)&nLen, 1 );
|
|
|
|
|
|
+ klient->getNachricht( (char*)&nLen, 1 );
|
|
char *n = new char[ nLen + 1 ];
|
|
char *n = new char[ nLen + 1 ];
|
|
n[ (int)nLen ] = 0;
|
|
n[ (int)nLen ] = 0;
|
|
if( nLen )
|
|
if( nLen )
|
|
- klient->getNachrichtEncrypted( n, nLen );
|
|
|
|
|
|
+ klient->getNachricht( n, nLen );
|
|
unsigned char pLen = 0;
|
|
unsigned char pLen = 0;
|
|
- klient->getNachrichtEncrypted( (char*)&pLen, 1 );
|
|
|
|
|
|
+ klient->getNachricht( (char*)&pLen, 1 );
|
|
char *p = new char[ pLen + 1 ];
|
|
char *p = new char[ pLen + 1 ];
|
|
p[ (int)pLen ] = 0;
|
|
p[ (int)pLen ] = 0;
|
|
if( pLen )
|
|
if( pLen )
|
|
- klient->getNachrichtEncrypted( p, pLen );
|
|
|
|
|
|
+ klient->getNachricht( p, pLen );
|
|
int adminId = is->zDB()->istAdministrator( n, p );
|
|
int adminId = is->zDB()->istAdministrator( n, p );
|
|
if( adminId )
|
|
if( adminId )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
name->setText( n );
|
|
name->setText( n );
|
|
passwort->setText( p );
|
|
passwort->setText( p );
|
|
this->adminId = adminId;
|
|
this->adminId = adminId;
|
|
@@ -369,11 +369,11 @@ void ISAKlient::thread()
|
|
adminId = 0;
|
|
adminId = 0;
|
|
name->setText( "" );
|
|
name->setText( "" );
|
|
passwort->setText( "" );
|
|
passwort->setText( "" );
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
break;
|
|
break;
|
|
case 3: // Trennen
|
|
case 3: // Trennen
|
|
br = 1;
|
|
br = 1;
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
break;
|
|
break;
|
|
case 4: // Server starten
|
|
case 4: // Server starten
|
|
if( !adminId )
|
|
if( !adminId )
|
|
@@ -390,7 +390,7 @@ void ISAKlient::thread()
|
|
err->release();
|
|
err->release();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
}
|
|
}
|
|
else
|
|
else
|
|
errorZuKlient( "Du bist nicht berechtigt den Server zu starten." );
|
|
errorZuKlient( "Du bist nicht berechtigt den Server zu starten." );
|
|
@@ -404,7 +404,7 @@ void ISAKlient::thread()
|
|
if( is->zDB()->adminHatRecht( adminId, Admin_Recht::ISBeenden ) )
|
|
if( is->zDB()->adminHatRecht( adminId, Admin_Recht::ISBeenden ) )
|
|
{
|
|
{
|
|
if( is->serverBeenden() )
|
|
if( is->serverBeenden() )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Text *err = new Text();
|
|
Text *err = new Text();
|
|
@@ -449,7 +449,7 @@ void ISAKlient::thread()
|
|
}
|
|
}
|
|
if( ok )
|
|
if( ok )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
std::cout << "IS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
std::cout << "IS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
is->close();
|
|
is->close();
|
|
br = 1;
|
|
br = 1;
|
|
@@ -476,7 +476,7 @@ void ISAKlient::thread()
|
|
ok = 1;
|
|
ok = 1;
|
|
if( ok )
|
|
if( ok )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
std::cout << "IS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
std::cout << "IS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
is->close();
|
|
is->close();
|
|
br = 1;
|
|
br = 1;
|
|
@@ -493,8 +493,8 @@ void ISAKlient::thread()
|
|
if( is->istAn() )
|
|
if( is->istAn() )
|
|
status = 2;
|
|
status = 2;
|
|
}
|
|
}
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
- klient->sendeEncrypted( &status, 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
|
+ klient->sende( &status, 1 );
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case 9: // Server pausieren
|
|
case 9: // Server pausieren
|
|
@@ -502,9 +502,9 @@ void ISAKlient::thread()
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
char pause = 0;
|
|
char pause = 0;
|
|
- klient->getNachrichtEncrypted( &pause, 1 );
|
|
|
|
|
|
+ klient->getNachricht( &pause, 1 );
|
|
if( is->zDB()->adminHatRecht( adminId, Admin_Recht::ISPausieren ) )
|
|
if( is->zDB()->adminHatRecht( adminId, Admin_Recht::ISPausieren ) )
|
|
{
|
|
{
|
|
bool ok = 0;
|
|
bool ok = 0;
|
|
@@ -513,7 +513,7 @@ void ISAKlient::thread()
|
|
else
|
|
else
|
|
ok = is->serverFortsetzen();
|
|
ok = is->serverFortsetzen();
|
|
if( ok )
|
|
if( ok )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Text *err = new Text();
|
|
Text *err = new Text();
|
|
@@ -536,13 +536,13 @@ void ISAKlient::thread()
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
int maxC = 0;
|
|
int maxC = 0;
|
|
- klient->getNachrichtEncrypted( (char*)&maxC, 4 );
|
|
|
|
|
|
+ klient->getNachricht( (char*)&maxC, 4 );
|
|
if( is->zDB()->adminHatRecht( adminId, Admin_Recht::ISMCChange ) )
|
|
if( is->zDB()->adminHatRecht( adminId, Admin_Recht::ISMCChange ) )
|
|
{
|
|
{
|
|
if( is->setMaxKlients( maxC ) )
|
|
if( is->setMaxKlients( maxC ) )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Text *err = new Text();
|
|
Text *err = new Text();
|
|
@@ -558,13 +558,13 @@ void ISAKlient::thread()
|
|
case 0xC: // klient absturtz
|
|
case 0xC: // klient absturtz
|
|
if( 1 )
|
|
if( 1 )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
int klientId = 0;
|
|
int klientId = 0;
|
|
- klient->getNachrichtEncrypted( (char*)&klientId, 4 );
|
|
|
|
|
|
+ klient->getNachricht( (char*)&klientId, 4 );
|
|
if( klientId && is->absturzKlient( klientId ) )
|
|
if( klientId && is->absturzKlient( klientId ) )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
- klient->sendeEncrypted( "\0", 1 );
|
|
|
|
|
|
+ klient->sende( "\0", 1 );
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -584,10 +584,10 @@ void ISAKlient::thread()
|
|
|
|
|
|
void ISAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
void ISAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\3", 1 );
|
|
|
|
|
|
+ klient->sende( "\3", 1 );
|
|
char len = (char)textLength( nachricht );
|
|
char len = (char)textLength( nachricht );
|
|
- klient->sendeEncrypted( &len, 1 );
|
|
|
|
- klient->sendeEncrypted( nachricht, len );
|
|
|
|
|
|
+ klient->sende( &len, 1 );
|
|
|
|
+ klient->sende( nachricht, len );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|