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 char *unique_session_numbers;
40 int ScheduledShutdown = 0;
44 * Various things that need to be initialized at startup
46 void master_startup(void) {
47 lprintf(7, "Opening databases\n");
53 lprintf(7, "Checking floor reference counts\n");
56 lprintf(7, "Creating base rooms (if necessary)\n");
57 create_room(BASEROOM, 0, "", 0);
58 create_room(AIDEROOM, 4, "", 0);
59 create_room(config.c_twitroom, 0, "", 0);
63 * Cleanup routine to be called when the server is shutting down.
65 void master_cleanup(void) {
66 struct CleanupFunctionHook *fcn;
68 /* Cancel all running sessions */
69 lprintf(7, "Cancelling running sessions...\n");
71 /* FIX do something here
72 while (ContextList != NULL) {
76 /* Run any cleanup routines registered by loadable modules */
77 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
78 (*fcn->h_function_pointer)();
82 lprintf(7, "Closing databases\n");
85 /* Do system-dependent stuff */
86 sysdep_master_cleanup();
89 lprintf(3, "citserver: exiting.\n");
90 fflush(stdout); fflush(stderr);
96 * Free any per-session data allocated by modules or whatever
98 void deallocate_user_data(struct CitContext *con)
100 struct CtdlSessData *ptr;
102 begin_critical_section(S_SESSION_TABLE);
103 while (con->FirstSessData != NULL) {
104 lprintf(9, "Deallocating user data symbol %ld\n",
105 con->FirstSessData->sym_id);
106 if (con->FirstSessData->sym_data != NULL)
107 phree(con->FirstSessData->sym_data);
108 ptr = con->FirstSessData->next;
109 phree(con->FirstSessData);
110 con->FirstSessData = ptr;
112 end_critical_section(S_SESSION_TABLE);
119 * Terminate a session and remove its context data structure.
121 void RemoveContext (struct CitContext *con)
123 struct CitContext *ptr = NULL;
124 struct CitContext *ToFree = NULL;
126 lprintf(9, "RemoveContext() called\n");
128 lprintf(5, "WARNING: RemoveContext() called with NULL!\n");
132 /* Remove the context from the global context list. This needs
133 * to get done FIRST to avoid concurrency problems.
135 lprintf(7, "Removing context for session %d\n", con->cs_pid);
136 begin_critical_section(S_SESSION_TABLE);
137 if (ContextList == con) {
138 ToFree = ContextList;
139 ContextList = ContextList->next;
142 for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
143 if (ptr->next == con) {
145 ptr->next = ptr->next->next;
149 end_critical_section(S_SESSION_TABLE);
151 if (ToFree == NULL) {
152 lprintf(9, "RemoveContext() found nothing to remove\n");
156 /* Now handle all of the administrivia. */
157 lprintf(7, "Calling logout(%d)\n", con->cs_pid);
160 rec_log(CL_TERMINATE, con->curr_user);
162 lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
164 /* Run any cleanup routines registered by loadable modules */
165 PerformSessionHooks(EVT_STOP);
167 syslog(LOG_NOTICE,"session %d ended", con->cs_pid);
169 /* Deallocate any user-data attached to this session */
170 deallocate_user_data(con);
172 /* If the client is still connected, blow 'em away. */
173 lprintf(7, "Closing socket %d\n", con->client_socket);
174 close(con->client_socket);
176 /* Tell the housekeeping thread to check to see if this is the time
177 * to initiate a scheduled shutdown event.
179 enter_housekeeping_cmd("SCHED_SHUTDOWN");
181 /* Free up the memory used by this context */
184 lprintf(7, "Done with RemoveContext()\n");
190 * Get a dynamic symbol number for per-session user data.
191 * This API call should be made only ONCE per symbol per citserver run.
193 int CtdlGetDynamicSymbol()
195 static unsigned int next_symbol = SYM_MAX;
196 return ++next_symbol;
202 * Return a pointer to some generic per-session user data.
203 * (This function returns NULL if the requested symbol is not allocated.)
205 * NOTE: we use critical sections for allocating and de-allocating these,
206 * but not for locating one.
208 void *CtdlGetUserData(unsigned long requested_sym)
210 struct CtdlSessData *ptr;
212 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
213 if (ptr->sym_id == requested_sym)
214 return(ptr->sym_data);
216 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
223 * Allocate some generic per-session user data.
225 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
227 struct CtdlSessData *ptr;
229 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
231 /* Fail silently if the symbol is already registered. */
232 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
233 if (ptr->sym_id == requested_sym) {
238 /* Grab us some memory! Dem's good eatin' !! */
239 ptr = mallok(sizeof(struct CtdlSessData));
240 ptr->sym_id = requested_sym;
241 ptr->sym_data = mallok(num_bytes);
243 begin_critical_section(S_SESSION_TABLE);
244 ptr->next = CC->FirstSessData;
245 CC->FirstSessData = ptr;
246 end_critical_section(S_SESSION_TABLE);
248 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
257 * cmd_info() - tell the client about this server
259 void cmd_info(void) {
260 cprintf("%d Server info:\n",LISTING_FOLLOWS);
261 cprintf("%d\n",CC->cs_pid);
262 cprintf("%s\n",config.c_nodename);
263 cprintf("%s\n",config.c_humannode);
264 cprintf("%s\n",config.c_fqdn);
265 cprintf("%s\n",CITADEL);
266 cprintf("%d\n",REV_LEVEL);
267 cprintf("%s\n",config.c_bbs_city);
268 cprintf("%s\n",config.c_sysadm);
269 cprintf("%d\n",SERVER_TYPE);
270 cprintf("%s\n",config.c_moreprompt);
271 cprintf("1\n"); /* 1 = yes, this system supports floors */
272 cprintf("1\n"); /* 1 = we support the extended paging options */
276 void cmd_rchg(char *argbuf)
278 char newroomname[256];
280 extract(newroomname, argbuf, 0);
281 newroomname[ROOMNAMELEN-1] = 0;
282 if (strlen(newroomname) > 0) {
283 safestrncpy(CC->fake_roomname, newroomname,
284 sizeof(CC->fake_roomname) );
287 strcpy(CC->fake_roomname, "");
289 cprintf("%d OK\n", OK);
292 void cmd_hchg(char *argbuf)
294 char newhostname[256];
296 extract(newhostname, argbuf, 0);
297 if (strlen(newhostname) > 0) {
298 safestrncpy(CC->fake_hostname, newhostname,
299 sizeof(CC->fake_hostname) );
302 strcpy(CC->fake_hostname, "");
304 cprintf("%d OK\n", OK);
307 void cmd_uchg(char *argbuf)
310 char newusername[256];
312 extract(newusername, argbuf, 0);
314 if (CC->usersupp.axlevel < 6) {
315 cprintf("%d You must be an Aide to masquerade your name.\n",
316 ERROR+HIGHER_ACCESS_REQUIRED);
320 if (strlen(newusername) > 0) {
321 CC->cs_flags &= ~CS_STEALTH;
322 memset(CC->fake_username, 0, 32);
323 if (strncasecmp(newusername, CC->curr_user,
324 strlen(CC->curr_user)))
325 safestrncpy(CC->fake_username, newusername,
326 sizeof(CC->fake_username));
329 CC->fake_username[0] = '\0';
330 CC->cs_flags |= CS_STEALTH;
338 * returns an asterisk if there are any express messages waiting,
341 char check_express(void) {
342 if (CC->FirstExpressMessage == NULL) {
356 cprintf("%d %ld\n", OK, tv);
360 * Check whether two hostnames match.
361 * "Realname" should be an actual name of a client that is trying to connect;
362 * "testname" should be the value we are comparing it with. The idea is that we
363 * want to compare with both the abbreviated and fully-qualified versions of
364 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
366 static int hostnames_match(const char *realname, const char *testname) {
370 if (!strcasecmp(realname, testname))
373 #ifdef HAVE_NONREENTRANT_NETDB
374 begin_critical_section(S_NETDB);
377 if ((he = gethostbyname(testname)) != NULL)
378 if (!strcasecmp(realname, he->h_name))
381 #ifdef HAVE_NONREENTRANT_NETDB
382 end_critical_section(S_NETDB);
389 * check a hostname against the public_clients file
391 int is_public_client(char *where)
396 if (hostnames_match(where,"localhost")) return(1);
397 if (hostnames_match(where,config.c_fqdn)) return(1);
399 fp = fopen("public_clients","r");
400 if (fp == NULL) return(0);
402 while (fgets(buf,256,fp)!=NULL) {
403 while (isspace((buf[strlen(buf)-1])))
404 buf[strlen(buf)-1] = 0;
405 if (hostnames_match(where,buf)) {
417 * the client is identifying itself to the server
419 void cmd_iden(char *argbuf)
428 if (num_parms(argbuf)<4) {
429 cprintf("%d usage error\n",ERROR);
433 dev_code = extract_int(argbuf,0);
434 cli_code = extract_int(argbuf,1);
435 rev_level = extract_int(argbuf,2);
436 extract(desc,argbuf,3);
438 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
439 from_host[sizeof from_host - 1] = 0;
440 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
442 CC->cs_clientdev = dev_code;
443 CC->cs_clienttyp = cli_code;
444 CC->cs_clientver = rev_level;
445 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
446 CC->cs_clientname[31] = 0;
448 lprintf(9, "Looking up hostname '%s'\n", from_host);
449 if ((strlen(from_host)>0) &&
450 (is_public_client(CC->cs_host))) {
451 if (inet_aton(from_host, &addr))
452 locate_host(CC->cs_host, &addr);
454 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
459 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
465 cprintf("%d Ok\n",OK);
470 * enter or exit "stealth mode"
472 void cmd_stel(char *cmdbuf)
476 requested_mode = extract_int(cmdbuf,0);
477 if (requested_mode !=0) requested_mode = 1;
479 if (!CC->logged_in) {
480 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
484 if (CC->usersupp.axlevel < 6) {
485 cprintf("%d You must be an Aide to use stealth mode.\n",
486 ERROR+HIGHER_ACCESS_REQUIRED);
490 if (CC->cs_flags & CS_STEALTH) {
491 if (requested_mode == 0)
492 CC->cs_flags = CC->cs_flags-CS_STEALTH;
495 if (requested_mode == 1)
496 CC->cs_flags = CC->cs_flags|CS_STEALTH;
499 cprintf("%d Ok\n",OK);
506 * display system messages or help
508 void cmd_mesg(char *mname)
515 extract(buf,mname,0);
520 strcpy(dirs[0],"messages");
521 strcpy(dirs[1],"help");
522 mesg_locate(targ,buf,2,dirs);
527 if (strlen(targ)==0) {
528 cprintf("%d '%s' not found.\n",ERROR,mname);
532 mfp = fopen(targ,"r");
534 cprintf("%d Cannot open '%s': %s\n",
535 ERROR,targ,strerror(errno));
538 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
540 while (fgets(buf,255,mfp)!=NULL) {
541 buf[strlen(buf)-1] = 0;
552 * enter system messages or help
554 void cmd_emsg(char *mname)
562 if (CC->usersupp.axlevel < 6) {
563 cprintf("%d You must be an Aide to edit system messages.\n",
564 ERROR+HIGHER_ACCESS_REQUIRED);
568 extract(buf,mname,0);
569 for (a=0; a<strlen(buf); ++a) { /* security measure */
570 if (buf[a] == '/') buf[a] = '.';
575 strcpy(dirs[0],"messages");
576 strcpy(dirs[1],"help");
577 mesg_locate(targ,buf,2,dirs);
581 if (strlen(targ)==0) {
582 snprintf(targ, sizeof targ, "./help/%s", buf);
585 mfp = fopen(targ,"w");
587 cprintf("%d Cannot open '%s': %s\n",
588 ERROR,targ,strerror(errno));
591 cprintf("%d %s\n", SEND_LISTING, targ);
593 while (client_gets(buf), strcmp(buf, "000")) {
594 fprintf(mfp, "%s\n", buf);
601 /* Don't show the names of private rooms unless the viewing
602 * user also knows the rooms.
604 void GenerateRoomDisplay(char *real_room,
605 struct CitContext *viewed,
606 struct CitContext *viewer) {
608 strcpy(real_room, viewed->quickroom.QRname);
609 if (viewed->quickroom.QRflags & QR_MAILBOX) {
610 strcpy(real_room, &real_room[11]);
612 if (viewed->quickroom.QRflags & QR_PRIVATE) {
613 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
615 strcpy(real_room, "<private room>");
619 if (viewed->cs_flags & CS_CHAT) {
620 while (strlen(real_room) < 14)
621 strcat(real_room, " ");
623 strcpy(&real_room[14], "<chat>");
632 void cmd_rwho(void) {
633 struct CitContext *cptr;
637 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
638 char host[40], flags[5];
640 aide = CC->usersupp.axlevel >= 6;
641 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
643 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
648 if (cptr->cs_flags & CS_POSTING)
653 if (cptr->fake_username[0])
655 strcpy(un, cptr->fake_username);
659 strcpy(un, cptr->curr_user);
661 if (cptr->fake_hostname[0])
663 strcpy(host, cptr->fake_hostname);
667 strcpy(host, cptr->cs_host);
669 GenerateRoomDisplay(real_room, cptr, CC);
671 if (cptr->fake_roomname[0]) {
672 strcpy(room, cptr->fake_roomname);
676 strcpy(room, real_room);
679 if ((aide) && (spoofed))
682 if ((cptr->cs_flags & CS_STEALTH) && (aide))
685 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
687 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
688 cptr->cs_pid, un, room,
689 host, cptr->cs_clientname,
690 (long)(cptr->lastidle),
691 cptr->lastcmdname, flags);
693 if ((spoofed) && (aide))
695 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
696 cptr->cs_pid, cptr->curr_user,
698 cptr->cs_host, cptr->cs_clientname,
699 (long)(cptr->lastidle),
700 cptr->lastcmdname, flags);
705 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
706 * so that external paging modules such as serv_icq can add more
707 * content to the Wholist.
709 PerformSessionHooks(EVT_RWHO);
715 * Terminate another running session
717 void cmd_term(char *cmdbuf)
720 struct CitContext *ccptr;
723 if (!CC->logged_in) {
724 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
728 if (CC->usersupp.axlevel < 6) {
729 cprintf("%d You must be an Aide to terminate sessions.\n",
730 ERROR+HIGHER_ACCESS_REQUIRED);
734 session_num = extract_int(cmdbuf, 0);
735 if (session_num == CC->cs_pid) {
736 cprintf("%d You can't kill your own session.\n", ERROR);
740 lprintf(9, "Locating session to kill\n");
741 begin_critical_section(S_SESSION_TABLE);
742 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
743 if (session_num == ccptr->cs_pid) {
748 end_critical_section(S_SESSION_TABLE);
751 cprintf("%d Session terminated.\n", OK);
754 cprintf("%d No such session.\n", ERROR);
763 * get the paginator prompt
765 void cmd_more(void) {
766 cprintf("%d %s\n",OK,config.c_moreprompt);
772 void cmd_echo(char *etext)
774 cprintf("%d %s\n",OK,etext);
780 * identify as internal program
782 void cmd_ipgm(char *argbuf)
786 secret = extract_int(argbuf, 0);
787 if (secret == config.c_ipgm_secret) {
788 CC->internal_pgm = 1;
789 strcpy(CC->curr_user, "<internal program>");
790 CC->cs_flags = CC->cs_flags|CS_STEALTH;
791 cprintf("%d Authenticated as an internal program.\n",OK);
794 cprintf("%d Authentication failed.\n",ERROR);
795 lprintf(3, "Warning: ipgm authentication failed.\n");
801 * Shut down the server
803 void cmd_down(void) {
804 if (!CC->logged_in) {
805 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
809 if (CC->usersupp.axlevel < 6) {
810 cprintf("%d You must be an Aide to shut down the server.\n",
811 ERROR+HIGHER_ACCESS_REQUIRED);
815 cprintf("%d Shutting down server. Goodbye.\n", OK);
820 * Schedule or cancel a server shutdown
822 void cmd_scdn(char *argbuf)
826 if (!CC->logged_in) {
827 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
831 if (CC->usersupp.axlevel < 6) {
832 cprintf("%d You must be an Aide to schedule a shutdown.\n",
833 ERROR+HIGHER_ACCESS_REQUIRED);
837 new_state = extract_int(argbuf, 0);
838 if ((new_state == 0) || (new_state == 1)) {
839 ScheduledShutdown = new_state;
841 cprintf("%d %d\n", OK, ScheduledShutdown);
848 void begin_session(struct CitContext *con)
850 int num_sessions, len;
851 struct sockaddr_in sin;
854 * Initialize some variables specific to our context.
857 con->internal_pgm = 0;
858 con->download_fp = NULL;
859 con->upload_fp = NULL;
860 con->FirstExpressMessage = NULL;
862 time(&con->lastidle);
863 strcpy(con->lastcmdname, " ");
864 strcpy(con->cs_clientname, "(unknown)");
865 strcpy(con->curr_user,"(not logged in)");
866 strcpy(con->net_node,"");
867 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
868 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
869 con->cs_host[sizeof con->cs_host - 1] = 0;
871 if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len))
872 locate_host(con->cs_host, &sin.sin_addr);
874 con->upload_type = UPL_FILE;
876 con->FirstSessData = NULL;
878 num_sessions = session_count();
880 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
883 if (con->nologin==1) {
884 cprintf("%d %s: Too many users are already online "
886 ERROR+MAX_SESSIONS_EXCEEDED,
887 config.c_nodename, config.c_maxsessions);
890 cprintf("%d %s Citadel/UX server ready.\n",
891 OK, config.c_nodename);
894 lprintf(3, "citserver[%3d]: started.\n", con->cs_pid);
896 /* Run any session startup routines registered by loadable modules */
897 PerformSessionHooks(EVT_START);
899 rec_log(CL_CONNECT, "");
906 * This loop recognizes all server commands.
908 void do_command_loop(void) {
912 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
913 if (client_gets(cmdbuf) < 1) {
914 lprintf(3, "Client socket is broken. Ending session.\n");
918 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
921 * Let other clients see the last command we executed, and
922 * update the idle time, but not NOOP, PEXP, or GEXP.
924 if ( (strncasecmp(cmdbuf, "NOOP", 4))
925 && (strncasecmp(cmdbuf, "PEXP", 4))
926 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
927 strcpy(CC->lastcmdname, " ");
928 safestrncpy(CC->lastcmdname, cmdbuf,
929 sizeof(CC->lastcmdname) );
933 if ((strncasecmp(cmdbuf, "ENT0", 4))
934 && (strncasecmp(cmdbuf, "MESG", 4))
935 && (strncasecmp(cmdbuf, "MSGS", 4)))
937 CC->cs_flags &= ~CS_POSTING;
940 if (!strncasecmp(cmdbuf,"NOOP",4)) {
941 cprintf("%d%cok\n",OK,check_express());
944 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
945 cprintf("%d Goodbye.\n",OK);
949 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
950 if (CC->logged_in) logout(CC);
951 cprintf("%d logged out.\n",OK);
954 else if (!strncasecmp(cmdbuf,"USER",4)) {
955 cmd_user(&cmdbuf[5]);
958 else if (!strncasecmp(cmdbuf,"PASS",4)) {
959 cmd_pass(&cmdbuf[5]);
962 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
963 cmd_newu(&cmdbuf[5]);
966 else if (!strncasecmp(cmdbuf,"SETP",4)) {
967 cmd_setp(&cmdbuf[5]);
970 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
971 cmd_lrms(&cmdbuf[5]);
974 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
975 cmd_lkra(&cmdbuf[5]);
978 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
979 cmd_lkrn(&cmdbuf[5]);
982 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
983 cmd_lkro(&cmdbuf[5]);
986 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
987 cmd_lzrm(&cmdbuf[5]);
990 else if (!strncasecmp(cmdbuf,"GETU",4)) {
994 else if (!strncasecmp(cmdbuf,"SETU",4)) {
995 cmd_setu(&cmdbuf[5]);
998 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
999 cmd_goto(&cmdbuf[5]);
1002 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
1003 cmd_msgs(&cmdbuf[5]);
1006 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
1010 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
1014 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
1015 cmd_msg0(&cmdbuf[5]);
1018 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
1019 cmd_msg2(&cmdbuf[5]);
1022 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
1023 cmd_msg3(&cmdbuf[5]);
1026 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
1027 cmd_msg4(&cmdbuf[5]);
1030 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
1031 cmd_opna(&cmdbuf[5]);
1034 else if (!strncasecmp(cmdbuf,"INFO",4)) {
1038 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
1039 cmd_slrp(&cmdbuf[5]);
1042 else if (!strncasecmp(cmdbuf,"INVT",4)) {
1043 cmd_invt_kick(&cmdbuf[5],1);
1046 else if (!strncasecmp(cmdbuf,"KICK",4)) {
1047 cmd_invt_kick(&cmdbuf[5],0);
1050 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1054 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1055 cmd_setr(&cmdbuf[5]);
1058 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1062 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1063 cmd_seta(&cmdbuf[5]);
1066 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1067 cmd_ent0(&cmdbuf[5]);
1070 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1071 cmd_ent3(&cmdbuf[5]);
1074 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1078 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1079 cmd_dele(&cmdbuf[5]);
1082 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1083 cmd_kill(&cmdbuf[5]);
1086 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1087 cmd_cre8(&cmdbuf[5]);
1090 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1091 cmd_move(&cmdbuf[5]);
1094 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1098 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1099 cmd_mesg(&cmdbuf[5]);
1102 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1103 cmd_emsg(&cmdbuf[5]);
1106 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1110 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1111 cmd_vali(&cmdbuf[5]);
1114 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1115 cmd_einf(&cmdbuf[5]);
1118 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1122 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1126 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1127 cmd_delf(&cmdbuf[5]);
1130 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1131 cmd_movf(&cmdbuf[5]);
1134 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1135 cmd_netf(&cmdbuf[5]);
1138 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1142 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1143 cmd_open(&cmdbuf[5]);
1146 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1150 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1151 cmd_uopn(&cmdbuf[5]);
1154 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1155 cmd_ucls(&cmdbuf[5]);
1158 else if (!strncasecmp(cmdbuf,"READ",4)) {
1159 cmd_read(&cmdbuf[5]);
1162 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1163 cmd_writ(&cmdbuf[5]);
1166 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1167 cmd_qusr(&cmdbuf[5]);
1170 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1171 cmd_echo(&cmdbuf[5]);
1174 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1175 cmd_oimg(&cmdbuf[5]);
1178 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1182 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1183 cmd_netp(&cmdbuf[5]);
1186 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1187 cmd_ndop(&cmdbuf[5]);
1190 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1191 cmd_nuop(&cmdbuf[5]);
1194 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1198 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1199 cmd_cflr(&cmdbuf[5]);
1202 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1203 cmd_kflr(&cmdbuf[5]);
1206 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1207 cmd_eflr(&cmdbuf[5]);
1210 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1211 cmd_iden(&cmdbuf[5]);
1214 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1215 cmd_ipgm(&cmdbuf[5]);
1218 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1222 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1223 cmd_rbio(&cmdbuf[5]);
1226 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1230 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1231 cmd_stel(&cmdbuf[5]);
1234 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1235 cmd_term(&cmdbuf[5]);
1238 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1242 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1243 cmd_scdn(&cmdbuf[5]);
1246 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1247 cmd_nset(&cmdbuf[5]);
1250 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1251 cmd_uimg(&cmdbuf[5]);
1254 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1255 cmd_uchg(&cmdbuf[5]);
1258 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1262 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1263 cmd_hchg(&cmdbuf[5]);
1266 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1267 cmd_rchg(&cmdbuf[5]);
1270 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1271 cmd_agup(&cmdbuf[5]);
1274 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1275 cmd_asup(&cmdbuf[5]);
1278 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1279 cmd_gpex(&cmdbuf[5]);
1282 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1283 cmd_spex(&cmdbuf[5]);
1286 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1287 cmd_conf(&cmdbuf[5]);
1290 #ifdef DEBUG_MEMORY_LEAKS
1291 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1296 else if (!DLoader_Exec_Cmd(cmdbuf))
1298 cprintf("%d Unrecognized or unsupported command.\n",
1302 /* Run any after-each-command outines registered by modules */
1303 PerformSessionHooks(EVT_CMD);