16 #include <sys/socket.h>
17 #include <netinet/in.h>
18 #include <arpa/inet.h>
21 #include "sysdep_decls.h"
22 #include "citserver.h"
25 #include "housekeeping.h"
30 #include "locate_host.h"
33 #include "dynloader.h"
38 struct CitContext *ContextList = NULL;
39 int ScheduledShutdown = 0;
43 * Various things that need to be initialized at startup
45 void master_startup(void) {
46 lprintf(7, "Opening databases\n");
52 lprintf(7, "Checking floor reference counts\n");
55 lprintf(7, "Creating base rooms (if necessary)\n");
56 create_room(BASEROOM, 0, "", 0);
57 create_room(AIDEROOM, 4, "", 0);
58 create_room(config.c_twitroom, 0, "", 0);
62 * Cleanup routine to be called when the server is shutting down.
64 void master_cleanup(void) {
65 struct CleanupFunctionHook *fcn;
67 /* Cancel all running sessions */
68 lprintf(7, "Cancelling running sessions...\n");
69 while (ContextList != NULL) {
70 kill_session(ContextList->cs_pid);
73 /* Run any cleanup routines registered by loadable modules */
74 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
75 (*fcn->h_function_pointer)();
79 lprintf(7, "Closing databases\n");
82 /* Do system-dependent stuff */
83 sysdep_master_cleanup();
86 lprintf(3, "citserver: exiting.\n");
87 fflush(stdout); fflush(stderr);
93 * Free any per-session data allocated by modules or whatever
95 void deallocate_user_data(struct CitContext *con)
97 struct CtdlSessData *ptr;
99 begin_critical_section(S_SESSION_TABLE);
100 while (con->FirstSessData != NULL) {
101 lprintf(9, "Deallocating user data symbol %ld\n",
102 con->FirstSessData->sym_id);
103 if (con->FirstSessData->sym_data != NULL)
104 phree(con->FirstSessData->sym_data);
105 ptr = con->FirstSessData->next;
106 phree(con->FirstSessData);
107 con->FirstSessData = ptr;
109 end_critical_section(S_SESSION_TABLE);
116 * Gracefully terminate a session which is marked as CON_DYING.
118 void cleanup(struct CitContext *con)
120 struct CitContext *ptr = NULL;
121 struct CitContext *ToFree = NULL;
123 lprintf(9, "cleanup() called\n");
125 lprintf(5, "WARNING: cleanup() called with NULL!\n");
129 lprintf(7, "Calling logout(%d)\n", con->cs_pid);
132 rec_log(CL_TERMINATE, con->curr_user);
134 lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
136 /* Run any cleanup routines registered by loadable modules */
137 PerformSessionHooks(EVT_STOP);
139 syslog(LOG_NOTICE,"session %d ended", con->cs_pid);
141 /* Deallocate any user-data attached to this session */
142 deallocate_user_data(con);
144 /* And flag the context as in need of being killed.
145 * (Probably done already, but just in case)
147 con->state = CON_DYING;
151 lprintf(7, "Removing context\n");
153 begin_critical_section(S_SESSION_TABLE);
154 if (ContextList == con) {
155 ToFree = ContextList;
156 ContextList = ContextList->next;
159 for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
160 if (ptr->next == con) {
162 ptr->next = ptr->next->next;
166 end_critical_section(S_SESSION_TABLE);
168 lprintf(7, "Closing socket %d\n", ToFree->client_socket);
169 close(ToFree->client_socket);
171 /* Tell the housekeeping thread to check to see if this is the time
172 * to initiate a scheduled shutdown event.
174 enter_housekeeping_cmd("SCHED_SHUTDOWN");
176 /* Free up the memory used by this context */
179 lprintf(7, "Done with cleanup()\n");
185 * Get a dynamic symbol number for per-session user data.
186 * This API call should be made only ONCE per symbol per citserver run.
188 int CtdlGetDynamicSymbol()
190 static unsigned int next_symbol = SYM_MAX;
191 return ++next_symbol;
197 * Return a pointer to some generic per-session user data.
198 * (This function returns NULL if the requested symbol is not allocated.)
200 * NOTE: we use critical sections for allocating and de-allocating these,
201 * but not for locating one.
203 void *CtdlGetUserData(unsigned long requested_sym)
205 struct CtdlSessData *ptr;
207 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
208 if (ptr->sym_id == requested_sym)
209 return(ptr->sym_data);
211 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
218 * Allocate some generic per-session user data.
220 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
222 struct CtdlSessData *ptr;
224 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
226 /* Fail silently if the symbol is already registered. */
227 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
228 if (ptr->sym_id == requested_sym) {
233 /* Grab us some memory! Dem's good eatin' !! */
234 ptr = mallok(sizeof(struct CtdlSessData));
235 ptr->sym_id = requested_sym;
236 ptr->sym_data = mallok(num_bytes);
238 begin_critical_section(S_SESSION_TABLE);
239 ptr->next = CC->FirstSessData;
240 CC->FirstSessData = ptr;
241 end_critical_section(S_SESSION_TABLE);
243 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
252 * cmd_info() - tell the client about this server
254 void cmd_info(void) {
255 cprintf("%d Server info:\n",LISTING_FOLLOWS);
256 cprintf("%d\n",CC->cs_pid);
257 cprintf("%s\n",config.c_nodename);
258 cprintf("%s\n",config.c_humannode);
259 cprintf("%s\n",config.c_fqdn);
260 cprintf("%s\n",CITADEL);
261 cprintf("%d\n",REV_LEVEL);
262 cprintf("%s\n",config.c_bbs_city);
263 cprintf("%s\n",config.c_sysadm);
264 cprintf("%d\n",SERVER_TYPE);
265 cprintf("%s\n",config.c_moreprompt);
266 cprintf("1\n"); /* 1 = yes, this system supports floors */
267 cprintf("1\n"); /* 1 = we support the extended paging options */
271 void cmd_rchg(char *argbuf)
273 char newroomname[ROOMNAMELEN];
275 extract(newroomname, argbuf, 0);
276 newroomname[ROOMNAMELEN] = 0;
277 if (strlen(newroomname) > 0) {
278 safestrncpy(CC->fake_roomname, newroomname,
279 sizeof(CC->fake_roomname) );
280 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
283 strcpy(CC->fake_roomname, "");
285 cprintf("%d OK\n", OK);
288 void cmd_hchg(char *newhostname)
290 if ((newhostname) && (newhostname[0]))
292 memset(CC->fake_hostname, 0, 25);
293 safestrncpy(CC->fake_hostname, newhostname, sizeof(CC->fake_hostname));
296 strcpy(CC->fake_hostname, "");
297 cprintf("%d OK\n",OK);
300 void cmd_uchg(char *newusername)
302 if (CC->usersupp.axlevel < 6)
304 cprintf("%d You must be an Aide to use UCHG.\n",
305 ERROR+HIGHER_ACCESS_REQUIRED);
308 if ((newusername) && (newusername[0]))
310 CC->cs_flags &= ~CS_STEALTH;
311 memset(CC->fake_username, 0, 32);
312 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
313 safestrncpy(CC->fake_username, newusername, sizeof(CC->fake_username));
317 CC->fake_username[0] = '\0';
318 CC->cs_flags |= CS_STEALTH;
324 * returns an asterisk if there are any express messages waiting,
327 char check_express(void) {
328 if (CC->FirstExpressMessage == NULL) {
342 cprintf("%d %ld\n", OK, tv);
346 * Check whether two hostnames match.
347 * "Realname" should be an actual name of a client that is trying to connect;
348 * "testname" should be the value we are comparing it with. The idea is that we
349 * want to compare with both the abbreviated and fully-qualified versions of
350 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
352 static int hostnames_match(const char *realname, const char *testname) {
356 if (!strcasecmp(realname, testname))
359 #ifdef HAVE_NONREENTRANT_NETDB
360 begin_critical_section(S_NETDB);
363 if ((he = gethostbyname(testname)) != NULL)
364 if (!strcasecmp(realname, he->h_name))
367 #ifdef HAVE_NONREENTRANT_NETDB
368 end_critical_section(S_NETDB);
375 * check a hostname against the public_clients file
377 int is_public_client(char *where)
382 if (hostnames_match(where,"localhost")) return(1);
383 if (hostnames_match(where,config.c_fqdn)) return(1);
385 fp = fopen("public_clients","r");
386 if (fp == NULL) return(0);
388 while (fgets(buf,256,fp)!=NULL) {
389 while (isspace((buf[strlen(buf)-1])))
390 buf[strlen(buf)-1] = 0;
391 if (hostnames_match(where,buf)) {
403 * the client is identifying itself to the server
405 void cmd_iden(char *argbuf)
414 if (num_parms(argbuf)<4) {
415 cprintf("%d usage error\n",ERROR);
419 dev_code = extract_int(argbuf,0);
420 cli_code = extract_int(argbuf,1);
421 rev_level = extract_int(argbuf,2);
422 extract(desc,argbuf,3);
424 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
425 from_host[sizeof from_host - 1] = 0;
426 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
428 CC->cs_clientdev = dev_code;
429 CC->cs_clienttyp = cli_code;
430 CC->cs_clientver = rev_level;
431 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
432 CC->cs_clientname[31] = 0;
434 lprintf(9, "Looking up hostname\n");
435 if ((strlen(from_host)>0) &&
436 (is_public_client(CC->cs_host))) {
437 if (inet_aton(from_host, &addr))
438 locate_host(CC->cs_host, &addr);
440 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
445 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
451 cprintf("%d Ok\n",OK);
456 * enter or exit "stealth mode"
458 void cmd_stel(char *cmdbuf)
462 requested_mode = extract_int(cmdbuf,0);
463 if (requested_mode !=0) requested_mode = 1;
465 if (!CC->logged_in) {
466 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
470 if (CC->usersupp.axlevel < 6) {
471 cprintf("%d You must be an Aide to use stealth mode.\n",
472 ERROR+HIGHER_ACCESS_REQUIRED);
476 if (CC->cs_flags & CS_STEALTH) {
477 if (requested_mode == 0)
478 CC->cs_flags = CC->cs_flags-CS_STEALTH;
481 if (requested_mode == 1)
482 CC->cs_flags = CC->cs_flags|CS_STEALTH;
485 cprintf("%d Ok\n",OK);
492 * display system messages or help
494 void cmd_mesg(char *mname)
501 extract(buf,mname,0);
506 strcpy(dirs[0],"messages");
507 strcpy(dirs[1],"help");
508 mesg_locate(targ,buf,2,dirs);
513 if (strlen(targ)==0) {
514 cprintf("%d '%s' not found.\n",ERROR,mname);
518 mfp = fopen(targ,"r");
520 cprintf("%d Cannot open '%s': %s\n",
521 ERROR,targ,strerror(errno));
524 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
526 while (fgets(buf,255,mfp)!=NULL) {
527 buf[strlen(buf)-1] = 0;
538 * enter system messages or help
540 void cmd_emsg(char *mname)
548 if (CC->usersupp.axlevel < 6) {
549 cprintf("%d You must be an Aide to edit system messages.\n",
550 ERROR+HIGHER_ACCESS_REQUIRED);
554 extract(buf,mname,0);
555 for (a=0; a<strlen(buf); ++a) { /* security measure */
556 if (buf[a] == '/') buf[a] = '.';
561 strcpy(dirs[0],"messages");
562 strcpy(dirs[1],"help");
563 mesg_locate(targ,buf,2,dirs);
567 if (strlen(targ)==0) {
568 snprintf(targ, sizeof targ, "./help/%s", buf);
571 mfp = fopen(targ,"w");
573 cprintf("%d Cannot open '%s': %s\n",
574 ERROR,targ,strerror(errno));
577 cprintf("%d %s\n", SEND_LISTING, targ);
579 while (client_gets(buf), strcmp(buf, "000")) {
580 fprintf(mfp, "%s\n", buf);
587 /* Don't show the names of private rooms unless the viewing
588 * user also knows the rooms.
590 void GenerateRoomDisplay(char *real_room,
591 struct CitContext *viewed,
592 struct CitContext *viewer) {
594 strcpy(real_room, viewed->quickroom.QRname);
595 if (viewed->quickroom.QRflags & QR_MAILBOX) {
596 strcpy(real_room, &real_room[11]);
598 if (viewed->quickroom.QRflags & QR_PRIVATE) {
599 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
601 strcpy(real_room, "<private room>");
605 if (viewed->cs_flags & CS_CHAT) {
606 while (strlen(real_room) < 14)
607 strcat(real_room, " ");
609 strcpy(&real_room[14], "<chat>");
618 void cmd_rwho(void) {
619 struct CitContext *cptr;
623 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
624 char host[40], flags[5];
626 aide = CC->usersupp.axlevel >= 6;
627 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
629 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
634 if (cptr->cs_flags & CS_POSTING)
639 if (cptr->fake_username[0])
641 strcpy(un, cptr->fake_username);
645 strcpy(un, cptr->curr_user);
647 if (cptr->fake_hostname[0])
649 strcpy(host, cptr->fake_hostname);
653 strcpy(host, cptr->cs_host);
655 GenerateRoomDisplay(real_room, cptr, CC);
657 if (cptr->fake_roomname[0]) {
658 strcpy(room, cptr->fake_roomname);
662 strcpy(room, real_room);
665 if ((aide) && (spoofed))
668 if ((cptr->cs_flags & CS_STEALTH) && (aide))
671 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
673 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
674 cptr->cs_pid, un, room,
675 host, cptr->cs_clientname,
676 (long)(cptr->lastidle),
677 cptr->lastcmdname, flags);
679 if ((spoofed) && (aide))
681 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
682 cptr->cs_pid, cptr->curr_user,
684 cptr->cs_host, cptr->cs_clientname,
685 (long)(cptr->lastidle),
686 cptr->lastcmdname, flags);
691 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
692 * so that external paging modules such as serv_icq can add more
693 * content to the Wholist.
695 PerformSessionHooks(EVT_RWHO);
701 * Terminate another running session
703 void cmd_term(char *cmdbuf)
706 struct CitContext *ccptr;
707 int session_to_kill = 0;
709 if (!CC->logged_in) {
710 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
714 if (CC->usersupp.axlevel < 6) {
715 cprintf("%d You must be an Aide to terminate sessions.\n",
716 ERROR+HIGHER_ACCESS_REQUIRED);
720 session_num = extract_int(cmdbuf, 0);
721 if (session_num == CC->cs_pid) {
722 cprintf("%d You can't kill your own session.\n", ERROR);
726 lprintf(9, "Locating session to kill\n");
727 begin_critical_section(S_SESSION_TABLE);
728 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
729 if (session_num == ccptr->cs_pid) {
730 session_to_kill = ccptr->cs_pid;
733 end_critical_section(S_SESSION_TABLE);
734 lprintf(9, "session_to_kill == %d\n", session_to_kill);
736 if (session_to_kill > 0) {
737 lprintf(9, "calling kill_session()\n");
738 kill_session(session_to_kill);
739 cprintf("%d Session terminated.\n", OK);
742 cprintf("%d No such session.\n", ERROR);
751 * get the paginator prompt
753 void cmd_more(void) {
754 cprintf("%d %s\n",OK,config.c_moreprompt);
760 void cmd_echo(char *etext)
762 cprintf("%d %s\n",OK,etext);
768 * identify as internal program
770 void cmd_ipgm(char *argbuf)
774 secret = extract_int(argbuf, 0);
775 if (secret == config.c_ipgm_secret) {
776 CC->internal_pgm = 1;
777 strcpy(CC->curr_user, "<internal program>");
778 CC->cs_flags = CC->cs_flags|CS_STEALTH;
779 cprintf("%d Authenticated as an internal program.\n",OK);
782 cprintf("%d Authentication failed.\n",ERROR);
783 lprintf(3, "Warning: ipgm authentication failed.\n");
789 * Shut down the server
791 void cmd_down(void) {
792 if (!CC->logged_in) {
793 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
797 if (CC->usersupp.axlevel < 6) {
798 cprintf("%d You must be an Aide to shut down the server.\n",
799 ERROR+HIGHER_ACCESS_REQUIRED);
803 cprintf("%d Shutting down server. Goodbye.\n", OK);
808 * Schedule or cancel a server shutdown
810 void cmd_scdn(char *argbuf)
814 if (!CC->logged_in) {
815 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
819 if (CC->usersupp.axlevel < 6) {
820 cprintf("%d You must be an Aide to schedule a shutdown.\n",
821 ERROR+HIGHER_ACCESS_REQUIRED);
825 new_state = extract_int(argbuf, 0);
826 if ((new_state == 0) || (new_state == 1)) {
827 ScheduledShutdown = new_state;
829 cprintf("%d %d\n", OK, ScheduledShutdown);
836 void begin_session(struct CitContext *con)
838 int num_sessions, len;
839 struct sockaddr_in sin;
842 * Initialize some variables specific to our context.
845 con->internal_pgm = 0;
846 con->download_fp = NULL;
847 con->upload_fp = NULL;
848 con->cs_pid = con->client_socket; /* not necessarily portable */
849 con->FirstExpressMessage = NULL;
851 time(&con->lastidle);
852 strcpy(con->lastcmdname, " ");
853 strcpy(con->cs_clientname, "(unknown)");
854 strcpy(con->curr_user,"(not logged in)");
855 strcpy(con->net_node,"");
856 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
857 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
858 con->cs_host[sizeof con->cs_host - 1] = 0;
860 if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len))
861 locate_host(con->cs_host, &sin.sin_addr);
863 con->upload_type = UPL_FILE;
865 con->FirstSessData = NULL;
867 num_sessions = session_count();
869 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
872 if (con->nologin==1) {
873 cprintf("%d %s: Too many users are already online "
875 ERROR+MAX_SESSIONS_EXCEEDED,
876 config.c_nodename, config.c_maxsessions);
879 cprintf("%d %s Citadel/UX server ready.\n",
880 OK, config.c_nodename);
883 lprintf(3, "citserver[%3d]: started.\n", con->cs_pid);
885 /* Run any session startup routines registered by loadable modules */
886 PerformSessionHooks(EVT_START);
888 rec_log(CL_CONNECT, "");
895 * This loop recognizes all server commands.
897 void do_command_loop(void) {
901 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
902 if (client_gets(cmdbuf) < 1) {
903 lprintf(3, "Client socket is broken. Ending session.\n");
904 CC->state = CON_DYING;
907 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
910 * Let other clients see the last command we executed, and
911 * update the idle time, but not NOOP, PEXP, or GEXP.
913 if ( (strncasecmp(cmdbuf, "NOOP", 4))
914 && (strncasecmp(cmdbuf, "PEXP", 4))
915 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
916 strcpy(CC->lastcmdname, " ");
917 safestrncpy(CC->lastcmdname, cmdbuf,
918 sizeof(CC->lastcmdname) );
922 if ((strncasecmp(cmdbuf, "ENT0", 4))
923 && (strncasecmp(cmdbuf, "MESG", 4))
924 && (strncasecmp(cmdbuf, "MSGS", 4)))
926 CC->cs_flags &= ~CS_POSTING;
929 if (!strncasecmp(cmdbuf,"NOOP",4)) {
930 cprintf("%d%cok\n",OK,check_express());
933 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
934 cprintf("%d Goodbye.\n",OK);
935 CC->state = CON_DYING;
938 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
939 if (CC->logged_in) logout(CC);
940 cprintf("%d logged out.\n",OK);
943 else if (!strncasecmp(cmdbuf,"USER",4)) {
944 cmd_user(&cmdbuf[5]);
947 else if (!strncasecmp(cmdbuf,"PASS",4)) {
948 cmd_pass(&cmdbuf[5]);
951 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
952 cmd_newu(&cmdbuf[5]);
955 else if (!strncasecmp(cmdbuf,"SETP",4)) {
956 cmd_setp(&cmdbuf[5]);
959 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
960 cmd_lrms(&cmdbuf[5]);
963 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
964 cmd_lkra(&cmdbuf[5]);
967 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
968 cmd_lkrn(&cmdbuf[5]);
971 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
972 cmd_lkro(&cmdbuf[5]);
975 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
976 cmd_lzrm(&cmdbuf[5]);
979 else if (!strncasecmp(cmdbuf,"GETU",4)) {
983 else if (!strncasecmp(cmdbuf,"SETU",4)) {
984 cmd_setu(&cmdbuf[5]);
987 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
988 cmd_goto(&cmdbuf[5]);
991 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
992 cmd_msgs(&cmdbuf[5]);
995 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
999 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
1003 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
1004 cmd_msg0(&cmdbuf[5]);
1007 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
1008 cmd_msg2(&cmdbuf[5]);
1011 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
1012 cmd_msg3(&cmdbuf[5]);
1015 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
1016 cmd_msg4(&cmdbuf[5]);
1019 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
1020 cmd_opna(&cmdbuf[5]);
1023 else if (!strncasecmp(cmdbuf,"INFO",4)) {
1027 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
1028 cmd_slrp(&cmdbuf[5]);
1031 else if (!strncasecmp(cmdbuf,"INVT",4)) {
1032 cmd_invt_kick(&cmdbuf[5],1);
1035 else if (!strncasecmp(cmdbuf,"KICK",4)) {
1036 cmd_invt_kick(&cmdbuf[5],0);
1039 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1043 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1044 cmd_setr(&cmdbuf[5]);
1047 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1051 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1052 cmd_seta(&cmdbuf[5]);
1055 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1056 cmd_ent0(&cmdbuf[5]);
1059 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1060 cmd_ent3(&cmdbuf[5]);
1063 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1067 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1068 cmd_dele(&cmdbuf[5]);
1071 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1072 cmd_kill(&cmdbuf[5]);
1075 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1076 cmd_cre8(&cmdbuf[5]);
1079 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1080 cmd_move(&cmdbuf[5]);
1083 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1087 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1088 cmd_mesg(&cmdbuf[5]);
1091 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1092 cmd_emsg(&cmdbuf[5]);
1095 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1099 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1100 cmd_vali(&cmdbuf[5]);
1103 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1104 cmd_einf(&cmdbuf[5]);
1107 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1111 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1115 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1116 cmd_delf(&cmdbuf[5]);
1119 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1120 cmd_movf(&cmdbuf[5]);
1123 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1124 cmd_netf(&cmdbuf[5]);
1127 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1131 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1132 cmd_open(&cmdbuf[5]);
1135 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1139 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1140 cmd_uopn(&cmdbuf[5]);
1143 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1144 cmd_ucls(&cmdbuf[5]);
1147 else if (!strncasecmp(cmdbuf,"READ",4)) {
1148 cmd_read(&cmdbuf[5]);
1151 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1152 cmd_writ(&cmdbuf[5]);
1155 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1156 cmd_qusr(&cmdbuf[5]);
1159 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1160 cmd_echo(&cmdbuf[5]);
1163 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1164 cmd_oimg(&cmdbuf[5]);
1167 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1171 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1172 cmd_netp(&cmdbuf[5]);
1175 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1176 cmd_ndop(&cmdbuf[5]);
1179 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1180 cmd_nuop(&cmdbuf[5]);
1183 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1187 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1188 cmd_cflr(&cmdbuf[5]);
1191 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1192 cmd_kflr(&cmdbuf[5]);
1195 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1196 cmd_eflr(&cmdbuf[5]);
1199 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1200 cmd_iden(&cmdbuf[5]);
1203 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1204 cmd_ipgm(&cmdbuf[5]);
1207 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1211 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1212 cmd_rbio(&cmdbuf[5]);
1215 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1219 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1220 cmd_stel(&cmdbuf[5]);
1223 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1224 cmd_term(&cmdbuf[5]);
1227 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1231 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1232 cmd_scdn(&cmdbuf[5]);
1235 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1236 cmd_nset(&cmdbuf[5]);
1239 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1240 cmd_uimg(&cmdbuf[5]);
1243 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1244 cmd_uchg(&cmdbuf[5]);
1247 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1251 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1252 cmd_hchg(&cmdbuf[5]);
1255 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1256 cmd_rchg(&cmdbuf[5]);
1259 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1260 cmd_agup(&cmdbuf[5]);
1263 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1264 cmd_asup(&cmdbuf[5]);
1267 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1268 cmd_gpex(&cmdbuf[5]);
1271 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1272 cmd_spex(&cmdbuf[5]);
1275 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1276 cmd_conf(&cmdbuf[5]);
1279 #ifdef DEBUG_MEMORY_LEAKS
1280 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1285 else if (!DLoader_Exec_Cmd(cmdbuf))
1287 cprintf("%d Unrecognized or unsupported command.\n",
1291 /* Run any after-each-command outines registered by modules */
1292 PerformSessionHooks(EVT_CMD);