|
@@ -19,7 +19,10 @@ EditorServer::EditorServer( 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 << "EdS: Starten des Admin Servers...\n";
|
|
|
if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
|
|
|
{
|
|
@@ -58,7 +61,7 @@ void EditorServer::runn()
|
|
|
{
|
|
|
while( !end )
|
|
|
{
|
|
|
- SKlient *klient;
|
|
|
+ SSLSKlient *klient;
|
|
|
klient = aServer->getKlient();
|
|
|
if( end && klient )
|
|
|
{
|
|
@@ -303,13 +306,10 @@ EditorServer *EditorServer::release()
|
|
|
|
|
|
// Inhalt der EdSAKlient Klasse aus EditorServer.h
|
|
|
// Konstruktor
|
|
|
-EdSAKlient::EdSAKlient( SKlient *klient, EditorServer *eds )
|
|
|
+EdSAKlient::EdSAKlient( SSLSKlient *klient, EditorServer *eds )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
- unsigned char key[ 20 ] = { 102, 98, 8, 248, 114, 86, 30, 28, 18, 142, 113, 108, 129, 101, 196, 53, 37, 184, 73, 108 };
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
name = new Text( "" );
|
|
|
passwort = new Text( "" );
|
|
|
adminId = 0;
|
|
@@ -332,7 +332,7 @@ void EdSAKlient::thread()
|
|
|
while( 1 )
|
|
|
{
|
|
|
char c = 0;
|
|
|
- if( !klient->getNachrichtEncrypted( &c, 1 ) )
|
|
|
+ if( !klient->getNachricht( &c, 1 ) )
|
|
|
break;
|
|
|
else
|
|
|
{
|
|
@@ -342,23 +342,23 @@ void EdSAKlient::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 = eds->zDB()->istAdministrator( n, p );
|
|
|
if( adminId )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
name->setText( n );
|
|
|
passwort->setText( p );
|
|
|
this->adminId = adminId;
|
|
@@ -373,11 +373,11 @@ void EdSAKlient::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 )
|
|
@@ -394,7 +394,7 @@ void EdSAKlient::thread()
|
|
|
err->release();
|
|
|
}
|
|
|
else
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht berechtigt den Server zu starten." );
|
|
@@ -408,7 +408,7 @@ void EdSAKlient::thread()
|
|
|
if( eds->zDB()->adminHatRecht( adminId, Admin_Recht::EdSBeenden ) )
|
|
|
{
|
|
|
if( eds->serverBeenden() )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -453,7 +453,7 @@ void EdSAKlient::thread()
|
|
|
}
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "EdS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
|
eds->close();
|
|
|
br = 1;
|
|
@@ -480,7 +480,7 @@ void EdSAKlient::thread()
|
|
|
ok = 1;
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "EdS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
|
eds->close();
|
|
|
br = 1;
|
|
@@ -497,8 +497,8 @@ void EdSAKlient::thread()
|
|
|
if( eds->istAn() )
|
|
|
status = 2;
|
|
|
}
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
- klient->sendeEncrypted( &status, 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
+ klient->sende( &status, 1 );
|
|
|
}
|
|
|
break;
|
|
|
case 9: // Server pausieren
|
|
@@ -506,9 +506,9 @@ void EdSAKlient::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( eds->zDB()->adminHatRecht( adminId, Admin_Recht::EdSPausieren ) )
|
|
|
{
|
|
|
bool ok = 0;
|
|
@@ -517,7 +517,7 @@ void EdSAKlient::thread()
|
|
|
else
|
|
|
ok = eds->serverFortsetzen();
|
|
|
if( ok )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -540,13 +540,13 @@ void EdSAKlient::thread()
|
|
|
errorZuKlient( "Du musst dich einloggen." );
|
|
|
else
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
int maxK = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&maxK, 4 );
|
|
|
+ klient->getNachricht( (char*)&maxK, 4 );
|
|
|
if( eds->zDB()->adminHatRecht( adminId, Admin_Recht::EdSMKChange ) )
|
|
|
{
|
|
|
if( eds->setMaxKarten( maxK ) )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -562,13 +562,13 @@ void EdSAKlient::thread()
|
|
|
case 0xC: // klient absturtz
|
|
|
if( 1 )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&klientId, 4 );
|
|
|
+ klient->getNachricht( (char*)&klientId, 4 );
|
|
|
if( klientId && eds->absturzKlient( klientId ) )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
- klient->sendeEncrypted( "\0", 1 );
|
|
|
+ klient->sende( "\0", 1 );
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -588,10 +588,10 @@ void EdSAKlient::thread()
|
|
|
|
|
|
void EdSAKlient::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 );
|
|
|
}
|
|
|
|
|
|
|