I've programmed an plugin for the SMTP auth system which can use a regular
checkpassword binary. One need to configure the full path of the binary in
config file 'smtpauth-checkpassword'. The code is attached.
-kju
--
It's an insane world, but i'm proud to be a part of it. -- Bill Hicks
#!/usr/bin/perl -w
sub register {
my ( $self, $qp ) = @_;
$self->register_hook( "auth-plain", "authcpw" );
$self->register_hook( "auth-login", "authcpw");
}
sub authcpw {
my ( $self, $transaction, $method, $user, $passClear, $passHash, $ticket ) =
@_;
my $binary = $self->qp->config("smtpauth-checkpassword")
or return (DECLINED);
return(DECLINED) if ( ! -x $binary );
my ($untainted) = $binary =~ /^(.*)$/;
open(CPW,"|$untainted 3<&0");
printf(CPW "%s\0%s\0Y123456\0",$user,$passClear);
close(CPW);
my $status = $?;
return(DECLINED) if ( $status != 0 );
return ( OK, "authcheckpassword" );
}