|
@@ -19,7 +19,10 @@ MinigameServer::MinigameServer( 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 << "MS: Starten des Admin Servers...\n";
|
|
std::cout << "MS: 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 ) )
|
|
{
|
|
{
|
|
@@ -58,7 +61,7 @@ void MinigameServer::runn()
|
|
{
|
|
{
|
|
while( !end )
|
|
while( !end )
|
|
{
|
|
{
|
|
- SKlient *klient;
|
|
|
|
|
|
+ SSLSKlient *klient;
|
|
klient = aServer->getKlient();
|
|
klient = aServer->getKlient();
|
|
if( end && klient )
|
|
if( end && klient )
|
|
{
|
|
{
|
|
@@ -303,13 +306,10 @@ MinigameServer *MinigameServer::release()
|
|
|
|
|
|
// Inhalt der LSAKlient Klasse aus LoginServer.h
|
|
// Inhalt der LSAKlient Klasse aus LoginServer.h
|
|
// Konstruktor
|
|
// Konstruktor
|
|
-MSAKlient::MSAKlient( SKlient *klient, MinigameServer *ls )
|
|
|
|
|
|
+MSAKlient::MSAKlient( SSLSKlient *klient, MinigameServer *ls )
|
|
: Thread()
|
|
: Thread()
|
|
{
|
|
{
|
|
this->klient = klient;
|
|
this->klient = klient;
|
|
- unsigned char key[ 20 ] = { 168, 13, 57, 219, 1, 54, 176, 97, 163, 80, 63, 101, 137, 132, 45, 103, 204, 225, 53, 197 };
|
|
|
|
- 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;
|
|
@@ -333,7 +333,7 @@ void MSAKlient::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
|
|
{
|
|
{
|
|
@@ -343,23 +343,23 @@ void MSAKlient::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 = ms->zDB()->istAdministrator( n, p );
|
|
int adminId = ms->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;
|
|
@@ -374,11 +374,11 @@ void MSAKlient::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 )
|
|
@@ -395,7 +395,7 @@ void MSAKlient::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." );
|
|
@@ -409,7 +409,7 @@ void MSAKlient::thread()
|
|
if( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSBeenden ) )
|
|
if( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSBeenden ) )
|
|
{
|
|
{
|
|
if( ms->serverBeenden() )
|
|
if( ms->serverBeenden() )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Text *err = new Text();
|
|
Text *err = new Text();
|
|
@@ -454,7 +454,7 @@ void MSAKlient::thread()
|
|
}
|
|
}
|
|
if( ok )
|
|
if( ok )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
std::cout << "MS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
std::cout << "MS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
ms->close();
|
|
ms->close();
|
|
br = 1;
|
|
br = 1;
|
|
@@ -481,7 +481,7 @@ void MSAKlient::thread()
|
|
ok = 1;
|
|
ok = 1;
|
|
if( ok )
|
|
if( ok )
|
|
{
|
|
{
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
std::cout << "MS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
std::cout << "MS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
ms->close();
|
|
ms->close();
|
|
br = 1;
|
|
br = 1;
|
|
@@ -498,8 +498,8 @@ void MSAKlient::thread()
|
|
if( ms->istAn() )
|
|
if( ms->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
|
|
@@ -507,9 +507,9 @@ void MSAKlient::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( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSPausieren ) )
|
|
if( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSPausieren ) )
|
|
{
|
|
{
|
|
bool ok = 0;
|
|
bool ok = 0;
|
|
@@ -518,7 +518,7 @@ void MSAKlient::thread()
|
|
else
|
|
else
|
|
ok = ms->serverFortsetzen();
|
|
ok = ms->serverFortsetzen();
|
|
if( ok )
|
|
if( ok )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Text *err = new Text();
|
|
Text *err = new Text();
|
|
@@ -541,13 +541,13 @@ void MSAKlient::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( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSMCChange ) )
|
|
if( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSMCChange ) )
|
|
{
|
|
{
|
|
if( ms->setMaxKlients( maxC ) )
|
|
if( ms->setMaxKlients( maxC ) )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
{
|
|
{
|
|
Text *err = new Text();
|
|
Text *err = new Text();
|
|
@@ -563,13 +563,13 @@ void MSAKlient::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 && ms->absturzKlient( klientId ) )
|
|
if( klientId && ms->absturzKlient( klientId ) )
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
|
|
|
+ klient->sende( "\1", 1 );
|
|
else
|
|
else
|
|
- klient->sendeEncrypted( "\0", 1 );
|
|
|
|
|
|
+ klient->sende( "\0", 1 );
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
@@ -589,10 +589,10 @@ void MSAKlient::thread()
|
|
|
|
|
|
void MSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
void MSAKlient::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 );
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -718,7 +718,7 @@ void MSKlient::thread()
|
|
for( auto t = oList.getArray(); t.set && t.var; t++ )
|
|
for( auto t = oList.getArray(); t.set && t.var; t++ )
|
|
{
|
|
{
|
|
l = (char)t.var->getLength();
|
|
l = (char)t.var->getLength();
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
|
|
|
+ klient->sendeEncrypted( (char*)&l, 1 );
|
|
klient->sendeEncrypted( t.var->getText(), l );
|
|
klient->sendeEncrypted( t.var->getText(), l );
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -742,10 +742,10 @@ void MSKlient::thread()
|
|
int s = sList.get( i );
|
|
int s = sList.get( i );
|
|
klient->sendeEncrypted( (char*)&s, 4 );
|
|
klient->sendeEncrypted( (char*)&s, 4 );
|
|
l = (char)pList.z( i )->getLength();
|
|
l = (char)pList.z( i )->getLength();
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
|
|
|
+ klient->sendeEncrypted( (char*)&l, 1 );
|
|
klient->sendeEncrypted( pList.z( i )->getText(), l );
|
|
klient->sendeEncrypted( pList.z( i )->getText(), l );
|
|
l = (char)oList.z( i )->getLength();
|
|
l = (char)oList.z( i )->getLength();
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
|
|
|
+ klient->sendeEncrypted( (char*)&l, 1 );
|
|
klient->sendeEncrypted( oList.z( i )->getText(), l );
|
|
klient->sendeEncrypted( oList.z( i )->getText(), l );
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -770,7 +770,7 @@ void MSKlient::thread()
|
|
if( score )
|
|
if( score )
|
|
{
|
|
{
|
|
l = (char)player.getLength();
|
|
l = (char)player.getLength();
|
|
- klient->sendeEncrypted( &l, 1 );
|
|
|
|
|
|
+ klient->sendeEncrypted( (char*)&l, 1 );
|
|
klient->sendeEncrypted( player.getText(), l );
|
|
klient->sendeEncrypted( player.getText(), l );
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -892,10 +892,10 @@ void MSKlient::thread()
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|
|
{
|
|
{
|
|
l = (char)textLength( mName );
|
|
l = (char)textLength( mName );
|
|
- k->sendeEncrypted( &l, 1 );
|
|
|
|
|
|
+ k->sendeEncrypted( (char*)&l, 1 );
|
|
k->sendeEncrypted( mName, l );
|
|
k->sendeEncrypted( mName, l );
|
|
l = (char)textLength( oName );
|
|
l = (char)textLength( oName );
|
|
- k->sendeEncrypted( &l, 1 );
|
|
|
|
|
|
+ k->sendeEncrypted( (char*)&l, 1 );
|
|
k->sendeEncrypted( oName, l );
|
|
k->sendeEncrypted( oName, l );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
if( ret == 1 )
|
|
if( ret == 1 )
|