diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/auth_server_lin/src/auth_conn.cpp | 23 | ||||
-rw-r--r-- | servers/auth_server_lin/src/auth_conn.h | 1 |
2 files changed, 21 insertions, 3 deletions
diff --git a/servers/auth_server_lin/src/auth_conn.cpp b/servers/auth_server_lin/src/auth_conn.cpp index d9794ad..72e8240 100644 --- a/servers/auth_server_lin/src/auth_conn.cpp +++ b/servers/auth_server_lin/src/auth_conn.cpp @@ -50,7 +50,7 @@ struct exit_exception { */ AuthSocket::AuthSocket(int sock, int serverID, TQObject *parent, const char *name) : TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_stationID(-1), m_bound(false), m_serviceID(0), m_serverID(serverID), m_terminationStamp(0), m_servActive(false), m_servState(0), m_servClientSocket(NULL), m_servClientTimeout(NULL), m_loopTimer(NULL), m_pollTimer(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), m_databaseStatisticsCursor(NULL) + m_databaseServicesCursor(NULL), m_databaseServiceTypesCursor(NULL), m_databasePermissionsCursor(NULL), m_databaseActivityCursor(NULL), m_databaseStatisticsCursor(NULL), m_databaseStatusCursor(NULL) { // Initialize timers @@ -107,6 +107,9 @@ AuthSocket::~AuthSocket() { if (m_databaseStatisticsCursor) { delete m_databaseStatisticsCursor; } + if (m_databaseStatusCursor) { + delete m_databaseStatusCursor; + } if (m_servClientSocket) { delete m_servClientSocket; } @@ -519,8 +522,21 @@ void AuthSocket::commandLoop() { if (activeID < 0) { for (StationList::Iterator it(m_slist.begin()); it != m_slist.end(); ++it) { if ((*it).services == st.services) { - m_stationID = (*it).id; - break; + // Verify that all services provided by this candidate workspace are online before allocating the workspace to a user + bool online = true; + m_databaseServicesCursor->select(TQString("station=%1").arg((*it).id)); + while (m_databaseServicesCursor->next()) { + m_databaseStatusCursor->select(TQString("serviceid=%1").arg(m_databaseServicesCursor->value("hostname").toString())); + if (m_databaseStatusCursor->next()) { + if (m_databaseStatusCursor->value("online").toInt() == 0) { + online = false; + } + } + } + if (online) { + m_stationID = (*it).id; + break; + } } } @@ -713,6 +729,7 @@ int AuthSocket::connectToDatabase() { m_databasePermissionsCursor = new TQSqlCursor("permissions", TRUE, m_database); m_databaseActivityCursor = new TQSqlCursor("activity", TRUE, m_database); m_databaseStatisticsCursor = new TQSqlCursor("statistics", TRUE, m_database); + m_databaseStatusCursor = new TQSqlCursor("status", TRUE, m_database); return 0; } diff --git a/servers/auth_server_lin/src/auth_conn.h b/servers/auth_server_lin/src/auth_conn.h index b4f8b23..612b671 100644 --- a/servers/auth_server_lin/src/auth_conn.h +++ b/servers/auth_server_lin/src/auth_conn.h @@ -95,6 +95,7 @@ class AuthSocket : public TDEKerberosServerSocket TQSqlCursor* m_databasePermissionsCursor; TQSqlCursor* m_databaseActivityCursor; TQSqlCursor* m_databaseStatisticsCursor; + TQSqlCursor* m_databaseStatusCursor; StationList m_slist; |