From c888142a7c3c0647d134090b33d8b078b94fb894 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 1 Dec 1998 01:13:59 +0000 Subject: [PATCH] * sendcommand.c: added (also updated utils.txt, weekly, Makefile.in) --- citadel/ChangeLog | 2 +- citadel/Makefile.in | 8 ++++---- citadel/TODO | 1 - citadel/sendcommand.c | 13 +++++++++++++ citadel/utils.txt | 29 +++++++++++++++++++++++------ 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 725d6b6ae..af6cfb153 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,6 +1,6 @@ Mon Nov 30 19:48:52 EST 1998 Art Cancro * room_ops.c: added sort_msglist() to move and save operations - * sendcommand.c: added + * sendcommand.c: added (also updated utils.txt, weekly, Makefile.in) Sun Nov 29 23:57:39 EST 1998 Art Cancro * Fixed cmd_regi() to not display a second result code after xfer diff --git a/citadel/Makefile.in b/citadel/Makefile.in index de0d3236e..94e66b5a2 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -153,10 +153,9 @@ proxy: proxy.o ipc_c_tcp.o whobbs: whobbs.o ipc_c_tcp.o tools.o $(SNPRINTF) $(CC) whobbs.o ipc_c_tcp.o tools.o $(SNPRINTF) $(LDFLAGS) -o whobbs -sendcommand: sendcommand.o ipc_c_tcp.o tools.o $(SNPRINTF) - $(CC) sendcommand.o ipc_c_tcp.o tools.o $(SNPRINTF) $(LDFLAGS) \ - -o sendcommand - chmod 700 sendcommand +sendcommand: sendcommand.o ipc_c_tcp.o tools.o config.o $(SNPRINTF) + $(CC) sendcommand.o ipc_c_tcp.o tools.o config.o \ + $(SNPRINTF) $(LDFLAGS) -o sendcommand userlist: userlist.o ipc_c_tcp.o tools.o $(SNPRINTF) $(CC) userlist.o ipc_c_tcp.o tools.o \ @@ -192,6 +191,7 @@ install-data: `find help messages network -type f | grep -v CVS`; do \ $(INSTALL_DATA) $$i $(prefix)/$$i; \ done + chmod 700 $(prefix)/sendcommand install-doc: ./mkinstalldirs $(prefix)/techdoc diff --git a/citadel/TODO b/citadel/TODO index de10d9f74..6b1bcb1f9 100644 --- a/citadel/TODO +++ b/citadel/TODO @@ -1,6 +1,5 @@ Citadel/UX v5.50 showstoppers list ---------------------------------- -* Figure out a way to auto-launch expire functions (and other functions) Other things that might be nice to take care of: ------------------------------------------------ diff --git a/citadel/sendcommand.c b/citadel/sendcommand.c index 6658bc7a5..0f7995e33 100644 --- a/citadel/sendcommand.c +++ b/citadel/sendcommand.c @@ -129,6 +129,7 @@ int main(int argc, char **argv) home_specified = 1; } else { + if (strlen(cmd)>0) strcat(cmd, " "); strcat(cmd, argv[a]); } } @@ -150,6 +151,18 @@ int main(int argc, char **argv) serv_gets(buf); fprintf(stderr, "%s\n", buf); + if (buf[0]=='1') { + while (serv_gets(buf), strcmp(buf, "000")) { + printf("%s\n", buf); + } + } + else if (buf[0]=='4') { + do { + if (fgets(buf, 255, stdin)==NULL) strcpy(buf, "000"); + if (strcmp(buf, "000")) serv_puts(buf); + } while (strcmp(buf, "000")); + } + fprintf(stderr, "sendcommand: processing ended.\n"); cleanup(0); return 0; diff --git a/citadel/utils.txt b/citadel/utils.txt index a407c51ef..0fa8b7dd9 100644 --- a/citadel/utils.txt +++ b/citadel/utils.txt @@ -5,12 +5,13 @@ OVERVIEW The following utilities will be discussed in this document: - aidepost Post standard input to the Aide> room. NOTE: called by chat.c - whobbs Who is on the system (connected to the server, actually.) - stats Print the calling statistics & graph. - msgform Format a binary message to the screen (stdin or in a file) - userlist Print the userlist. - readlog Read the caller log + aidepost Post standard input to the Aide> room + whobbs Who is on the system + stats Print the calling statistics & graph + msgform Format a binary message to the screen (stdin or in a file) + userlist Print the userlist + readlog Read the caller log + sendcommand Send a server command It is up to you to decide which utilities should be made accessible only to sysops. It is important that you set the file permissions correctly. All @@ -99,7 +100,23 @@ file. This file records all times the Citadel/UX program has been started, and at what baud rate, as well as logins, proper logouts, loss of carrier (SIGHUP), bad password attempts, and new user logins. + + SENDCOMMAND + + sendcommand will interpret its arguments (except for "-hDIRNAME") as a +server command, which is sent to the server. Commands which require textual +input will read it from stdin. Commands which generate textual output will +be sent to stdout. + + This utility is intended to be used to enable Citadel server commands to be +executed from shell scripts. Review the script called "weekly" which ships +with the Citadel distribution for an example of how this can be used. + NOTE: be sure that this utility is not world-executable. It connects to the +server in privileged mode, and therefore could present a security hole if not +properly restricted. + + -------------------------------------------------------------------------- That should cover all of the included utilities. Comments, suggestions, -- 2.39.2