16 #include <sys/types.h>
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
22 #include "sysdep_decls.h"
23 #include "citserver.h"
26 #include "housekeeping.h"
31 #include "locate_host.h"
34 #include "dynloader.h"
39 struct CitContext *ContextList = NULL;
40 char *unique_session_numbers;
41 int ScheduledShutdown = 0;
45 * Various things that need to be initialized at startup
47 void master_startup(void) {
48 lprintf(7, "Opening databases\n");
54 lprintf(7, "Checking floor reference counts\n");
57 lprintf(7, "Creating base rooms (if necessary)\n");
58 create_room(BASEROOM, 0, "", 0);
59 create_room(AIDEROOM, 3, "", 0);
60 create_room(SYSCONFIGROOM, 3, "", 0);
61 create_room(config.c_twitroom, 0, "", 0);
65 * Cleanup routine to be called when the server is shutting down.
67 void master_cleanup(void) {
68 struct CleanupFunctionHook *fcn;
70 /* Cancel all running sessions */
71 lprintf(7, "Cancelling running sessions...\n");
73 /* FIX do something here
74 while (ContextList != NULL) {
78 /* Run any cleanup routines registered by loadable modules */
79 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
80 (*fcn->h_function_pointer)();
84 lprintf(7, "Closing databases\n");
87 /* Do system-dependent stuff */
88 sysdep_master_cleanup();
91 lprintf(3, "citserver: exiting.\n");
92 fflush(stdout); fflush(stderr);
98 * Free any per-session data allocated by modules or whatever
100 void deallocate_user_data(struct CitContext *con)
102 struct CtdlSessData *ptr;
104 begin_critical_section(S_SESSION_TABLE);
105 while (con->FirstSessData != NULL) {
106 lprintf(9, "Deallocating user data symbol %ld\n",
107 con->FirstSessData->sym_id);
108 if (con->FirstSessData->sym_data != NULL)
109 phree(con->FirstSessData->sym_data);
110 ptr = con->FirstSessData->next;
111 phree(con->FirstSessData);
112 con->FirstSessData = ptr;
114 end_critical_section(S_SESSION_TABLE);
121 * Terminate a session and remove its context data structure.
123 void RemoveContext (struct CitContext *con)
125 struct CitContext *ptr = NULL;
126 struct CitContext *ToFree = NULL;
128 lprintf(9, "RemoveContext() called\n");
130 lprintf(5, "WARNING: RemoveContext() called with NULL!\n");
134 /* Remove the context from the global context list. This needs
135 * to get done FIRST to avoid concurrency problems. It is *vitally*
136 * important to keep num_sessions accurate!!
138 lprintf(7, "Removing context for session %d\n", con->cs_pid);
139 begin_critical_section(S_SESSION_TABLE);
140 if (ContextList == con) {
141 ToFree = ContextList;
142 ContextList = ContextList->next;
146 for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
147 if (ptr->next == con) {
149 ptr->next = ptr->next->next;
154 end_critical_section(S_SESSION_TABLE);
156 if (ToFree == NULL) {
157 lprintf(9, "RemoveContext() found nothing to remove\n");
161 /* Now handle all of the administrivia. */
162 lprintf(7, "Calling logout(%d)\n", con->cs_pid);
165 rec_log(CL_TERMINATE, con->curr_user);
167 lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
169 /* Run any cleanup routines registered by loadable modules.
170 * (Must occur *before* deallocate_user_data() because the cleanup
171 * functions might touch dynamic session data)
173 PerformSessionHooks(EVT_STOP);
175 syslog(LOG_NOTICE,"session %d ended", con->cs_pid);
177 /* Deallocate any user-data attached to this session */
178 deallocate_user_data(con);
180 /* If the client is still connected, blow 'em away. */
181 lprintf(7, "Closing socket %d\n", con->client_socket);
182 close(con->client_socket);
184 /* Tell the housekeeping thread to check to see if this is the time
185 * to initiate a scheduled shutdown event.
187 enter_housekeeping_cmd("SCHED_SHUTDOWN");
189 /* Free up the memory used by this context */
192 lprintf(7, "Done with RemoveContext()\n");
198 * Get a dynamic symbol number for per-session user data.
199 * This API call should be made only ONCE per symbol per citserver run.
201 int CtdlGetDynamicSymbol()
203 static unsigned int next_symbol = SYM_MAX;
204 return ++next_symbol;
210 * Return a pointer to some generic per-session user data.
211 * (This function returns NULL if the requested symbol is not allocated.)
213 * NOTE: we use critical sections for allocating and de-allocating these,
214 * but not for locating one.
216 void *CtdlGetUserData(unsigned long requested_sym)
218 struct CtdlSessData *ptr;
220 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
221 if (ptr->sym_id == requested_sym)
222 return(ptr->sym_data);
224 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
231 * Allocate some generic per-session user data.
233 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
235 struct CtdlSessData *ptr;
237 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
239 /* Fail silently if the symbol is already registered. */
240 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
241 if (ptr->sym_id == requested_sym) {
246 /* Grab us some memory! Dem's good eatin' !! */
247 ptr = mallok(sizeof(struct CtdlSessData));
248 ptr->sym_id = requested_sym;
249 ptr->sym_data = mallok(num_bytes);
250 memset(ptr->sym_data, 0, num_bytes);
252 begin_critical_section(S_SESSION_TABLE);
253 ptr->next = CC->FirstSessData;
254 CC->FirstSessData = ptr;
255 end_critical_section(S_SESSION_TABLE);
257 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
262 * Change the size of a buffer allocated with CtdlAllocUserData()
264 void CtdlReallocUserData(unsigned long requested_sym, size_t num_bytes)
266 struct CtdlSessData *ptr;
268 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
269 if (ptr->sym_id == requested_sym) {
270 ptr->sym_data = reallok(ptr->sym_data, num_bytes);
275 lprintf(2, "CtdlReallocUserData() ERROR: symbol %ld not found!\n",
285 * cmd_info() - tell the client about this server
287 void cmd_info(void) {
288 cprintf("%d Server info:\n",LISTING_FOLLOWS);
289 cprintf("%d\n",CC->cs_pid);
290 cprintf("%s\n",config.c_nodename);
291 cprintf("%s\n",config.c_humannode);
292 cprintf("%s\n",config.c_fqdn);
293 cprintf("%s\n",CITADEL);
294 cprintf("%d\n",REV_LEVEL);
295 cprintf("%s\n",config.c_bbs_city);
296 cprintf("%s\n",config.c_sysadm);
297 cprintf("%d\n",SERVER_TYPE);
298 cprintf("%s\n",config.c_moreprompt);
299 cprintf("1\n"); /* 1 = yes, this system supports floors */
300 cprintf("1\n"); /* 1 = we support the extended paging options */
304 void cmd_rchg(char *argbuf)
306 char newroomname[256];
308 extract(newroomname, argbuf, 0);
309 newroomname[ROOMNAMELEN-1] = 0;
310 if (strlen(newroomname) > 0) {
311 safestrncpy(CC->fake_roomname, newroomname,
312 sizeof(CC->fake_roomname) );
315 strcpy(CC->fake_roomname, "");
317 cprintf("%d OK\n", OK);
320 void cmd_hchg(char *argbuf)
322 char newhostname[256];
324 extract(newhostname, argbuf, 0);
325 if (strlen(newhostname) > 0) {
326 safestrncpy(CC->fake_hostname, newhostname,
327 sizeof(CC->fake_hostname) );
330 strcpy(CC->fake_hostname, "");
332 cprintf("%d OK\n", OK);
335 void cmd_uchg(char *argbuf)
338 char newusername[256];
340 extract(newusername, argbuf, 0);
342 if (CC->usersupp.axlevel < 6) {
343 cprintf("%d You must be an Aide to masquerade your name.\n",
344 ERROR+HIGHER_ACCESS_REQUIRED);
348 if (strlen(newusername) > 0) {
349 CC->cs_flags &= ~CS_STEALTH;
350 memset(CC->fake_username, 0, 32);
351 if (strncasecmp(newusername, CC->curr_user,
352 strlen(CC->curr_user)))
353 safestrncpy(CC->fake_username, newusername,
354 sizeof(CC->fake_username));
357 CC->fake_username[0] = '\0';
358 CC->cs_flags |= CS_STEALTH;
366 * returns an asterisk if there are any express messages waiting,
369 char check_express(void) {
370 if (CC->FirstExpressMessage == NULL) {
384 cprintf("%d %ld\n", OK, tv);
388 * Check whether two hostnames match.
389 * "Realname" should be an actual name of a client that is trying to connect;
390 * "testname" should be the value we are comparing it with. The idea is that we
391 * want to compare with both the abbreviated and fully-qualified versions of
392 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
394 static int hostnames_match(const char *realname, const char *testname) {
398 if (!strcasecmp(realname, testname))
401 #ifdef HAVE_NONREENTRANT_NETDB
402 begin_critical_section(S_NETDB);
405 if ((he = gethostbyname(testname)) != NULL)
406 if (!strcasecmp(realname, he->h_name))
409 #ifdef HAVE_NONREENTRANT_NETDB
410 end_critical_section(S_NETDB);
417 * check a hostname against the public_clients file
419 int is_public_client(char *where)
424 if (hostnames_match(where,"localhost")) return(1);
425 if (hostnames_match(where,config.c_fqdn)) return(1);
427 fp = fopen("public_clients","r");
428 if (fp == NULL) return(0);
430 while (fgets(buf,256,fp)!=NULL) {
431 while (isspace((buf[strlen(buf)-1])))
432 buf[strlen(buf)-1] = 0;
433 if (hostnames_match(where,buf)) {
445 * the client is identifying itself to the server
447 void cmd_iden(char *argbuf)
456 if (num_parms(argbuf)<4) {
457 cprintf("%d usage error\n",ERROR);
461 dev_code = extract_int(argbuf,0);
462 cli_code = extract_int(argbuf,1);
463 rev_level = extract_int(argbuf,2);
464 extract(desc,argbuf,3);
466 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
467 from_host[sizeof from_host - 1] = 0;
468 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
470 CC->cs_clientdev = dev_code;
471 CC->cs_clienttyp = cli_code;
472 CC->cs_clientver = rev_level;
473 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
474 CC->cs_clientname[31] = 0;
476 lprintf(9, "Looking up hostname '%s'\n", from_host);
477 if ((strlen(from_host)>0) &&
478 (is_public_client(CC->cs_host))) {
479 if ((addr.s_addr = inet_addr(from_host)) != INADDR_NONE)
480 locate_host(CC->cs_host, &addr);
482 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
487 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
493 cprintf("%d Ok\n",OK);
498 * enter or exit "stealth mode"
500 void cmd_stel(char *cmdbuf)
504 requested_mode = extract_int(cmdbuf,0);
505 if (requested_mode !=0) requested_mode = 1;
507 if (!CC->logged_in) {
508 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
512 if (CC->usersupp.axlevel < 6) {
513 cprintf("%d You must be an Aide to use stealth mode.\n",
514 ERROR+HIGHER_ACCESS_REQUIRED);
518 if (CC->cs_flags & CS_STEALTH) {
519 if (requested_mode == 0)
520 CC->cs_flags = CC->cs_flags-CS_STEALTH;
523 if (requested_mode == 1)
524 CC->cs_flags = CC->cs_flags|CS_STEALTH;
527 cprintf("%d Ok\n",OK);
534 * display system messages or help
536 void cmd_mesg(char *mname)
543 extract(buf,mname,0);
548 strcpy(dirs[0],"messages");
549 strcpy(dirs[1],"help");
550 mesg_locate(targ,buf,2,dirs);
555 if (strlen(targ)==0) {
556 cprintf("%d '%s' not found.\n",ERROR,mname);
560 mfp = fopen(targ,"r");
562 cprintf("%d Cannot open '%s': %s\n",
563 ERROR,targ,strerror(errno));
566 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
568 while (fgets(buf,255,mfp)!=NULL) {
569 buf[strlen(buf)-1] = 0;
580 * enter system messages or help
582 void cmd_emsg(char *mname)
590 if (CC->usersupp.axlevel < 6) {
591 cprintf("%d You must be an Aide to edit system messages.\n",
592 ERROR+HIGHER_ACCESS_REQUIRED);
596 extract(buf,mname,0);
597 for (a=0; a<strlen(buf); ++a) { /* security measure */
598 if (buf[a] == '/') buf[a] = '.';
603 strcpy(dirs[0],"messages");
604 strcpy(dirs[1],"help");
605 mesg_locate(targ,buf,2,dirs);
609 if (strlen(targ)==0) {
610 snprintf(targ, sizeof targ, "./help/%s", buf);
613 mfp = fopen(targ,"w");
615 cprintf("%d Cannot open '%s': %s\n",
616 ERROR,targ,strerror(errno));
619 cprintf("%d %s\n", SEND_LISTING, targ);
621 while (client_gets(buf), strcmp(buf, "000")) {
622 fprintf(mfp, "%s\n", buf);
629 /* Don't show the names of private rooms unless the viewing
630 * user also knows the rooms.
632 void GenerateRoomDisplay(char *real_room,
633 struct CitContext *viewed,
634 struct CitContext *viewer) {
636 strcpy(real_room, viewed->quickroom.QRname);
637 if (viewed->quickroom.QRflags & QR_MAILBOX) {
638 strcpy(real_room, &real_room[11]);
640 if (viewed->quickroom.QRflags & QR_PRIVATE) {
641 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
643 strcpy(real_room, "<private room>");
647 if (viewed->cs_flags & CS_CHAT) {
648 while (strlen(real_room) < 14)
649 strcat(real_room, " ");
651 strcpy(&real_room[14], "<chat>");
660 void cmd_rwho(void) {
661 struct CitContext *cptr;
665 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
666 char host[40], flags[5];
668 aide = CC->usersupp.axlevel >= 6;
669 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
671 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
676 if (cptr->cs_flags & CS_POSTING)
681 if (cptr->fake_username[0])
683 strcpy(un, cptr->fake_username);
687 strcpy(un, cptr->curr_user);
689 if (cptr->fake_hostname[0])
691 strcpy(host, cptr->fake_hostname);
695 strcpy(host, cptr->cs_host);
697 GenerateRoomDisplay(real_room, cptr, CC);
699 if (cptr->fake_roomname[0]) {
700 strcpy(room, cptr->fake_roomname);
704 strcpy(room, real_room);
707 if ((aide) && (spoofed))
710 if ((cptr->cs_flags & CS_STEALTH) && (aide))
713 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
715 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
716 cptr->cs_pid, un, room,
717 host, cptr->cs_clientname,
718 (long)(cptr->lastidle),
719 cptr->lastcmdname, flags);
721 if ((spoofed) && (aide))
723 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
724 cptr->cs_pid, cptr->curr_user,
726 cptr->cs_host, cptr->cs_clientname,
727 (long)(cptr->lastidle),
728 cptr->lastcmdname, flags);
733 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
734 * so that external paging modules such as serv_icq can add more
735 * content to the Wholist.
737 PerformSessionHooks(EVT_RWHO);
743 * Terminate another running session
745 void cmd_term(char *cmdbuf)
748 struct CitContext *ccptr;
751 if (!CC->logged_in) {
752 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
756 if (CC->usersupp.axlevel < 6) {
757 cprintf("%d You must be an Aide to terminate sessions.\n",
758 ERROR+HIGHER_ACCESS_REQUIRED);
762 session_num = extract_int(cmdbuf, 0);
763 if (session_num == CC->cs_pid) {
764 cprintf("%d You can't kill your own session.\n", ERROR);
768 lprintf(9, "Locating session to kill\n");
769 begin_critical_section(S_SESSION_TABLE);
770 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
771 if (session_num == ccptr->cs_pid) {
776 end_critical_section(S_SESSION_TABLE);
779 cprintf("%d Session terminated.\n", OK);
782 cprintf("%d No such session.\n", ERROR);
791 * get the paginator prompt
793 void cmd_more(void) {
794 cprintf("%d %s\n",OK,config.c_moreprompt);
800 void cmd_echo(char *etext)
802 cprintf("%d %s\n",OK,etext);
808 * identify as internal program
810 void cmd_ipgm(char *argbuf)
814 secret = extract_int(argbuf, 0);
815 if (secret == config.c_ipgm_secret) {
816 CC->internal_pgm = 1;
817 strcpy(CC->curr_user, "<internal program>");
818 CC->cs_flags = CC->cs_flags|CS_STEALTH;
819 cprintf("%d Authenticated as an internal program.\n",OK);
822 cprintf("%d Authentication failed.\n",ERROR);
823 lprintf(3, "Warning: ipgm authentication failed.\n");
829 * Shut down the server
831 void cmd_down(void) {
832 if (!CC->logged_in) {
833 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
837 if (CC->usersupp.axlevel < 6) {
838 cprintf("%d You must be an Aide to shut down the server.\n",
839 ERROR+HIGHER_ACCESS_REQUIRED);
843 cprintf("%d Shutting down server. Goodbye.\n", OK);
848 * Schedule or cancel a server shutdown
850 void cmd_scdn(char *argbuf)
854 if (!CC->logged_in) {
855 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
859 if (CC->usersupp.axlevel < 6) {
860 cprintf("%d You must be an Aide to schedule a shutdown.\n",
861 ERROR+HIGHER_ACCESS_REQUIRED);
865 new_state = extract_int(argbuf, 0);
866 if ((new_state == 0) || (new_state == 1)) {
867 ScheduledShutdown = new_state;
869 cprintf("%d %d\n", OK, ScheduledShutdown);
874 * Back-end function for starting a session
876 void begin_session(struct CitContext *con)
879 struct sockaddr_in sin;
882 * Initialize some variables specific to our context.
885 con->internal_pgm = 0;
886 con->download_fp = NULL;
887 con->upload_fp = NULL;
888 con->FirstExpressMessage = NULL;
890 time(&con->lastidle);
891 strcpy(con->lastcmdname, " ");
892 strcpy(con->cs_clientname, "(unknown)");
893 strcpy(con->curr_user, NLI);
894 strcpy(con->net_node,"");
895 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
896 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
897 con->cs_host[sizeof con->cs_host - 1] = 0;
899 if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len))
900 locate_host(con->cs_host, &sin.sin_addr);
902 con->upload_type = UPL_FILE;
904 con->FirstSessData = NULL;
907 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
910 lprintf(3, "citserver[%3d]: started.\n", con->cs_pid);
912 /* Run any session startup routines registered by loadable modules */
913 PerformSessionHooks(EVT_START);
915 rec_log(CL_CONNECT, "");
919 void citproto_begin_session() {
920 if (CC->nologin==1) {
921 cprintf("%d %s: Too many users are already online "
923 ERROR+MAX_SESSIONS_EXCEEDED,
924 config.c_nodename, config.c_maxsessions);
927 cprintf("%d %s Citadel/UX server ready.\n",
928 OK, config.c_nodename);
936 * This loop recognizes all server commands.
938 void do_command_loop(void) {
942 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
943 if (client_gets(cmdbuf) < 1) {
944 lprintf(3, "Client socket is broken. Ending session.\n");
948 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
951 * Let other clients see the last command we executed, and
952 * update the idle time, but not NOOP, PEXP, or GEXP.
954 if ( (strncasecmp(cmdbuf, "NOOP", 4))
955 && (strncasecmp(cmdbuf, "PEXP", 4))
956 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
957 strcpy(CC->lastcmdname, " ");
958 safestrncpy(CC->lastcmdname, cmdbuf,
959 sizeof(CC->lastcmdname) );
963 if ((strncasecmp(cmdbuf, "ENT0", 4))
964 && (strncasecmp(cmdbuf, "MESG", 4))
965 && (strncasecmp(cmdbuf, "MSGS", 4)))
967 CC->cs_flags &= ~CS_POSTING;
970 if (!strncasecmp(cmdbuf,"NOOP",4)) {
971 cprintf("%d%cok\n",OK,check_express());
974 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
975 cprintf("%d Goodbye.\n",OK);
979 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
980 if (CC->logged_in) logout(CC);
981 cprintf("%d logged out.\n",OK);
984 else if (!strncasecmp(cmdbuf,"USER",4)) {
985 cmd_user(&cmdbuf[5]);
988 else if (!strncasecmp(cmdbuf,"PASS",4)) {
989 cmd_pass(&cmdbuf[5]);
992 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
993 cmd_newu(&cmdbuf[5]);
996 else if (!strncasecmp(cmdbuf,"SETP",4)) {
997 cmd_setp(&cmdbuf[5]);
1000 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
1001 cmd_lrms(&cmdbuf[5]);
1004 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
1005 cmd_lkra(&cmdbuf[5]);
1008 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
1009 cmd_lkrn(&cmdbuf[5]);
1012 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
1013 cmd_lkro(&cmdbuf[5]);
1016 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
1017 cmd_lzrm(&cmdbuf[5]);
1020 else if (!strncasecmp(cmdbuf,"GETU",4)) {
1024 else if (!strncasecmp(cmdbuf,"SETU",4)) {
1025 cmd_setu(&cmdbuf[5]);
1028 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
1029 cmd_goto(&cmdbuf[5]);
1032 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
1033 cmd_msgs(&cmdbuf[5]);
1036 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
1040 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
1044 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
1045 cmd_msg0(&cmdbuf[5]);
1048 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
1049 cmd_msg2(&cmdbuf[5]);
1052 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
1053 cmd_msg3(&cmdbuf[5]);
1056 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
1057 cmd_msg4(&cmdbuf[5]);
1060 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
1061 cmd_opna(&cmdbuf[5]);
1064 else if (!strncasecmp(cmdbuf,"INFO",4)) {
1068 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
1069 cmd_slrp(&cmdbuf[5]);
1072 else if (!strncasecmp(cmdbuf,"INVT",4)) {
1073 cmd_invt_kick(&cmdbuf[5],1);
1076 else if (!strncasecmp(cmdbuf,"KICK",4)) {
1077 cmd_invt_kick(&cmdbuf[5],0);
1080 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1084 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1085 cmd_setr(&cmdbuf[5]);
1088 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1092 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1093 cmd_seta(&cmdbuf[5]);
1096 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1097 cmd_ent0(&cmdbuf[5]);
1100 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1101 cmd_ent3(&cmdbuf[5]);
1104 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1108 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1109 cmd_dele(&cmdbuf[5]);
1112 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1113 cmd_kill(&cmdbuf[5]);
1116 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1117 cmd_cre8(&cmdbuf[5]);
1120 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1121 cmd_move(&cmdbuf[5]);
1124 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1128 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1129 cmd_mesg(&cmdbuf[5]);
1132 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1133 cmd_emsg(&cmdbuf[5]);
1136 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1140 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1141 cmd_vali(&cmdbuf[5]);
1144 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1145 cmd_einf(&cmdbuf[5]);
1148 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1152 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1156 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1157 cmd_delf(&cmdbuf[5]);
1160 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1161 cmd_movf(&cmdbuf[5]);
1164 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1165 cmd_netf(&cmdbuf[5]);
1168 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1172 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1173 cmd_open(&cmdbuf[5]);
1176 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1180 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1181 cmd_uopn(&cmdbuf[5]);
1184 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1185 cmd_ucls(&cmdbuf[5]);
1188 else if (!strncasecmp(cmdbuf,"READ",4)) {
1189 cmd_read(&cmdbuf[5]);
1192 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1193 cmd_writ(&cmdbuf[5]);
1196 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1197 cmd_qusr(&cmdbuf[5]);
1200 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1201 cmd_echo(&cmdbuf[5]);
1204 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1205 cmd_oimg(&cmdbuf[5]);
1208 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1212 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1213 cmd_netp(&cmdbuf[5]);
1216 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1217 cmd_ndop(&cmdbuf[5]);
1220 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1221 cmd_nuop(&cmdbuf[5]);
1224 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1228 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1229 cmd_cflr(&cmdbuf[5]);
1232 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1233 cmd_kflr(&cmdbuf[5]);
1236 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1237 cmd_eflr(&cmdbuf[5]);
1240 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1241 cmd_iden(&cmdbuf[5]);
1244 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1245 cmd_ipgm(&cmdbuf[5]);
1248 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1252 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1253 cmd_rbio(&cmdbuf[5]);
1256 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1260 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1261 cmd_stel(&cmdbuf[5]);
1264 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1265 cmd_term(&cmdbuf[5]);
1268 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1272 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1273 cmd_scdn(&cmdbuf[5]);
1276 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1277 cmd_nset(&cmdbuf[5]);
1280 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1281 cmd_uimg(&cmdbuf[5]);
1284 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1285 cmd_uchg(&cmdbuf[5]);
1288 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1292 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1293 cmd_hchg(&cmdbuf[5]);
1296 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1297 cmd_rchg(&cmdbuf[5]);
1300 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1301 cmd_agup(&cmdbuf[5]);
1304 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1305 cmd_asup(&cmdbuf[5]);
1308 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1309 cmd_gpex(&cmdbuf[5]);
1312 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1313 cmd_spex(&cmdbuf[5]);
1316 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1317 cmd_conf(&cmdbuf[5]);
1320 #ifdef DEBUG_MEMORY_LEAKS
1321 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1326 else if (!DLoader_Exec_Cmd(cmdbuf))
1328 cprintf("%d Unrecognized or unsupported command.\n",
1332 /* Run any after-each-command outines registered by modules */
1333 PerformSessionHooks(EVT_CMD);