John Simpson said the following on 29/11/2005 01:21:
> googling for "qpsmtpd vpopmaild" only brings back two archived posts 
> from this mailing list- and i think you wrote both of them. is there  a
> URL where i can look at the code? i won't be able to directly copy  it
> (my patch will be in C rather than perl) but having a known  reference
> to look at will help me to make sure i'm on the right track.

It's not available anywhere yet.

Here's the auth sub:

sub auth_vpopmaild {
    my ( $self, $transaction, $method, $user, $passClear, $passHash,
$ticket )
        = @_;

    # Read these from a config file
    my $vpopmaild_host = 'localhost';
    my $vpopmaild_port = 89;

    # create socket
    my $vpopmaild_socket =
        IO::Socket::INET->new(PeerAddr => $vpopmaild_host,
                              PeerPort => $vpopmaild_port,
                              Proto    => "tcp",
                              Type     => SOCK_STREAM)
        or return (DECLINED);

    # send login details
    print $vpopmaild_socket "login $user $passClear\n\r";

    # get response from server
    my $login_response = <$vpopmaild_socket>;

    close ($vpopmaild_socket);

    # check for successful login
    if ($login_response =~ /\+OK.*/) {
        return ( OK, "authcheckpassword" );
    } else {
        return (DECLINED);

It's about as simple as it could get!

>>> and my own
>>> "validrcptto.cdb" patch (which rejects mail sent to non-existent
>>> mailboxes, uses a cdb file containing every valid email address  on  the
>>> system, and correctly handles "-default" aliases... http://
>>> has more information  
>>> about
>>> the patch.)
>> ... and it would be nice to add a validrcptto plugin using vpopmaild.
> one of the reasons i wrote it to use a cdb file was that the cdb file 
> could be scp'd out to "mailhubs", which would be able to reject mail  to
> non-existent mailboxes in domains which exist, without having to  call
> back to the mailbox server at all. sure, there's a delay between  the
> mailbox being added (or password being changed) and the servers 
> "knowing" about the change, but you can use a cron job or a  background
> service to compare timestamps and rebuild and copy cdb  files as needed-
> my own server sees any changes within fifteen seconds.
> as for writing a plug-in for validrcptto... it would actually be  really
> easy in perl. the trick is to correctly handle "-default"  aliases, and
> that's just a loop which does regex transforms to walk  through a series
> of addresses...
>     [EMAIL PROTECTED] (the original address)
> (if the domain's .qmail-default !~ /vdelivermail.*bounce
> \-no\-mailbox/ )
> it tries each address in turn. once it finds a match (from a cdb  file,
> a libvpopmail function, a courier-authlib function, or whatever  flavour
> of voodoo you practice) it accepts the recipient. if it  reaches the end
> of the list without finding any matches, the  recipient is rejected. if
> you look at qmail-smtpd.c with the  validrcptto.cdb patch, the logic is
> there in the vrtcheck() function  (it's in C, and uses djb's string
> functions, but once you get used to  them the logic is fairly
> straightforward.)

There is already such a plugin for qpsmtpd - I was just pointing out
that something that talks to vpopmaild would be a nice solution.


If a man speaks in a forest,
and his wife's not there,
is he still wrong?

Reply via email to