10.2 Running LCMDX
The lcmdx program (C language code at the end of the chapter) allows you to send a LISTSERV command from a command line (DOS, shell, or DCL prompt). Compile and link it (you may need to make minor changes to get it to compile, depending on your C compiler) to produce an executable.
Important: LCMDX.C is a sample program for TCPGUI programming. It was originally intended only as a demonstration tool for TCPGUI, but over the years many customers have discovered it can also be used for day-to-day LISTSERV maintenance tasks. That being said, it should be noted that LCMDX sends LISTSERV login credentials in clear text, because the TCPGUI protocol does not have any encryption/decryption features. TCPGUI is typically intended to be used locally, by scripts running on the LISTSERV machine itself (most importantly the WA CGI), and for internal traffic encryption is not considered necessary. This means that if you use LCMDX on a remote machine to send commands to LISTSERV via the Internet, your login credentials technically could be compromised by a "man in the middle" exploit. One solution to this problem is to restrict use of LCMDX to machines on your local network. For instance, an engineer could use Remote Desktop to log into a Windows LISTSERV machine, and run LCMDX at the command line in his RDP session. Or for LISTSERV running on unix, use an SSH client to run LCMDX on the LISTSERV machine remotely. With an SSH command line client, the command you will use looks like this: [me@unix ~]$ ssh listserv.myhost.com -X /usr/local/bin/lcmdx listserv.myhost.com me@myhost.com mypassword thanks You are then asked for your login password for the postmaster account you're using to run LCMDX (in the example, "me@myhost.com"), and then you will get the response to your command: You're welcome! Because you have used SSH to "wrap" the LCMDX command, you have now run LCMDX securely by opening a session to the LISTSERV machine and executing its locally-installed copy of LCMDX, instead of simply executing your own copy of LCMDX insecurely through the Internet. It's a little more complicated to add the SSH wrapper, of course, but it is much more secure. It should be noted that the TCPGUI port, 2306, may be blocked with a firewall rule that restricts access to the LISTSERV machine only, or if you prefer, to the LISTSERV machine and certain select machines on your local network; as far as the LISTSERV web interface is concerned, as long as WA on the LISTSERV machine can connect to TCPGUI on the LISTSERV machine, there is no need for the TCPGUI port to be exposed to the Internet at all. |
Note: Under Solaris, most network programs require you to pass the ‘-lsocket -lnsl’ flags to the compiler when compiling. If this is not done, then compiling LCMDX.C under Solaris will fail with network-related library errors. |
Important: When running the unix version of lcmdx, note that any command that includes an asterisk (e.g., "Q * FOR userid@host") will require that the asterisk be escaped. This is due to unix's shell expansion of wildcard characters. |
You can run lcmdx from any computer that is connected via TCP/IP to the LISTSERV host (i.e. via the Internet or a TCP/IP-based intranet).
You need to have a password registered for your email address in LISTSERV in order to send commands via TCP/IP. Instructions for registering a password are in the List Owner’s Manual.
The format for the lcmdx command line is:
lcmdx hostname[:port] address password command
where
- hostname is the DNS name of the LISTSERV host,
- port is the LISTSERV port number (needed only if it is different from the default of 2306),
- address is the email address of the user sending the command,
- password is the password registered with this LISTSERV host for that e- mail address, and
- command is the one-line LISTSERV command.
For example, if joan@example.com wants to set her subscription to the TALK list to digest, and her password on LISTSERV.EXAMPLE.COM (where this list is hosted) is “ABCDE”, she can use the following command:
lcmdx LISTSERV.EXAMPLE.COM joan@example.com ABCDE SET TALK DIGEST
LISTSERV responds:
Your subscription options have been successfully updated. You are being mailed a short report with the exact settings now in use for your subscription. Please take a few moments to check that this is indeed what you wanted.
Any one-line command can be submitted to LISTSERV in this way. To use lcmdx directly from your application, just spawn a subprocess or send the lcmdx command using whatever means is provided by the operating system under which your application is running.