[Mimedefang] md_check_against_smtp_server and md_graphdefang_log

Richard Laager rlaager at wiktel.com
Mon Mar 25 20:22:32 EDT 2013


On Mon, 2013-03-25 at 17:00 -0700, kd6lvw at yahoo.com wrote:
> This is what I saw:
> >  if ($retval ne 'CONTINUE') {
> >  $sock->print("QUIT\r\n");
> 
> Looks pretty conditional to me.  If the return value is the continue literal, no quit is issued.

I've now pulled mimedefang.pl.in from the 2.73 tarball off the website.
Here's the function from HELO onwards:

    $sock->print("HELO $helo\r\n");
    $sock->flush();

    ($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);
    }

    $sock->print("MAIL FROM:$sender\r\n");
    $sock->flush();

    ($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);
    }

    $sock->print("RCPT TO:$recip\r\n");
    $sock->flush();

    ($retval, $code, $dsn, $text) = get_smtp_return_code($sock, $recip, $server);
    $sock->print("QUIT\r\n");
    $sock->flush();
    # Swallow return value
    get_smtp_return_code($sock, $recip, $server);
    $sock->close();
    return ($retval, $text, $code, $dsn);

Here, in the last chunk, is the unconditional QUIT. The other,
conditional, QUIT commands handle error cases. If the whitespace was
like this instead, it'd be easier to see:

    $sock->print("RCPT TO:$recip\r\n");
    $sock->flush();
    ($retval, $code, $dsn, $text) = get_smtp_return_code($sock, $recip, $server);

    $sock->print("QUIT\r\n");
    ...

-- 
Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20130325/71820f72/attachment.sig>


More information about the MIMEDefang mailing list