4 * Main source module for the Citadel server
20 /* #include <dlfcn.h> */
22 #include <sys/types.h>
23 #include <sys/socket.h>
25 #include <netinet/in.h>
26 #include <arpa/inet.h>
29 #include "sysdep_decls.h"
30 #include "citserver.h"
33 #include "housekeeping.h"
38 #include "locate_host.h"
41 #include "dynloader.h"
46 struct CitContext *ContextList = NULL;
47 char *unique_session_numbers;
48 int ScheduledShutdown = 0;
52 * Various things that need to be initialized at startup
54 void master_startup(void) {
57 lprintf(9, "master_startup() started\n");
58 lprintf(7, "Opening databases\n");
60 cdb_begin_transaction();
68 lprintf(7, "Creating base rooms (if necessary)\n");
69 create_room(BASEROOM, 0, "", 0);
70 create_room(AIDEROOM, 3, "", 0);
71 create_room(SYSCONFIGROOM, 3, "", 0);
72 create_room(config.c_twitroom, 0, "", 0);
74 lprintf(7, "Seeding the pseudo-random number generator...\n");
75 gettimeofday(&tv, NULL);
77 lprintf(9, "master_startup() finished\n");
83 * Cleanup routine to be called when the server is shutting down.
85 void master_cleanup(void) {
86 struct CleanupFunctionHook *fcn;
88 /* Cancel all running sessions */
89 lprintf(7, "Cancelling running sessions...\n");
91 /* FIXME do something here
92 while (ContextList != NULL) {
96 /* Run any cleanup routines registered by loadable modules */
97 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
98 (*fcn->h_function_pointer)();
101 /* Close databases */
102 lprintf(7, "Closing databases\n");
103 cdb_end_transaction();
106 /* Do system-dependent stuff */
107 sysdep_master_cleanup();
110 lprintf(3, "citserver: exiting.\n");
111 fflush(stdout); fflush(stderr);
117 * Free any per-session data allocated by modules or whatever
119 void deallocate_user_data(struct CitContext *con)
121 struct CtdlSessData *ptr;
123 begin_critical_section(S_SESSION_TABLE);
124 while (con->FirstSessData != NULL) {
125 lprintf(9, "Deallocating user data symbol %ld\n",
126 con->FirstSessData->sym_id);
127 if (con->FirstSessData->sym_data != NULL)
128 phree(con->FirstSessData->sym_data);
129 ptr = con->FirstSessData->next;
130 phree(con->FirstSessData);
131 con->FirstSessData = ptr;
133 end_critical_section(S_SESSION_TABLE);
140 * Terminate a session and remove its context data structure.
142 void RemoveContext (struct CitContext *con)
144 struct CitContext *ptr = NULL;
145 struct CitContext *ToFree = NULL;
147 lprintf(9, "RemoveContext() called\n");
149 lprintf(5, "WARNING: RemoveContext() called with NULL!\n");
153 /* Remove the context from the global context list. This needs
154 * to get done FIRST to avoid concurrency problems. It is *vitally*
155 * important to keep num_sessions accurate!!
157 lprintf(7, "Removing context for session %d\n", con->cs_pid);
158 begin_critical_section(S_SESSION_TABLE);
159 if (ContextList == con) {
160 ToFree = ContextList;
161 ContextList = ContextList->next;
165 for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
166 if (ptr->next == con) {
168 ptr->next = ptr->next->next;
173 end_critical_section(S_SESSION_TABLE);
175 if (ToFree == NULL) {
176 lprintf(9, "RemoveContext() found nothing to remove\n");
180 /* Run any cleanup routines registered by loadable modules.
181 * Note 1: This must occur *before* deallocate_user_data() because the
182 * cleanup functions might touch dynamic session data.
183 * Note 2: We have to "become_session()" because the cleanup functions
184 * might make references to "CC" assuming it's the right one.
187 PerformSessionHooks(EVT_STOP);
188 become_session(NULL);
190 /* Now handle all of the administrivia. */
191 lprintf(7, "Calling logout(%d)\n", con->cs_pid);
194 rec_log(CL_TERMINATE, con->curr_user);
196 lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
199 syslog(LOG_NOTICE,"session %d: ended", con->cs_pid);
201 /* Deallocate any user-data attached to this session */
202 deallocate_user_data(con);
204 /* If the client is still connected, blow 'em away. */
205 lprintf(7, "Closing socket %d\n", con->client_socket);
206 close(con->client_socket);
208 /* This is where we used to check for scheduled shutdowns. */
210 /* Free up the memory used by this context */
213 lprintf(7, "Done with RemoveContext()\n");
219 * Get a dynamic symbol number for per-session user data.
220 * This API call should be made only ONCE per symbol per citserver run.
222 int CtdlGetDynamicSymbol()
224 static unsigned int next_symbol = SYM_MAX;
225 return ++next_symbol;
231 * Return a pointer to some generic per-session user data.
232 * (This function returns NULL if the requested symbol is not allocated.)
234 * NOTE: we use critical sections for allocating and de-allocating these,
235 * but not for locating one.
237 void *CtdlGetUserData(unsigned long requested_sym)
239 struct CtdlSessData *ptr;
241 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
242 if (ptr->sym_id == requested_sym)
243 return(ptr->sym_data);
245 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
252 * Allocate some generic per-session user data.
254 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
256 struct CtdlSessData *ptr;
258 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
260 /* Fail silently if the symbol is already registered. */
261 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
262 if (ptr->sym_id == requested_sym) {
267 /* Grab us some memory! Dem's good eatin' !! */
268 ptr = mallok(sizeof(struct CtdlSessData));
269 ptr->sym_id = requested_sym;
270 ptr->sym_data = mallok(num_bytes);
271 memset(ptr->sym_data, 0, num_bytes);
273 begin_critical_section(S_SESSION_TABLE);
274 ptr->next = CC->FirstSessData;
275 CC->FirstSessData = ptr;
276 end_critical_section(S_SESSION_TABLE);
278 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
283 * Change the size of a buffer allocated with CtdlAllocUserData()
285 void CtdlReallocUserData(unsigned long requested_sym, size_t num_bytes)
287 struct CtdlSessData *ptr;
289 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
290 if (ptr->sym_id == requested_sym) {
291 ptr->sym_data = reallok(ptr->sym_data, num_bytes);
296 lprintf(2, "CtdlReallocUserData() ERROR: symbol %ld not found!\n",
306 * cmd_info() - tell the client about this server
308 void cmd_info(void) {
309 cprintf("%d Server info:\n", LISTING_FOLLOWS);
310 cprintf("%d\n", CC->cs_pid);
311 cprintf("%s\n", config.c_nodename);
312 cprintf("%s\n", config.c_humannode);
313 cprintf("%s\n", config.c_fqdn);
314 cprintf("%s\n", CITADEL);
315 cprintf("%d\n", REV_LEVEL);
316 cprintf("%s\n", config.c_bbs_city);
317 cprintf("%s\n", config.c_sysadm);
318 cprintf("%d\n", SERVER_TYPE);
319 cprintf("%s\n", config.c_moreprompt);
320 cprintf("1\n"); /* 1 = yes, this system supports floors */
321 cprintf("1\n"); /* 1 = we support the extended paging options */
322 cprintf("%s\n", CC->cs_nonce);
328 * returns an asterisk if there are any express messages waiting,
331 char CtdlCheckExpress(void) {
332 if (CC->FirstExpressMessage == NULL) {
346 cprintf("%d %ld\n", OK, tv);
350 * Check whether two hostnames match.
351 * "Realname" should be an actual name of a client that is trying to connect;
352 * "testname" should be the value we are comparing it with. The idea is that we
353 * want to compare with both the abbreviated and fully-qualified versions of
354 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
356 static int hostnames_match(const char *realname, const char *testname) {
360 if (!strcasecmp(realname, testname))
363 #ifdef HAVE_NONREENTRANT_NETDB
364 begin_critical_section(S_NETDB);
367 if ((he = gethostbyname(testname)) != NULL)
368 if (!strcasecmp(realname, he->h_name))
371 #ifdef HAVE_NONREENTRANT_NETDB
372 end_critical_section(S_NETDB);
379 * check a hostname against the public_clients file
381 int is_public_client(char *where)
386 lprintf(9, "Checking whether %s is a public client\n", where);
388 if (hostnames_match(where, "localhost")) return(1);
389 if (hostnames_match(where, config.c_fqdn)) return(1);
391 fp = fopen("public_clients","r");
392 if (fp == NULL) return(0);
394 while (fgets(buf,256,fp)!=NULL) {
395 while (isspace((buf[strlen(buf)-1])))
396 buf[strlen(buf)-1] = 0;
397 if (hostnames_match(where,buf)) {
409 * the client is identifying itself to the server
411 void cmd_iden(char *argbuf)
421 if (num_parms(argbuf)<4) {
422 cprintf("%d usage error\n",ERROR);
426 dev_code = extract_int(argbuf,0);
427 cli_code = extract_int(argbuf,1);
428 rev_level = extract_int(argbuf,2);
429 extract(desc,argbuf,3);
431 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
432 from_host[sizeof from_host - 1] = 0;
433 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
435 CC->cs_clientdev = dev_code;
436 CC->cs_clienttyp = cli_code;
437 CC->cs_clientver = rev_level;
438 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
439 CC->cs_clientname[31] = 0;
441 if (strlen(from_host) > 0) {
442 if (CC->is_local_socket) do_lookup = 1;
443 else if (is_public_client(CC->cs_host)) do_lookup = 1;
447 lprintf(9, "Looking up hostname '%s'\n", from_host);
448 if ((addr.s_addr = inet_addr(from_host)) != -1) {
449 locate_host(CC->cs_host, &addr);
452 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
457 lprintf(7, "client %d/%d/%01d.%02d (%s)\n",
464 syslog(LOG_NOTICE,"session %d: client %d/%d/%01d.%02d (%s) from %s\n",
472 cprintf("%d Ok\n",OK);
477 * display system messages or help
479 void cmd_mesg(char *mname)
486 extract(buf,mname,0);
491 strcpy(dirs[0],"messages");
492 strcpy(dirs[1],"help");
493 mesg_locate(targ,buf,2,dirs);
498 if (strlen(targ)==0) {
499 cprintf("%d '%s' not found.\n",ERROR,mname);
503 mfp = fopen(targ,"r");
505 cprintf("%d Cannot open '%s': %s\n",
506 ERROR,targ,strerror(errno));
509 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
511 while (fgets(buf,255,mfp)!=NULL) {
512 buf[strlen(buf)-1] = 0;
523 * enter system messages or help
525 void cmd_emsg(char *mname)
533 if (CtdlAccessCheck(ac_aide)) return;
535 extract(buf,mname,0);
536 for (a=0; a<strlen(buf); ++a) { /* security measure */
537 if (buf[a] == '/') buf[a] = '.';
542 strcpy(dirs[0],"messages");
543 strcpy(dirs[1],"help");
544 mesg_locate(targ,buf,2,dirs);
548 if (strlen(targ)==0) {
549 snprintf(targ, sizeof targ, "./help/%s", buf);
552 mfp = fopen(targ,"w");
554 cprintf("%d Cannot open '%s': %s\n",
555 ERROR,targ,strerror(errno));
558 cprintf("%d %s\n", SEND_LISTING, targ);
560 while (client_gets(buf), strcmp(buf, "000")) {
561 fprintf(mfp, "%s\n", buf);
568 /* Don't show the names of private rooms unless the viewing
569 * user also knows the rooms.
571 void GenerateRoomDisplay(char *real_room,
572 struct CitContext *viewed,
573 struct CitContext *viewer) {
575 strcpy(real_room, viewed->quickroom.QRname);
576 if (viewed->quickroom.QRflags & QR_MAILBOX) {
577 strcpy(real_room, &real_room[11]);
579 if (viewed->quickroom.QRflags & QR_PRIVATE) {
580 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
582 strcpy(real_room, "<private room>");
586 if (viewed->cs_flags & CS_CHAT) {
587 while (strlen(real_room) < 14)
588 strcat(real_room, " ");
590 strcpy(&real_room[14], "<chat>");
596 * Convenience function.
598 int CtdlAccessCheck(int required_level) {
600 if (CC->internal_pgm) return(0);
601 if (required_level >= ac_internal) {
602 cprintf("%d This is not a user-level command.\n",
603 ERROR+HIGHER_ACCESS_REQUIRED);
607 if (CC->usersupp.axlevel >= 6) return(0);
608 if (required_level >= ac_aide) {
609 cprintf("%d This command requires Aide access.\n",
610 ERROR+HIGHER_ACCESS_REQUIRED);
614 if (is_room_aide()) return(0);
615 if (required_level >= ac_room_aide) {
616 cprintf("%d This command requires Aide or Room Aide access.\n",
617 ERROR + HIGHER_ACCESS_REQUIRED);
621 if (CC->logged_in) return(0);
622 if (required_level >= ac_logged_in) {
623 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
627 /* shhh ... succeed quietly */
634 * Terminate another running session
636 void cmd_term(char *cmdbuf)
639 struct CitContext *ccptr;
642 if (CtdlAccessCheck(ac_aide)) return;
644 session_num = extract_int(cmdbuf, 0);
645 if (session_num == CC->cs_pid) {
646 cprintf("%d You can't kill your own session.\n", ERROR);
650 lprintf(9, "Locating session to kill\n");
651 begin_critical_section(S_SESSION_TABLE);
652 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
653 if (session_num == ccptr->cs_pid) {
658 end_critical_section(S_SESSION_TABLE);
661 cprintf("%d Session terminated.\n", OK);
664 cprintf("%d No such session.\n", ERROR);
673 * get the paginator prompt
675 void cmd_more(void) {
676 cprintf("%d %s\n",OK,config.c_moreprompt);
682 void cmd_echo(char *etext)
684 cprintf("%d %s\n",OK,etext);
690 * identify as internal program
692 void cmd_ipgm(char *argbuf)
696 secret = extract_int(argbuf, 0);
697 if (secret == config.c_ipgm_secret) {
698 CC->internal_pgm = 1;
699 strcpy(CC->curr_user, "<internal program>");
700 CC->cs_flags = CC->cs_flags|CS_STEALTH;
701 cprintf("%d Authenticated as an internal program.\n",OK);
704 cprintf("%d Authentication failed.\n",ERROR);
705 lprintf(3, "Warning: ipgm authentication failed.\n");
711 * Shut down the server
713 void cmd_down(void) {
715 if (CtdlAccessCheck(ac_aide)) return;
717 cprintf("%d Shutting down server. Goodbye.\n", OK);
722 * Schedule or cancel a server shutdown
724 void cmd_scdn(char *argbuf)
728 if (CtdlAccessCheck(ac_aide)) return;
730 new_state = extract_int(argbuf, 0);
731 if ((new_state == 0) || (new_state == 1)) {
732 ScheduledShutdown = new_state;
734 cprintf("%d %d\n", OK, ScheduledShutdown);
739 * Generate a "nonce" for APOP-style authentication.
741 * RFC 1725 et al specify a PID to be placed in front of the nonce.
742 * Quoth BTX: That would be stupid.
744 void generate_nonce(struct CitContext *con) {
747 memset(con->cs_nonce, NONCE_SIZE, 0);
748 gettimeofday(&tv, NULL);
749 memset(con->cs_nonce, NONCE_SIZE, 0);
750 snprintf(con->cs_nonce, NONCE_SIZE, "<%d%ld@%s>",
751 rand(), tv.tv_usec, config.c_fqdn);
758 * Back-end function for starting a session
760 void begin_session(struct CitContext *con)
763 struct sockaddr_in sin;
766 * Initialize some variables specific to our context.
769 con->internal_pgm = 0;
770 con->download_fp = NULL;
771 con->upload_fp = NULL;
772 con->FirstExpressMessage = NULL;
774 time(&con->lastidle);
775 strcpy(con->lastcmdname, " ");
776 strcpy(con->cs_clientname, "(unknown)");
777 strcpy(con->curr_user, NLI);
778 strcpy(con->net_node,"");
779 strcpy(con->fake_username, "");
780 strcpy(con->fake_postname, "");
781 strcpy(con->fake_hostname, "");
782 strcpy(con->fake_roomname, "");
784 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
785 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
786 con->cs_host[sizeof con->cs_host - 1] = 0;
788 if (!CC->is_local_socket) {
789 if (!getpeername(con->client_socket,
790 (struct sockaddr *) &sin, &len))
791 locate_host(con->cs_host, &sin.sin_addr);
794 strcpy(con->cs_host, "");
797 con->upload_type = UPL_FILE;
799 con->FirstSessData = NULL;
802 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
805 lprintf(3, "citserver[%3d]: started.\n", con->cs_pid);
807 /* Run any session startup routines registered by loadable modules */
808 PerformSessionHooks(EVT_START);
810 rec_log(CL_CONNECT, "");
814 void citproto_begin_session() {
815 if (CC->nologin==1) {
816 cprintf("%d %s: Too many users are already online "
818 ERROR+MAX_SESSIONS_EXCEEDED,
819 config.c_nodename, config.c_maxsessions);
822 cprintf("%d %s Citadel/UX server ready.\n",
823 OK, config.c_nodename);
831 * This loop recognizes all server commands.
833 void do_command_loop(void) {
837 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
838 if (client_gets(cmdbuf) < 1) {
839 lprintf(3, "Client socket is broken. Ending session.\n");
843 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
846 * Let other clients see the last command we executed, and
847 * update the idle time, but not NOOP, PEXP, or GEXP.
849 if ( (strncasecmp(cmdbuf, "NOOP", 4))
850 && (strncasecmp(cmdbuf, "PEXP", 4))
851 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
852 strcpy(CC->lastcmdname, " ");
853 safestrncpy(CC->lastcmdname, cmdbuf,
854 sizeof(CC->lastcmdname) );
858 if ((strncasecmp(cmdbuf, "ENT0", 4))
859 && (strncasecmp(cmdbuf, "MESG", 4))
860 && (strncasecmp(cmdbuf, "MSGS", 4)))
862 CC->cs_flags &= ~CS_POSTING;
865 if (!strncasecmp(cmdbuf,"NOOP",4)) {
866 cprintf("%d%cok\n",OK,CtdlCheckExpress());
869 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
870 cprintf("%d Goodbye.\n",OK);
874 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
875 if (CC->logged_in) logout(CC);
876 cprintf("%d logged out.\n",OK);
879 else if (!strncasecmp(cmdbuf,"USER",4)) {
880 cmd_user(&cmdbuf[5]);
883 else if (!strncasecmp(cmdbuf,"PASS",4)) {
884 cmd_pass(&cmdbuf[5]);
887 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
888 cmd_newu(&cmdbuf[5]);
891 else if (!strncasecmp(cmdbuf,"SETP",4)) {
892 cmd_setp(&cmdbuf[5]);
895 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
896 cmd_lrms(&cmdbuf[5]);
899 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
900 cmd_lkra(&cmdbuf[5]);
903 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
904 cmd_lkrn(&cmdbuf[5]);
907 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
908 cmd_lkro(&cmdbuf[5]);
911 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
912 cmd_lzrm(&cmdbuf[5]);
915 else if (!strncasecmp(cmdbuf,"GETU",4)) {
919 else if (!strncasecmp(cmdbuf,"SETU",4)) {
920 cmd_setu(&cmdbuf[5]);
923 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
924 cmd_goto(&cmdbuf[5]);
927 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
928 cmd_msgs(&cmdbuf[5]);
931 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
935 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
939 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
940 cmd_msg0(&cmdbuf[5]);
943 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
944 cmd_msg2(&cmdbuf[5]);
947 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
948 cmd_msg3(&cmdbuf[5]);
951 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
952 cmd_msg4(&cmdbuf[5]);
955 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
956 cmd_opna(&cmdbuf[5]);
959 else if (!strncasecmp(cmdbuf,"INFO",4)) {
963 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
964 cmd_slrp(&cmdbuf[5]);
967 else if (!strncasecmp(cmdbuf,"INVT",4)) {
968 cmd_invt_kick(&cmdbuf[5],1);
971 else if (!strncasecmp(cmdbuf,"KICK",4)) {
972 cmd_invt_kick(&cmdbuf[5],0);
975 else if (!strncasecmp(cmdbuf,"GETR",4)) {
979 else if (!strncasecmp(cmdbuf,"SETR",4)) {
980 cmd_setr(&cmdbuf[5]);
983 else if (!strncasecmp(cmdbuf,"GETA",4)) {
987 else if (!strncasecmp(cmdbuf,"SETA",4)) {
988 cmd_seta(&cmdbuf[5]);
991 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
992 cmd_ent0(&cmdbuf[5]);
995 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
996 cmd_ent3(&cmdbuf[5]);
999 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1003 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1004 cmd_dele(&cmdbuf[5]);
1007 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1008 cmd_kill(&cmdbuf[5]);
1011 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1012 cmd_cre8(&cmdbuf[5]);
1015 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1016 cmd_move(&cmdbuf[5]);
1019 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1023 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1024 cmd_mesg(&cmdbuf[5]);
1027 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1028 cmd_emsg(&cmdbuf[5]);
1031 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1035 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1036 cmd_vali(&cmdbuf[5]);
1039 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1040 cmd_einf(&cmdbuf[5]);
1043 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1047 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1051 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1052 cmd_delf(&cmdbuf[5]);
1055 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1056 cmd_movf(&cmdbuf[5]);
1059 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1060 cmd_netf(&cmdbuf[5]);
1063 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1064 cmd_open(&cmdbuf[5]);
1067 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1071 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1072 cmd_uopn(&cmdbuf[5]);
1075 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1076 cmd_ucls(&cmdbuf[5]);
1079 else if (!strncasecmp(cmdbuf,"READ",4)) {
1080 cmd_read(&cmdbuf[5]);
1083 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1084 cmd_writ(&cmdbuf[5]);
1087 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1088 cmd_qusr(&cmdbuf[5]);
1091 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1092 cmd_echo(&cmdbuf[5]);
1095 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1096 cmd_oimg(&cmdbuf[5]);
1099 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1103 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1104 cmd_netp(&cmdbuf[5]);
1107 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1108 cmd_ndop(&cmdbuf[5]);
1111 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1112 cmd_nuop(&cmdbuf[5]);
1115 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1119 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1120 cmd_cflr(&cmdbuf[5]);
1123 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1124 cmd_kflr(&cmdbuf[5]);
1127 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1128 cmd_eflr(&cmdbuf[5]);
1131 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1132 cmd_iden(&cmdbuf[5]);
1135 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1136 cmd_ipgm(&cmdbuf[5]);
1139 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1140 cmd_term(&cmdbuf[5]);
1143 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1147 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1148 cmd_scdn(&cmdbuf[5]);
1151 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1152 cmd_nset(&cmdbuf[5]);
1155 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1156 cmd_uimg(&cmdbuf[5]);
1159 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1163 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1164 cmd_agup(&cmdbuf[5]);
1167 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1168 cmd_asup(&cmdbuf[5]);
1171 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1172 cmd_gpex(&cmdbuf[5]);
1175 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1176 cmd_spex(&cmdbuf[5]);
1179 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1180 cmd_conf(&cmdbuf[5]);
1183 #ifdef DEBUG_MEMORY_LEAKS
1184 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1189 else if (!DLoader_Exec_Cmd(cmdbuf))
1191 cprintf("%d Unrecognized or unsupported command.\n",
1195 /* Run any after-each-command outines registered by modules */
1196 PerformSessionHooks(EVT_CMD);