John Simpson wrote:
> 
> (2) have qmail-smtpd open a socket to a vpopmaild service, or a 
> courierauthd service (i wrote a simple widget which handles the 
> "login", "help", and "quit" commands, but uses courier-authlib  instead
> of libvpopmail) and uses that to verify the ID and password  which were
> entered. http://qmail.jms1.net/courierauthd.shtml talks  about it. the
> page is not really finished but the code is very simple  and it works,
> if you can link it- there are issues with how BSD  handles linking with
> the courier-authlib library and i don't have a  BSD system to play with.

This is how I've implemented a plugin for qpsmtpd that auths against
vpopmaild.

It's extremely easy:

# 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);
}


Of course, qpsmtpd is written in perl so this sort of thing *is* pretty
easy!

> the "auth.cdb" idea is a lot easier to write, and to me it makes more 
> sense. however, the idea of using vpopmaild for this purpose is also 
> intriguing from a programming standpoint (i.e. CAN i write this code, 
> how can i make a single version of qmail-smtpd which can handle all 
> three AUTH schemes- fork/exec vchkpw, auth.cdb, and vpopmaild.)

You really should check out qpsmtpd. It can handle several auth types
easily.

R.

Reply via email to