int CtdlIsSingleUser(void) {
if (want_single_user) {
- /* check for only one context here */
+ // check for only one context here
if (num_sessions == 1)
return 1;
}
CitContext *ccptr;
time_t now;
int killed = 0;
- int longrunners = 0;
now = time(NULL);
begin_critical_section(S_SESSION_TABLE);
&& (CtdlGetConfigLong("c_sleeping") > 0)
&& (now - (ccptr->lastcmd) > CtdlGetConfigLong("c_sleeping"))
) {
- if (!ccptr->dont_term) {
- ccptr->kill_me = KILLME_IDLE;
- ++killed;
- }
- else {
- ++longrunners;
- }
+ ccptr->kill_me = KILLME_IDLE;
+ ++killed;
}
}
end_critical_section(S_SESSION_TABLE);
if (killed > 0) {
syslog(LOG_INFO, "context: scheduled %d idle sessions for termination", killed);
}
- if (longrunners > 0) {
- syslog(LOG_INFO, "context: did not terminate %d protected idle sessions", longrunners);
- }
}
begin_critical_section(S_SESSION_TABLE);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
- if (ccptr->client_socket != -1)
- {
+ if (ccptr->client_socket != -1) {
syslog(LOG_INFO, "context: terminate_all_sessions() is murdering %s CC[%d]", ccptr->curr_user, ccptr->cs_pid);
close(ccptr->client_socket);
ccptr->client_socket = -1;
become_session(NULL);
syslog(LOG_INFO, "context: session %d (%s) ended.", con->cs_pid, c);
- /* If using AUTHMODE_LDAP, free the DN */
+ // If using AUTHMODE_LDAP, free the DN
if (con->ldap_dn) {
free(con->ldap_dn);
con->ldap_dn = NULL;
con->ServiceName, con->cs_host, con->cs_addr, con->cs_UDSclientUID
);
- /* Run any session startup routines registered by loadable modules */
+ // Run any session startup routines registered by loadable modules
PerformSessionHooks(EVT_START);
}
}
--num_sessions;
- /* And put it on our to-be-destroyed list */
+ // And put it on our to-be-destroyed list
ptr2->next = rem;
rem = ptr2;
}
//else if (ptr2->kill_me) {
+ // 2023: this was a source of segfaults but I think we fixed it
//syslog(LOG_DEBUG, "context: session %d is timed out but non-idle", ptr->cs_pid);
//}
}
CTDL_MODULE_INIT(session) {
- if (!threading) {
- }
return "session";
}