|
|
|
@ -25,6 +25,7 @@
|
|
|
|
|
#include <tqtimer.h>
|
|
|
|
|
|
|
|
|
|
#include <klocale.h>
|
|
|
|
|
#include <kcmdlineargs.h>
|
|
|
|
|
|
|
|
|
|
#include "auth_conn.h"
|
|
|
|
|
|
|
|
|
@ -39,8 +40,8 @@ struct exit_exception {
|
|
|
|
|
For every client that connects to the server, the server creates a new
|
|
|
|
|
instance of this class.
|
|
|
|
|
*/
|
|
|
|
|
AuthSocket::AuthSocket(int sock, TQObject *parent, const char *name) :
|
|
|
|
|
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_stationID(-1), m_bound(false), m_servActive(false), m_servState(0), m_servClientSocket(NULL), m_servClientTimeout(NULL), m_loopTimer(NULL), m_config(static_cast<AuthServer*>(parent)->m_config), m_database(NULL), m_databaseStationsCursor(NULL),
|
|
|
|
|
AuthSocket::AuthSocket(int sock, int serverID, TQObject *parent, const char *name) :
|
|
|
|
|
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_stationID(-1), m_bound(false), m_serverID(serverID), m_servActive(false), m_servState(0), m_servClientSocket(NULL), m_servClientTimeout(NULL), m_loopTimer(NULL), m_config(static_cast<AuthServer*>(parent)->m_config), m_database(NULL), m_databaseStationsCursor(NULL),
|
|
|
|
|
m_databaseServicesCursor(NULL), m_databaseServiceTypesCursor(NULL), m_databasePermissionsCursor(NULL), m_databaseActivityCursor(NULL)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -445,6 +446,7 @@ void AuthSocket::commandLoop() {
|
|
|
|
|
buffer->setValue("username", m_authenticatedUserName);
|
|
|
|
|
buffer->setValue("realmname", m_authenticatedRealmName);
|
|
|
|
|
buffer->setValue("logontime", TQDateTime::currentDateTime().toTime_t());
|
|
|
|
|
buffer->setValue("serverid", m_serverID);
|
|
|
|
|
m_databaseActivityCursor->insert();
|
|
|
|
|
|
|
|
|
|
ds << TQString("OK");
|
|
|
|
@ -578,6 +580,20 @@ AuthServer::AuthServer(TQObject* parent) :
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_serverID = 0;
|
|
|
|
|
KCmdLineArgs* const args = KCmdLineArgs::parsedArgs();
|
|
|
|
|
if ((args) && (args->count() > 0)) {
|
|
|
|
|
m_serverID = TQString(args->arg(0)).toInt();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete existing activity entries for this server ID
|
|
|
|
|
TQSqlCursor databaseActivityCursor("activity", TRUE, m_database);
|
|
|
|
|
databaseActivityCursor.select(TQString("serverid='%1'").arg(m_serverID));
|
|
|
|
|
if (databaseActivityCursor.next()) {
|
|
|
|
|
databaseActivityCursor.primeDelete();
|
|
|
|
|
databaseActivityCursor.del(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !ok() ) {
|
|
|
|
|
printf("[ERROR] Failed to bind to port 4004\n\r");
|
|
|
|
|
exit(1);
|
|
|
|
@ -675,7 +691,7 @@ void AuthServer::pingSQLServer() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AuthServer::newConnection(int socket) {
|
|
|
|
|
AuthSocket *s = new AuthSocket(socket, this);
|
|
|
|
|
AuthSocket *s = new AuthSocket(socket, m_serverID, this);
|
|
|
|
|
s->m_remoteHost = s->peerAddress().toString();
|
|
|
|
|
printf("[DEBUG] New connection from %s\n\r", s->m_remoteHost.ascii());
|
|
|
|
|
connect(s, SIGNAL(connectionClosed()), s, SLOT(deleteLater()));
|
|
|
|
|