|
@@ -19,7 +19,10 @@ AnmeldungServer::AnmeldungServer( 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 << "AS: Starten des Admin Servers...\n";
|
|
|
if( !aServer->verbinde( (unsigned short)TextZuInt( ini->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
|
|
|
{
|
|
@@ -58,7 +61,7 @@ void AnmeldungServer::runn()
|
|
|
{
|
|
|
while( !end )
|
|
|
{
|
|
|
- SKlient *klient;
|
|
|
+ SSLSKlient *klient;
|
|
|
klient = aServer->getKlient();
|
|
|
if( end && klient )
|
|
|
{
|
|
@@ -302,13 +305,10 @@ AnmeldungServer *AnmeldungServer::release()
|
|
|
|
|
|
// Inhalt der ASAKlient Klasse aus AnmeldungServer.h
|
|
|
// Konstruktor
|
|
|
-ASAKlient::ASAKlient( SKlient *klient, AnmeldungServer *as )
|
|
|
+ASAKlient::ASAKlient( SSLSKlient *klient, AnmeldungServer *as )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
- unsigned char key[ 20 ] = { 208, 28, 97, 9, 169, 209, 137, 159, 123, 216, 202, 244, 86, 78, 172, 35, 26, 180, 113, 47 };
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
name = new Text( "" );
|
|
|
passwort = new Text( "" );
|
|
|
adminId = 0;
|
|
@@ -332,7 +332,7 @@ void ASAKlient::thread()
|
|
|
while( 1 )
|
|
|
{
|
|
|
char c = 0;
|
|
|
- if( !klient->getNachrichtEncrypted( &c, 1 ) )
|
|
|
+ if( !klient->getNachricht( &c, 1 ) )
|
|
|
break;
|
|
|
else
|
|
|
{
|
|
@@ -342,23 +342,23 @@ void ASAKlient::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 = as->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 ASAKlient::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 ASAKlient::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 ASAKlient::thread()
|
|
|
if( as->zDB()->adminHatRecht( adminId, Admin_Recht::ASBeenden ) )
|
|
|
{
|
|
|
if( as->serverBeenden() )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -453,7 +453,7 @@ void ASAKlient::thread()
|
|
|
}
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "AS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
|
as->close();
|
|
|
br = 1;
|
|
@@ -480,7 +480,7 @@ void ASAKlient::thread()
|
|
|
ok = 1;
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "AS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
|
as->close();
|
|
|
br = 1;
|
|
@@ -497,8 +497,8 @@ void ASAKlient::thread()
|
|
|
if( as->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 ASAKlient::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( as->zDB()->adminHatRecht( adminId, Admin_Recht::ASPausieren ) )
|
|
|
{
|
|
|
bool ok = 0;
|
|
@@ -517,7 +517,7 @@ void ASAKlient::thread()
|
|
|
else
|
|
|
ok = as->serverFortsetzen();
|
|
|
if( ok )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -540,13 +540,13 @@ void ASAKlient::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( as->zDB()->adminHatRecht( adminId, Admin_Recht::ASMCChange ) )
|
|
|
{
|
|
|
if( as->setMaxKlients( maxC ) )
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
Text *err = new Text();
|
|
@@ -562,13 +562,13 @@ void ASAKlient::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 && as->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 ASAKlient::thread()
|
|
|
|
|
|
void ASAKlient::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 );
|
|
|
}
|
|
|
|
|
|
|