|
@@ -19,10 +19,14 @@ MainServer::MainServer( InitDatei *zDat )
|
|
|
gesendet = 0;
|
|
|
dat = zDat->getThis();
|
|
|
serverSSL = new SSLServer();
|
|
|
- serverSSL->setCertificateFile( zDat->zWert( "SSLCert" )->getText() );
|
|
|
- serverSSL->setCertificateFile( zDat->zWert( "SSLKey" )->getText() );
|
|
|
+ aServer->setPrivateKeyPassword( zDat->zWert( "SSLPasswort" )->getText() );
|
|
|
+ aServer->setCertificateFile( zDat->zWert( "SSLCert" )->getText() );
|
|
|
+ aServer->setPrivateKeyFile( zDat->zWert( "SSLKey" )->getText() );
|
|
|
server = new Server();
|
|
|
- aServer = new Server();
|
|
|
+ aServer = new SSLServer();
|
|
|
+ aServer->setPrivateKeyPassword( zDat->zWert( "SSLPasswort" )->getText() );
|
|
|
+ aServer->setCertificateFile( zDat->zWert( "SSLCert" )->getText() );
|
|
|
+ aServer->setPrivateKeyFile( zDat->zWert( "SSLKey" )->getText() );
|
|
|
std::cout << "MS: Starten des Admin Servers...\n";
|
|
|
if( !aServer->verbinde( (unsigned short)TextZuInt( zDat->zWert( "AdminServerPort" )->getText(), 10 ), 10 ) )
|
|
|
{
|
|
@@ -57,7 +61,7 @@ void MainServer::runn()
|
|
|
{
|
|
|
while( !end )
|
|
|
{
|
|
|
- SKlient *klient;
|
|
|
+ SSLSKlient *klient;
|
|
|
klient = aServer->getKlient();
|
|
|
if( end && klient )
|
|
|
{
|
|
@@ -205,13 +209,10 @@ MainServer *MainServer::release()
|
|
|
|
|
|
// Inhalt der MSKlient Klasse aus MainServer.h
|
|
|
// Konstruktor
|
|
|
-MSAKlient::MSAKlient( SKlient *klient, MainServer *ms )
|
|
|
+MSAKlient::MSAKlient( SSLSKlient *klient, MainServer *ms )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
- unsigned char key[ 20 ] = { 103, 112, 161, 152, 241, 81, 192, 29, 85, 160, 151, 68, 120, 164, 145, 208, 65, 241, 234, 219 };
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
name = new Text( "" );
|
|
|
passwort = new Text( "" );
|
|
|
adminId = 0;
|
|
@@ -234,7 +235,7 @@ void MSAKlient::thread()
|
|
|
while( 1 )
|
|
|
{
|
|
|
char c = 0;
|
|
|
- if( !klient->getNachrichtEncrypted( &c, 1 ) )
|
|
|
+ if( !klient->getNachricht( &c, 1 ) )
|
|
|
break;
|
|
|
else
|
|
|
{
|
|
@@ -244,23 +245,23 @@ void MSAKlient::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 = ms->zDB()->istAdministrator( n, p );
|
|
|
if( adminId )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
name->setText( n );
|
|
|
passwort->setText( p );
|
|
|
this->adminId = adminId;
|
|
@@ -275,11 +276,11 @@ void MSAKlient::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 )
|
|
@@ -291,7 +292,7 @@ void MSAKlient::thread()
|
|
|
if( !ms->serverStarten() )
|
|
|
errorZuKlient( "Beim starten des Servers ist ein Fehler aufgetreten." );
|
|
|
else
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht berechtigt den Server zu starten." );
|
|
@@ -305,7 +306,7 @@ void MSAKlient::thread()
|
|
|
if( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSBeenden ) )
|
|
|
{
|
|
|
ms->serverBeenden();
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht berechtigt den Server zu beenden." );
|
|
@@ -336,7 +337,7 @@ void MSAKlient::thread()
|
|
|
}
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "MS: Der Server wird von Benutzer " << adminId << " heruntergefahren.\n";
|
|
|
ms->close();
|
|
|
br = 1;
|
|
@@ -363,7 +364,7 @@ void MSAKlient::thread()
|
|
|
ok = 1;
|
|
|
if( ok )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
std::cout << "MS: Der Server wurde von Benutzer " << adminId << " terminiert.\n";
|
|
|
ms->close();
|
|
|
br = 1;
|
|
@@ -373,9 +374,9 @@ void MSAKlient::thread()
|
|
|
case 8: // Status Frage
|
|
|
if( 1 )
|
|
|
{
|
|
|
- klient->sendeEncrypted( "\1", 1 );
|
|
|
+ klient->sende( "\1", 1 );
|
|
|
char status = (int)ms->isRunning();
|
|
|
- klient->sendeEncrypted( &status, 1 );
|
|
|
+ klient->sende( &status, 1 );
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -395,10 +396,10 @@ void MSAKlient::thread()
|
|
|
|
|
|
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 );
|
|
|
- klient->sendeEncrypted( &len, 1 );
|
|
|
- klient->sendeEncrypted( nachricht, len );
|
|
|
+ klient->sende( &len, 1 );
|
|
|
+ klient->sende( nachricht, len );
|
|
|
}
|
|
|
|
|
|
|