diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-25 23:28:10 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-25 23:28:10 -0600 |
commit | aea462f777680f3dd68968a32b309aa069b75a98 (patch) | |
tree | c453a883e48e19ffc238fb46a6599c62fa3470d6 /servers/admin_user_mgmt_server_lin | |
parent | be64ff0e7e45df0fcf594951d5297e1bee95339e (diff) | |
download | ulab-aea462f777680f3dd68968a32b309aa069b75a98.tar.gz ulab-aea462f777680f3dd68968a32b309aa069b75a98.zip |
Add ability to set maximum terminal service users in group
Diffstat (limited to 'servers/admin_user_mgmt_server_lin')
-rw-r--r-- | servers/admin_user_mgmt_server_lin/src/admin_user_mgmt.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/servers/admin_user_mgmt_server_lin/src/admin_user_mgmt.cpp b/servers/admin_user_mgmt_server_lin/src/admin_user_mgmt.cpp index 687a1e5..7779bed 100644 --- a/servers/admin_user_mgmt_server_lin/src/admin_user_mgmt.cpp +++ b/servers/admin_user_mgmt_server_lin/src/admin_user_mgmt.cpp @@ -263,12 +263,32 @@ void SysCtlSocket::commandLoop() { else { agt.protocolVersion = 1; agt.groupName = databasePermissionsCursor.value("groupname").toString(); + agt.maximumActiveSessionCount = 0; } agt.allowedServerNames.append(databasePermissionsCursor.value("server").toString()); list.append(agt); } + // ...then search the session limit database for groups... + TQSqlCursor databaseLimitsCursor("groups", TRUE, m_terminals_database); + databaseLimitsCursor.select(); + while (databaseLimitsCursor.next()) { + TerminalServiceAuthGroupType agt; + TerminalServiceAuthGroupList::iterator it = list.findByName(databaseLimitsCursor.value("groupname").toString()); + if (it != list.end()) { + agt = *it; + list.remove(it); + } + else { + agt.protocolVersion = 1; + agt.groupName = databaseLimitsCursor.value("groupname").toString(); + } + agt.maximumActiveSessionCount = databaseLimitsCursor.value("sesslimit").toUInt(); + + list.append(agt); + } + // ...then search LDAP for groups that were not already in the database struct group* group; setgrent(); @@ -279,6 +299,7 @@ void SysCtlSocket::commandLoop() { if (it == list.end()) { agt.protocolVersion = 1; agt.groupName = TQString(group->gr_name); + agt.maximumActiveSessionCount = 0; list.append(agt); } } @@ -348,6 +369,7 @@ void SysCtlSocket::commandLoop() { bool success = true; TQSqlCursor databasePermissionsCursor("allowed_servers", TRUE, m_terminals_database); + TQSqlCursor databaseLimitsCursor("groups", TRUE, m_terminals_database); TerminalServiceAuthGroupList::iterator it; for (it = list.begin(); it != list.end(); ++it) { TerminalServiceAuthGroupType agt = *it; @@ -358,6 +380,11 @@ void SysCtlSocket::commandLoop() { databasePermissionsCursor.primeDelete(); databasePermissionsCursor.del(false); } + databaseLimitsCursor.select(TQString("groupname='%1'").arg(agt.groupName)); + while (databaseLimitsCursor.next()) { + databaseLimitsCursor.primeDelete(); + databaseLimitsCursor.del(false); + } // Insert all entries for this group from the information structure TQStringList::iterator it2; @@ -366,6 +393,10 @@ void SysCtlSocket::commandLoop() { buffer->setValue("groupname", agt.groupName); buffer->setValue("server", *it2); databasePermissionsCursor.insert(); + buffer = databaseLimitsCursor.primeInsert(); + buffer->setValue("groupname", agt.groupName); + buffer->setValue("sesslimit", agt.maximumActiveSessionCount); + databaseLimitsCursor.insert(); } } |