[Mimedefang] md_check_against_smtp_server and md_graphdefang_log

James Curtis jameswcurtis at hotmail.com
Mon Mar 25 13:30:31 EDT 2013


> > I guess I need a mimedefang-filter and Perl for dummies book.
> 
> There are plenty of pretty good "Intro to Perl" books; check the O'Reilly
> site. As for intro to MIMEDefang, you could have a look at slides from a
> talk I gave (a long time ago):
> 
> http://www.mimedefang.org/static/mimedefang-lisa04.pdf
I read through that before going to the list. Page 86 seems to be the relevant page, but without sample code in context I'm still lost. 
I did read through the mimedefang.pl file enough to find: 
#***********************************************************************
# %PROCEDURE: md_check_against_smtp_server
# %ARGUMENTS:
# sender -- sender e-mail address
# recip -- recipient e-mail address
# helo -- string to put in "HELO" command
# server -- SMTP server to try.
# port -- optional: Port to connect on (defaults to 25)
# %RETURNS:
# ('CONTINUE', "OK") if recipient is OK
# ('TEMPFAIL', "err") if temporary failure
# ('REJECT', "err") if recipient is not OK.
# %DESCRIPTION:
# Verifies a recipient against another SMTP server by issuing a
# HELO / MAIL FROM: / RCPT TO: / QUIT sequence
#***********************************************************************
AND this
($retval, $code, $dsn, $text) = get_smtp_return_code($sock, $recip, $server);
 if ($retval ne 'CONTINUE') {
 $sock->print("QUIT\r\n");
 $sock->flush();
 # Swallow return value
 get_smtp_return_code($sock, $recip, $server);
 $sock->close();
 return ($retval, $text, $code, $dsn);
 }
My rookie brain seems to think that it is returning the value to $retval

But I can't figure out why this doesn't put an entry into the mdlog, either notauser, or unsure, even if the other variables are incorrect.
sub filter_recipient {
 my($recip, $sender, $ip, $host, $first, $helo, $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
 md_check_against_smtp_server($sender, $recip, "localhost", "192.168.1.10");
 if ($retval eq "REJECT") {
 md_graphdefang_log('notauser', $recip, $sender);
# return action_discard();
}else{
 md_graphdefang_log('unsure', $retval, $code);
 }
}
I verified that I was running mimedefang.pl with the -t option (listed as requirement for filter_recipient)
[root at monitor ~]# ps ax |grep mimedefang
27993 ? S 0:00 /usr/bin/mimedefang-multiplexor -t -p /var/spool/MIMEDefang/mimedefang-multiplexor.pid -m 2 -x 10 -y 0 -U defang -b 600 -l -s /var/spool/MIMEDefang/mimedefang-multiplexor.sock

Any additional help?
-Bill 		 	   		  


More information about the MIMEDefang mailing list