summaryrefslogtreecommitdiffstats
path: root/servers/auth_server_lin/src/auth_conn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/auth_server_lin/src/auth_conn.cpp')
-rw-r--r--servers/auth_server_lin/src/auth_conn.cpp46
1 files changed, 25 insertions, 21 deletions
diff --git a/servers/auth_server_lin/src/auth_conn.cpp b/servers/auth_server_lin/src/auth_conn.cpp
index 0f0912b..a8f7459 100644
--- a/servers/auth_server_lin/src/auth_conn.cpp
+++ b/servers/auth_server_lin/src/auth_conn.cpp
@@ -28,11 +28,6 @@
#include "auth_conn.h"
-#define ABORT_SOCKET(s) s->close(); \
- s->disconnect(); \
- delete s; \
- s = NULL;
-
/* exception handling */
struct exit_exception {
int c;
@@ -49,6 +44,10 @@ AuthSocket::AuthSocket(int sock, TQObject *parent, const char *name) :
m_databaseServicesCursor(NULL), m_databaseServiceTypesCursor(NULL), m_databasePermissionsCursor(NULL), m_databaseActivityCursor(NULL)
{
+ // Initialize timers
+ m_kerberosInitTimer = new TQTimer();
+ connect(m_kerberosInitTimer, SIGNAL(timeout()), this, SLOT(finishKerberosHandshake()));
+
setServiceName("remotefpga");
line = 0;
@@ -61,6 +60,11 @@ AuthSocket::AuthSocket(int sock, TQObject *parent, const char *name) :
}
AuthSocket::~AuthSocket() {
+ if (m_kerberosInitTimer) {
+ m_kerberosInitTimer->stop();
+ delete m_kerberosInitTimer;
+ m_kerberosInitTimer = NULL;
+ }
if (m_loopTimer) {
m_loopTimer->stop();
delete m_loopTimer;
@@ -110,11 +114,15 @@ void AuthSocket::connectionClosedHandler() {
}
}
-int AuthSocket::initiateKerberosHandshake() {
+void AuthSocket::initiateKerberosHandshake() {
setUsingKerberos(true);
- while (kerberosStatus() == TDEKerberosServerSocket::KerberosInitializing) {
- // RAJA FIXME
- tqApp->processEvents();
+ m_kerberosInitTimer->start(100, TRUE);
+}
+
+void AuthSocket::finishKerberosHandshake() {
+ if (kerberosStatus() == TDEKerberosServerSocket::KerberosInitializing) {
+ m_kerberosInitTimer->start(100, TRUE);
+ return;
}
if (kerberosStatus() == TDEKerberosServerSocket::KerberosInUse) {
TQ_UINT32 magicnum = MAGIC_NUMBER;
@@ -124,10 +132,13 @@ int AuthSocket::initiateKerberosHandshake() {
ds << magicnum;
ds << protover;
- return 0;
+ enterCommandLoop();
+ return;
}
else {
- return -1;
+ printf("[DEBUG] Connection from %s closed due to Kerberos failure\n\r", m_remoteHost.ascii()); fflush(stdout);
+ close();
+ return;
}
}
@@ -609,14 +620,7 @@ void AuthServer::newConnection(int socket) {
AuthSocket *s = new AuthSocket(socket, this);
s->m_remoteHost = s->peerAddress().toString();
printf("[DEBUG] New connection from %s\n\r", s->m_remoteHost.ascii());
- if (s->initiateKerberosHandshake() != 0) {
- printf("[DEBUG] Connection from %s closed due to Kerberos failure\n\r", s->m_remoteHost.ascii()); fflush(stdout);
- ABORT_SOCKET(s)
- return;
- }
- else {
- connect(s, SIGNAL(connectionClosed()), s, SLOT(deleteLater()));
- emit newConnect(s);
- s->enterCommandLoop();
- }
+ connect(s, SIGNAL(connectionClosed()), s, SLOT(deleteLater()));
+ s->initiateKerberosHandshake();
+ emit newConnect(s);
}