Glue Logic LLC logo


lcmdx.c - send command to LISTSERV on remote node via TCPGUI interface

Official source: lcmdx.c in the Developers Guide for LISTSERV®, version 1.8e

A patched lcmdx.c is available that allows command line arguments to be safely passed via stdin. This prevents snooping eyes on the local system from seeing LISTSERV passwords and commands issued -- which can be seen by looking up command line args or environment in the public system process lists (e.g. with top).

[NB: the link between your machine and the LISTSERV machine is unencrypted and so your LISTSERV password and other private information is still travelling clear-text on the wire. You might set up an SSH tunnel between the machines to overcome that limitation.]

Example usage of patched lcmdx.c:

$ lcmdx - - - -
Input on stdin is separated by newlines. The last line is Control-D twice at your terminal if you are typing on the command line. However, a more convenient, programmable interface is IPC::Open3 in Perl:
#!/usr/bin/perl -Tw
$::ENV{'PATH'} = '/usr/local/bin:/bin:/usr/bin';
delete $::ENV{'BASH_ENV'};

use strict;
use IPC::Open3 ();

my $host    = '';
my $email   = '';
my $pass    = 'devnull-LISTSERV-password';
my $command = 'thanks';

my $pid = IPC::Open3::open3($wtr, $rdr, $err, 'lcmdx', '-', '-', '-', '-');
print $wtr join("\n", $host, $email, $pass, $command);
close $wtr;
print while (<$rdr>);
perldoc IPC::Open3 for more information. You might want to set up handler for SIGPIPE and to wrap the open3() call in an eval{} block to be able to catch exceptions.

The Perl module is a simple convenience library that wraps lcmdx, further building on the Perl code example above and employing the patched lcmdx.

For more information about the types of commands that you can send to LISTSERV, please see the current LSoft manuals

Home    |    Projects    |    Contact Us
© 2004 Glue Logic LLC