-#if 0
-/*
- * check for async io jobs that are stuck (didn't ping back for 10 mins)
- */
-void dead_io_check(void) {
- struct CitContext *nptr;
- int nContexts, i;
- char real_room[ROOMNAMELEN];
-
- /* So that we don't keep the context list locked for a long time
- * we create a copy of it first
- */
- nptr = CtdlGetContextArray(&nContexts) ;
- if (!nptr)
- {
- /* Couldn't malloc so we have to bail but stick to the protocol */
- return;
- }
-
- time_t now = time(NULL);
- time_t idle;
-
- for (i=0; i<nContexts; i++)
- {
- if ((nptr[i].state != CON_SYS) || (nptr[i].IO == NULL) || (nptr[i].lastcmd == 0))
- continue;
-
- if (nptr[i].kill_me != 0)
- continue;
- idle = now - nptr[i].lastcmd;
- if (idle < 600)
- continue;
-
- GenerateRoomDisplay(real_room, &nptr[i], CC);
-
- syslog(LOG_WARNING,
- "Found stuck event context: CC[%d] "
-
- "Username: '%s' "
- "Room: '%s' "
- "while talking to host: '%s' "
- "Status: '%s' "
- "stuck in IO State: '%s' "
-
- "idle since: %d:%d "
- "Triggering context termination now!",
-
- nptr[i].cs_pid,
-
- nptr[i].curr_user,
- real_room,
- nptr[i].cs_host,
- nptr[i].cs_clientname,
- nptr[i].lastcmdname,
-
- (int) idle / 60,
- (int) idle % 60);
-
- CtdlTerminateOtherSession(nptr[i].cs_pid);
- }
-
- /* release out copy of the context list */
- free(nptr);
-}
-#endif
-
-/*
- * Masquerade roomname
- */
-void cmd_rchg(char *argbuf)
-{
- char newroomname[ROOMNAMELEN];
-
- extract_token(newroomname, argbuf, 0, '|', sizeof newroomname);
- newroomname[ROOMNAMELEN-1] = 0;
- if (!IsEmptyStr(newroomname)) {
- safestrncpy(CC->fake_roomname, newroomname,
- sizeof(CC->fake_roomname) );
- }
- else {
- safestrncpy(CC->fake_roomname, "", sizeof CC->fake_roomname);
- }
- cprintf("%d OK\n", CIT_OK);
-}
-
-/*
- * Masquerade hostname
- */
-void cmd_hchg(char *argbuf)
-{
- char newhostname[64];
-
- extract_token(newhostname, argbuf, 0, '|', sizeof newhostname);
- if (!IsEmptyStr(newhostname)) {
- safestrncpy(CC->fake_hostname, newhostname,
- sizeof(CC->fake_hostname) );
- }
- else {
- safestrncpy(CC->fake_hostname, "", sizeof CC->fake_hostname);
- }
- cprintf("%d OK\n", CIT_OK);
-}
-
-
-/*
- * Masquerade username (aides only)
- */
-void cmd_uchg(char *argbuf)
-{
-
- char newusername[USERNAME_SIZE];
-
- extract_token(newusername, argbuf, 0, '|', sizeof newusername);
-
- if (CtdlAccessCheck(ac_aide)) return;
-
- if (!IsEmptyStr(newusername)) {
- CC->cs_flags &= ~CS_STEALTH;
- memset(CC->fake_username, 0, 32);
- if (strncasecmp(newusername, CC->curr_user,
- strlen(CC->curr_user)))
- safestrncpy(CC->fake_username, newusername,
- sizeof(CC->fake_username));
- }
- else {
- CC->fake_username[0] = '\0';
- CC->cs_flags |= CS_STEALTH;
- }
- cprintf("%d\n",CIT_OK);
-}
-
-
-