4 * Main source module for the Citadel server
19 #if TIME_WITH_SYS_TIME
20 # include <sys/time.h>
24 # include <sys/time.h>
35 /* #include <dlfcn.h> */
37 #include <sys/types.h>
38 #include <sys/socket.h>
39 #include <netinet/in.h>
40 #include <arpa/inet.h>
43 #include "dynloader.h"
44 #include "sysdep_decls.h"
45 #include "citserver.h"
48 #include "housekeeping.h"
53 #include "locate_host.h"
64 struct CitContext *ContextList = NULL;
65 char *unique_session_numbers;
66 int ScheduledShutdown = 0;
69 /* These are commented out. Why do we need them? They're defined in time.h
70 * anyway, and declaring them again here makes FreeBSD barf on it.
71 extern long int timezone;
76 * Various things that need to be initialized at startup
78 void master_startup(void) {
81 lprintf(9, "master_startup() started\n");
82 lprintf(7, "Opening databases\n");
91 lprintf(7, "Creating base rooms (if necessary)\n");
92 create_room(BASEROOM, 0, "", 0, 1);
93 create_room(AIDEROOM, 3, "", 0, 1);
94 create_room(SYSCONFIGROOM, 3, "", 0, 1);
95 create_room(config.c_twitroom, 0, "", 0, 1);
97 lprintf(7, "Seeding the pseudo-random number generator...\n");
98 gettimeofday(&tv, NULL);
100 lprintf(9, "master_startup() finished\n");
106 * Cleanup routine to be called when the server is shutting down.
107 * WARNING: It's no longer safe to call this function to force a shutdown.
108 * Instead, set time_to_die = 1.
110 void master_cleanup(void) {
111 struct CleanupFunctionHook *fcn;
113 /* Run any cleanup routines registered by loadable modules */
114 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
115 (*fcn->h_function_pointer)();
118 /* Close databases */
119 lprintf(7, "Closing databases\n");
122 /* Do system-dependent stuff */
123 sysdep_master_cleanup();
126 lprintf(3, "citserver: exiting.\n");
127 fflush(stdout); fflush(stderr);
133 * Free any per-session data allocated by modules or whatever
135 void deallocate_user_data(struct CitContext *con)
137 struct CtdlSessData *ptr;
139 begin_critical_section(S_SESSION_TABLE);
140 while (con->FirstSessData != NULL) {
141 lprintf(9, "Deallocating user data symbol %ld\n",
142 con->FirstSessData->sym_id);
143 if (con->FirstSessData->sym_data != NULL)
144 phree(con->FirstSessData->sym_data);
145 ptr = con->FirstSessData->next;
146 phree(con->FirstSessData);
147 con->FirstSessData = ptr;
149 end_critical_section(S_SESSION_TABLE);
156 * Terminate a session and remove its context data structure.
158 void RemoveContext (struct CitContext *con)
160 struct CitContext *ptr = NULL;
161 struct CitContext *ToFree = NULL;
163 lprintf(9, "RemoveContext() called\n");
165 lprintf(5, "WARNING: RemoveContext() called with NULL!\n");
169 /* Remove the context from the global context list. This needs
170 * to get done FIRST to avoid concurrency problems. It is *vitally*
171 * important to keep num_sessions accurate!!
173 lprintf(7, "Removing context for session %d\n", con->cs_pid);
174 begin_critical_section(S_SESSION_TABLE);
175 if (ContextList == con) {
176 ToFree = ContextList;
177 ContextList = ContextList->next;
181 for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
182 if (ptr->next == con) {
184 ptr->next = ptr->next->next;
189 end_critical_section(S_SESSION_TABLE);
191 if (ToFree == NULL) {
192 lprintf(9, "RemoveContext() found nothing to remove\n");
196 /* Run any cleanup routines registered by loadable modules.
197 * Note 1: This must occur *before* deallocate_user_data() because the
198 * cleanup functions might touch dynamic session data.
199 * Note 2: We have to "become_session()" because the cleanup functions
200 * might make references to "CC" assuming it's the right one.
203 PerformSessionHooks(EVT_STOP);
204 become_session(NULL);
206 /* Now handle all of the administrivia. */
207 lprintf(7, "Calling logout(%d)\n", con->cs_pid);
210 rec_log(CL_TERMINATE, con->curr_user);
212 lprintf(3, "[%3d] Session ended.\n", con->cs_pid);
215 syslog(LOG_NOTICE,"session %d: ended", con->cs_pid);
217 /* Deallocate any user-data attached to this session */
218 deallocate_user_data(con);
220 /* If the client is still connected, blow 'em away. */
221 lprintf(7, "Closing socket %d\n", con->client_socket);
222 close(con->client_socket);
224 /* This is where we used to check for scheduled shutdowns. */
226 /* Free up the memory used by this context */
229 lprintf(7, "Done with RemoveContext()\n");
235 * Get a dynamic symbol number for per-session user data.
236 * This API call should be made only ONCE per symbol per citserver run.
238 int CtdlGetDynamicSymbol()
240 static unsigned int next_symbol = SYM_MAX;
241 return ++next_symbol;
247 * Return a pointer to some generic per-session user data.
248 * (This function returns NULL if the requested symbol is not allocated.)
250 * NOTE: we use critical sections for allocating and de-allocating these,
251 * but not for locating one.
253 void *CtdlGetUserData(unsigned long requested_sym)
255 struct CtdlSessData *ptr;
257 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
258 if (ptr->sym_id == requested_sym)
259 return(ptr->sym_data);
261 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
268 * Allocate some generic per-session user data.
270 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
272 struct CtdlSessData *ptr;
274 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
276 /* Fail silently if the symbol is already registered. */
277 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
278 if (ptr->sym_id == requested_sym) {
283 /* Grab us some memory! Dem's good eatin' !! */
284 ptr = mallok(sizeof(struct CtdlSessData));
285 ptr->sym_id = requested_sym;
286 ptr->sym_data = mallok(num_bytes);
287 memset(ptr->sym_data, 0, num_bytes);
289 begin_critical_section(S_SESSION_TABLE);
290 ptr->next = CC->FirstSessData;
291 CC->FirstSessData = ptr;
292 end_critical_section(S_SESSION_TABLE);
294 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
299 * Change the size of a buffer allocated with CtdlAllocUserData()
301 void CtdlReallocUserData(unsigned long requested_sym, size_t num_bytes)
303 struct CtdlSessData *ptr;
305 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
306 if (ptr->sym_id == requested_sym) {
307 ptr->sym_data = reallok(ptr->sym_data, num_bytes);
312 lprintf(2, "CtdlReallocUserData() ERROR: symbol %ld not found!\n",
322 * cmd_info() - tell the client about this server
324 void cmd_info(void) {
325 cprintf("%d Server info:\n", LISTING_FOLLOWS);
326 cprintf("%d\n", CC->cs_pid);
327 cprintf("%s\n", config.c_nodename);
328 cprintf("%s\n", config.c_humannode);
329 cprintf("%s\n", config.c_fqdn);
330 cprintf("%s\n", CITADEL);
331 cprintf("%d\n", REV_LEVEL);
332 cprintf("%s\n", config.c_bbs_city);
333 cprintf("%s\n", config.c_sysadm);
334 cprintf("%d\n", SERVER_TYPE);
335 cprintf("%s\n", config.c_moreprompt);
336 cprintf("1\n"); /* 1 = yes, this system supports floors */
337 cprintf("1\n"); /* 1 = we support the extended paging options */
338 cprintf("%s\n", CC->cs_nonce);
344 * returns an asterisk if there are any express messages waiting,
347 char CtdlCheckExpress(void) {
348 if (CC->FirstExpressMessage == NULL) {
363 cprintf("%d %ld|%ld|%d\n", OK, (long)tv, timezone, daylight);
367 * Check whether two hostnames match.
368 * "Realname" should be an actual name of a client that is trying to connect;
369 * "testname" should be the value we are comparing it with. The idea is that we
370 * want to compare with both the abbreviated and fully-qualified versions of
371 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
373 static int hostnames_match(const char *realname, const char *testname) {
377 if (!strcasecmp(realname, testname))
380 #ifdef HAVE_NONREENTRANT_NETDB
381 begin_critical_section(S_NETDB);
384 if ((he = gethostbyname(testname)) != NULL)
385 if (!strcasecmp(realname, he->h_name))
388 #ifdef HAVE_NONREENTRANT_NETDB
389 end_critical_section(S_NETDB);
396 * check a hostname against the public_clients file
398 int is_public_client(char *where)
403 lprintf(9, "Checking whether %s is a public client\n", where);
405 if (hostnames_match(where, "localhost")) return(1);
406 if (hostnames_match(where, config.c_fqdn)) return(1);
408 fp = fopen("public_clients","r");
409 if (fp == NULL) return(0);
411 while (fgets(buf, sizeof buf, fp)!=NULL) {
412 while (isspace((buf[strlen(buf)-1])))
413 buf[strlen(buf)-1] = 0;
414 if (hostnames_match(where,buf)) {
426 * the client is identifying itself to the server
428 void cmd_iden(char *argbuf)
438 if (num_parms(argbuf)<4) {
439 cprintf("%d usage error\n",ERROR);
443 dev_code = extract_int(argbuf,0);
444 cli_code = extract_int(argbuf,1);
445 rev_level = extract_int(argbuf,2);
446 extract(desc,argbuf,3);
448 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
449 from_host[sizeof from_host - 1] = 0;
450 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
452 CC->cs_clientdev = dev_code;
453 CC->cs_clienttyp = cli_code;
454 CC->cs_clientver = rev_level;
455 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
456 CC->cs_clientname[31] = 0;
458 if (strlen(from_host) > 0) {
459 if (CC->is_local_socket) do_lookup = 1;
460 else if (is_public_client(CC->cs_host)) do_lookup = 1;
464 lprintf(9, "Looking up hostname '%s'\n", from_host);
465 if ((addr.s_addr = inet_addr(from_host)) != -1) {
466 locate_host(CC->cs_host, sizeof CC->cs_host, &addr);
469 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
470 CC->cs_host[sizeof CC->cs_host - 1] = 0;
474 lprintf(7, "client %d/%d/%01d.%02d (%s)\n",
481 syslog(LOG_NOTICE,"session %d: client %d/%d/%01d.%02d (%s) from %s\n",
489 cprintf("%d Ok\n",OK);
494 * display system messages or help
496 void cmd_mesg(char *mname)
503 extract(buf,mname,0);
508 strcpy(dirs[0],"messages");
509 strcpy(dirs[1],"help");
510 mesg_locate(targ,sizeof targ,buf,2,(const char **)dirs);
515 if (strlen(targ)==0) {
516 cprintf("%d '%s' not found.\n",ERROR,mname);
520 mfp = fopen(targ,"r");
522 cprintf("%d Cannot open '%s': %s\n",
523 ERROR,targ,strerror(errno));
526 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
528 while (fgets(buf, (SIZ-1), mfp)!=NULL) {
529 buf[strlen(buf)-1] = 0;
540 * enter system messages or help
542 void cmd_emsg(char *mname)
550 if (CtdlAccessCheck(ac_aide)) return;
552 extract(buf,mname,0);
553 for (a=0; a<strlen(buf); ++a) { /* security measure */
554 if (buf[a] == '/') buf[a] = '.';
559 strcpy(dirs[0],"messages");
560 strcpy(dirs[1],"help");
561 mesg_locate(targ,sizeof targ,buf,2,(const char**)dirs);
565 if (strlen(targ)==0) {
566 snprintf(targ, sizeof targ, "./help/%s", buf);
569 mfp = fopen(targ,"w");
571 cprintf("%d Cannot open '%s': %s\n",
572 ERROR,targ,strerror(errno));
575 cprintf("%d %s\n", SEND_LISTING, targ);
577 while (client_gets(buf), strcmp(buf, "000")) {
578 fprintf(mfp, "%s\n", buf);
585 /* Don't show the names of private rooms unless the viewing
586 * user also knows the rooms.
588 void GenerateRoomDisplay(char *real_room,
589 struct CitContext *viewed,
590 struct CitContext *viewer) {
592 strcpy(real_room, viewed->quickroom.QRname);
593 if (viewed->quickroom.QRflags & QR_MAILBOX) {
594 strcpy(real_room, &real_room[11]);
596 if (viewed->quickroom.QRflags & QR_PRIVATE) {
597 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
599 strcpy(real_room, "<private room>");
603 if (viewed->cs_flags & CS_CHAT) {
604 while (strlen(real_room) < 14)
605 strcat(real_room, " ");
607 strcpy(&real_room[14], "<chat>");
613 * Convenience function.
615 int CtdlAccessCheck(int required_level) {
617 if (CC->internal_pgm) return(0);
618 if (required_level >= ac_internal) {
619 cprintf("%d This is not a user-level command.\n",
620 ERROR+HIGHER_ACCESS_REQUIRED);
624 if (CC->usersupp.axlevel >= 6) return(0);
625 if (required_level >= ac_aide) {
626 cprintf("%d This command requires Aide access.\n",
627 ERROR+HIGHER_ACCESS_REQUIRED);
631 if (is_room_aide()) return(0);
632 if (required_level >= ac_room_aide) {
633 cprintf("%d This command requires Aide or Room Aide access.\n",
634 ERROR + HIGHER_ACCESS_REQUIRED);
638 if (CC->logged_in) return(0);
639 if (required_level >= ac_logged_in) {
640 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
644 /* shhh ... succeed quietly */
651 * Terminate another running session
653 void cmd_term(char *cmdbuf)
656 struct CitContext *ccptr;
660 session_num = extract_int(cmdbuf, 0);
661 if (session_num == CC->cs_pid) {
662 cprintf("%d You can't kill your own session.\n", ERROR);
666 lprintf(9, "Locating session to kill\n");
667 begin_critical_section(S_SESSION_TABLE);
668 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
669 if (session_num == ccptr->cs_pid) {
671 if ((ccptr->usersupp.usernum == CC->usersupp.usernum)
672 || (CC->usersupp.axlevel >= 6)) {
681 end_critical_section(S_SESSION_TABLE);
685 cprintf("%d Session terminated.\n", OK);
688 cprintf("%d You are not allowed to do that.\n",
689 ERROR + HIGHER_ACCESS_REQUIRED);
693 cprintf("%d No such session.\n", ERROR);
702 * get the paginator prompt
704 void cmd_more(void) {
705 cprintf("%d %s\n",OK,config.c_moreprompt);
711 void cmd_echo(char *etext)
713 cprintf("%d %s\n",OK,etext);
719 * identify as internal program
721 void cmd_ipgm(char *argbuf)
725 secret = extract_int(argbuf, 0);
726 if (secret == config.c_ipgm_secret) {
727 CC->internal_pgm = 1;
728 strcpy(CC->curr_user, "<internal program>");
729 CC->cs_flags = CC->cs_flags|CS_STEALTH;
730 cprintf("%d Authenticated as an internal program.\n",OK);
733 cprintf("%d Authentication failed.\n",ERROR);
734 lprintf(3, "Warning: ipgm authentication failed.\n");
740 * Shut down the server
742 void cmd_down(void) {
744 if (CtdlAccessCheck(ac_aide)) return;
746 cprintf("%d Shutting down server. Goodbye.\n", OK);
751 * Schedule or cancel a server shutdown
753 void cmd_scdn(char *argbuf)
757 if (CtdlAccessCheck(ac_aide)) return;
759 new_state = extract_int(argbuf, 0);
760 if ((new_state == 0) || (new_state == 1)) {
761 ScheduledShutdown = new_state;
763 cprintf("%d %d\n", OK, ScheduledShutdown);
768 * Set or unset asynchronous protocol mode
770 void cmd_asyn(char *argbuf)
774 new_state = extract_int(argbuf, 0);
775 if ((new_state == 0) || (new_state == 1)) {
776 CC->is_async = new_state;
778 cprintf("%d %d\n", OK, CC->is_async);
783 * Generate a "nonce" for APOP-style authentication.
785 * RFC 1725 et al specify a PID to be placed in front of the nonce.
786 * Quoth BTX: That would be stupid.
788 void generate_nonce(struct CitContext *con) {
791 memset(con->cs_nonce, NONCE_SIZE, 0);
792 gettimeofday(&tv, NULL);
793 memset(con->cs_nonce, NONCE_SIZE, 0);
794 snprintf(con->cs_nonce, NONCE_SIZE, "<%d%ld@%s>",
795 rand(), (long)tv.tv_usec, config.c_fqdn);
802 * Back-end function for starting a session
804 void begin_session(struct CitContext *con)
807 struct sockaddr_in sin;
810 * Initialize some variables specific to our context.
813 con->internal_pgm = 0;
814 con->download_fp = NULL;
815 con->upload_fp = NULL;
816 con->FirstExpressMessage = NULL;
818 time(&con->lastidle);
819 strcpy(con->lastcmdname, " ");
820 strcpy(con->cs_clientname, "(unknown)");
821 strcpy(con->curr_user, NLI);
822 strcpy(con->net_node,"");
823 strcpy(con->fake_username, "");
824 strcpy(con->fake_postname, "");
825 strcpy(con->fake_hostname, "");
826 strcpy(con->fake_roomname, "");
828 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
829 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
830 con->cs_host[sizeof con->cs_host - 1] = 0;
832 if (!CC->is_local_socket) {
833 if (!getpeername(con->client_socket,
834 (struct sockaddr *) &sin, &len))
835 locate_host(con->cs_host, sizeof con->cs_host, &sin.sin_addr);
838 strcpy(con->cs_host, "");
841 con->upload_type = UPL_FILE;
843 con->FirstSessData = NULL;
846 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
849 lprintf(3, "Session started.\n");
851 /* Run any session startup routines registered by loadable modules */
852 PerformSessionHooks(EVT_START);
854 rec_log(CL_CONNECT, "");
858 void citproto_begin_session() {
859 if (CC->nologin==1) {
860 cprintf("%d %s: Too many users are already online "
862 ERROR+MAX_SESSIONS_EXCEEDED,
863 config.c_nodename, config.c_maxsessions);
866 cprintf("%d %s Citadel/UX server ready.\n",
867 OK, config.c_nodename);
875 * This loop recognizes all server commands.
877 void do_command_loop(void) {
881 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
882 if (client_gets(cmdbuf) < 1) {
883 lprintf(3, "Client socket is broken. Ending session.\n");
887 lprintf(5, "Citadel: %s\n", cmdbuf);
890 * Let other clients see the last command we executed, and
891 * update the idle time, but not NOOP, PEXP, or GEXP.
893 if ( (strncasecmp(cmdbuf, "NOOP", 4))
894 && (strncasecmp(cmdbuf, "PEXP", 4))
895 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
896 strcpy(CC->lastcmdname, " ");
897 safestrncpy(CC->lastcmdname, cmdbuf,
898 sizeof(CC->lastcmdname) );
902 if ((strncasecmp(cmdbuf, "ENT0", 4))
903 && (strncasecmp(cmdbuf, "MESG", 4))
904 && (strncasecmp(cmdbuf, "MSGS", 4)))
906 CC->cs_flags &= ~CS_POSTING;
909 if (!strncasecmp(cmdbuf,"NOOP",4)) {
910 cprintf("%d%cok\n",OK,CtdlCheckExpress());
913 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
914 cprintf("%d Goodbye.\n",OK);
918 else if (!strncasecmp(cmdbuf,"ASYN",4)) {
919 cmd_asyn(&cmdbuf[5]);
922 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
923 if (CC->logged_in) logout(CC);
924 cprintf("%d logged out.\n",OK);
927 else if (!strncasecmp(cmdbuf,"USER",4)) {
928 cmd_user(&cmdbuf[5]);
931 else if (!strncasecmp(cmdbuf,"PASS",4)) {
932 cmd_pass(&cmdbuf[5]);
935 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
936 cmd_newu(&cmdbuf[5]);
939 else if (!strncasecmp(cmdbuf,"CREU",4)) {
940 cmd_creu(&cmdbuf[5]);
943 else if (!strncasecmp(cmdbuf,"SETP",4)) {
944 cmd_setp(&cmdbuf[5]);
947 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
948 cmd_lrms(&cmdbuf[5]);
951 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
952 cmd_lkra(&cmdbuf[5]);
955 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
956 cmd_lkrn(&cmdbuf[5]);
959 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
960 cmd_lkro(&cmdbuf[5]);
963 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
964 cmd_lzrm(&cmdbuf[5]);
967 else if (!strncasecmp(cmdbuf,"GETU",4)) {
971 else if (!strncasecmp(cmdbuf,"SETU",4)) {
972 cmd_setu(&cmdbuf[5]);
975 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
976 cmd_goto(&cmdbuf[5]);
979 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
980 cmd_msgs(&cmdbuf[5]);
983 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
987 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
991 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
992 cmd_msg0(&cmdbuf[5]);
995 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
996 cmd_msg2(&cmdbuf[5]);
999 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
1000 cmd_msg3(&cmdbuf[5]);
1003 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
1004 cmd_msg4(&cmdbuf[5]);
1007 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
1008 cmd_opna(&cmdbuf[5]);
1011 else if (!strncasecmp(cmdbuf,"INFO",4)) {
1015 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
1016 cmd_slrp(&cmdbuf[5]);
1019 else if (!strncasecmp(cmdbuf,"INVT",4)) {
1020 cmd_invt_kick(&cmdbuf[5],1);
1023 else if (!strncasecmp(cmdbuf,"KICK",4)) {
1024 cmd_invt_kick(&cmdbuf[5],0);
1027 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1031 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1032 cmd_setr(&cmdbuf[5]);
1035 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1039 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1040 cmd_seta(&cmdbuf[5]);
1043 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1044 cmd_ent0(&cmdbuf[5]);
1047 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1051 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1052 cmd_dele(&cmdbuf[5]);
1055 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1056 cmd_kill(&cmdbuf[5]);
1059 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1060 cmd_cre8(&cmdbuf[5]);
1063 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1064 cmd_move(&cmdbuf[5]);
1067 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1071 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1072 cmd_mesg(&cmdbuf[5]);
1075 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1076 cmd_emsg(&cmdbuf[5]);
1079 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1083 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1084 cmd_vali(&cmdbuf[5]);
1087 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1088 cmd_einf(&cmdbuf[5]);
1091 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1095 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1099 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1100 cmd_delf(&cmdbuf[5]);
1103 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1104 cmd_movf(&cmdbuf[5]);
1107 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1108 cmd_netf(&cmdbuf[5]);
1111 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1112 cmd_open(&cmdbuf[5]);
1115 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1119 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1120 cmd_uopn(&cmdbuf[5]);
1123 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1124 cmd_ucls(&cmdbuf[5]);
1127 else if (!strncasecmp(cmdbuf,"READ",4)) {
1128 cmd_read(&cmdbuf[5]);
1131 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1132 cmd_writ(&cmdbuf[5]);
1135 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1136 cmd_qusr(&cmdbuf[5]);
1139 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1140 cmd_echo(&cmdbuf[5]);
1143 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1144 cmd_oimg(&cmdbuf[5]);
1147 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1151 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1152 cmd_ndop(&cmdbuf[5]);
1155 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1156 cmd_nuop(&cmdbuf[5]);
1159 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1163 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1164 cmd_cflr(&cmdbuf[5]);
1167 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1168 cmd_kflr(&cmdbuf[5]);
1171 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1172 cmd_eflr(&cmdbuf[5]);
1175 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1176 cmd_iden(&cmdbuf[5]);
1179 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1180 cmd_ipgm(&cmdbuf[5]);
1183 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1184 cmd_term(&cmdbuf[5]);
1187 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1191 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1192 cmd_scdn(&cmdbuf[5]);
1195 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1196 cmd_uimg(&cmdbuf[5]);
1199 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1203 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1204 cmd_agup(&cmdbuf[5]);
1207 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1208 cmd_asup(&cmdbuf[5]);
1211 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1212 cmd_gpex(&cmdbuf[5]);
1215 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1216 cmd_spex(&cmdbuf[5]);
1219 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1220 cmd_conf(&cmdbuf[5]);
1223 else if (!strncasecmp(cmdbuf, "SEEN", 4)) {
1224 cmd_seen(&cmdbuf[5]);
1227 #ifdef DEBUG_MEMORY_LEAKS
1228 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1233 else if (!DLoader_Exec_Cmd(cmdbuf))
1235 cprintf("%d Unrecognized or unsupported command.\n",
1239 /* Run any after-each-command outines registered by modules */
1240 PerformSessionHooks(EVT_CMD);