From: charlie@antipope.org (Charlie Stross) Subject: New modules: NetServer-Generic-0.03 and NetServer-SMTP-0.01 Date: 23 Sep 1998 00:03:58 GMT I have today uploaded two modules to CPAN: NetServer-Generic-0.03, and NetServer-SMTP-0.01. These modules can be found in: $CPAN/author/id/C/CH/CHSTROSS and $CPAN/modules/by-module/NetServer NetServer::Generic implements a class for writing simple TCP/IP servers. Servers can be configured to fork() (like a traditional UNIX internet server) or use the select() system call. A basic allow/deny access control mechanism is provided. To write a server, simply create a subroutine that reads from STDIN and writes to STDOUT. Then create a NetServer::Generic object, configure it, and pass it a reference to the subroutine. The sub will then be executed whenever a client attempts to connect to the bound hostname on the designated socket; input from the socket will go to STDIN, and output from STDOUT will go back to the client. (If this sounds like the job inetd does, it is. A future release may incorporate full inetd/tcpd replacement functionality, implemented in Perl.) NetServer::SMTP is a class that provides a minimal SMTP server interface, as defined in RFC 821 4.5.1 ("Minimum Implementation"). No attempt to verify the authenticity of the sender is made; no attempt is made to filter out relay attacks or deliver the mail, and it doesn't even attempt to check messages for RFC 822 compliance. Instead, the mail is spooled in the form of a deep-frozen NetServer::SMTP object, dropped into the spool directory. Spooled mail may be transmitted by (a) unfreezing it into a live NetServer::SMTP object and (b) invoking the send() method on it to transmit the mail to a designated smarthost. NetServer::SMTP relies on NetServer::Generic to provide server functionality. It should be considered very much an early alpha release; don't try using it for anything mission-critical just yet! NetServer::SMTP is part of a work-in-progress, the development of a compact SMTP server in Perl. An example is included: leafmail, a queueing SMTP spooler designed for use on a dial-up system with an intermittent internet connect. (Leafmail batches up mail sent via SMTP while the system is offline, and can transmit it to an ISP's mail server when the system goes online.) (Future planned work includes RFC822 compliance checks, tests for indications of spam tainting in the Received: line, a local delivery interface, and smarter remote delivery.) Both the above modules are implemented in 100% Perl and test out on Linux and BSDI UNIX. (They are unlikely to work effectively on systems that do not support the fork() system call, e.g. Win32 and MacOS.) In addition they use the following modules which are available from CPAN but are not part of the core Perl 5.004/5.005 distributions: Time::CTime (from Time-modules) FreezeThaw (for NetServer::SMTP) ChatBot::Eliza (for one of the examples in NetServer::Generic) Mail::Internet (for leafmail, in NetServer::SMTP) -- Charlie Stross