From 357d20fa368f7faa1c79b32fabd74c40676772fd Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 14 Oct 2011 02:15:40 +0000 Subject: [PATCH] switch to IPC::Run, add logging --- _smtpd | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/_smtpd b/_smtpd index 1bd2021..60654f7 100644 --- a/_smtpd +++ b/_smtpd @@ -2,19 +2,22 @@ use strict; use Getopt::Std; -use vars qw(%aliases $opt_d $opt_a); +use vars qw(%aliases $opt_a); use subs qw(validate_recipient process_message read_aliases); use Net::Server::Mail::ESMTP; +use IPC::Run qw( run ); +use Sys::Syslog; -getopt('a:'); +getopt('a:v'); my $smtp = new Net::Server::Mail::ESMTP; $smtp->set_callback(RCPT => \&validate_recipient); $smtp->set_callback(DATA => \&process_message); +openlog('[_smtpd]', '', 'mail'); read_aliases; $smtp->process; - +closelog(); #-- sub validate_recipient { @@ -34,19 +37,21 @@ sub process_message { return(0, 554, 'Error: no valid recipients') unless(@recipients); + syslog('info', + 'received '.length($$data).' bytes for '.join(',', @recipients) + ); foreach my $recipient ( @recipients ) { $recipient =~ s/^