[Mimedefang] Simple feature request

Michael Faurot mfaurot at atww.org
Mon Sep 13 22:27:47 EDT 2004


In article <20040913231310.GE3903 at xs4all.nl> you wrote:
>> 
>> Could the capability to optionally specify a port number in
>> md_check_against_smtp_server() be included in a future version of
>> MIMEDefang?

> Well, in a way, that functionality is already present, but it's
> undocumented. You can add a portnumber to the server spec, by
> adding a colon and a portnumber to the servername.

I didn't delve into the depths of IO::Socket::INET, as I was able to put
together a solution that worked in a couple of minutes by just changing
the arguments/variables for my copy of md_check_against_smtp_server()
from this:

	my($sender, $recip, $helo, $server) = @_;

To this:

	my($sender, $recip, $helo, $server, $port) = @_;	

And changing the call to IO::Socket::INET->new from this:

    my $sock = IO::Socket::INET->new(PeerAddr => $server,
                                     PeerPort => 'smtp(25)',
                                     Proto    => 'tcp',
                                     Timeout  => 15);

To this:

    my $sock = IO::Socket::INET->new(PeerAddr => $server,
                                     PeerPort => $port,
                                     Proto    => 'tcp',
                                     Timeout  => 15);


Given the coding of 'PeerPort' in the original, are you telling me that
this undocumented feature would override that?

Just now I took a look the man page IO::Socket::INET(3perl) and it does
document the behavior you mention about adding a colon to the end of
PeerAddr and gives some examples of this usage.  However, none of those
examples show PeerAddr using an address:port combination, being used
where PeerPort is also defined--as would be the case in the stock
md_check_against_smtp_server().  So I suspect using this address:port
notation with md_check_against_smtp_server() wouldn't work very well.
That's just speculation though as I've not tested this.

> This, however, depends on an undocumented feature of IO::Socket::INET,
> so it might disappear ;)

That's exactly why I created my own version
of md_check_against_smtp_server() so I wouldn't have to re-patch
mimedefang.pl every time a new version MIMEDefang comes out.  Ideally,
this feature could be incorporated into mimedefang.pl, and then I can
get rid of my copy of this function.



More information about the MIMEDefang mailing list