Hi Robin,

   It works !!!
Thank you for your help.

 Lucas

Robin Bowes wrote:
[EMAIL PROTECTED] wrote:
 Hi John,

  Thank you for the answer. You are right. Now server is accepting
authentication, but vpopmail plugin does not work. We have clear txt
password in database and connect to database, but it doesn't validate.
How do I debug it?
This lines doesn't print any information:
    $self->log(LOGINFO,$passwd_hash->{'pw_clear_passwd'});
    $self->log(LOGINFO,$passwd_hash->{'pw_passwd'});

Lucas,

Try using my auth_vpopmaild plugin. It authenticates against a vpopmaild process.

R.

#!/usr/bin/perl -w

use IO::Socket;

sub register {
    my ( $self, $qp ) = @_;

    $self->register_hook( "auth-plain", "auth_vpopmaild" );
    $self->register_hook( "auth-login", "auth_vpopmaild" );

}

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

    ### FIXME - read these values 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);

    # Get server greeting (+OK)
    my $connect_response = <$vpopmaild_socket>;
    if ( !$connect_response =~ /\+OK.*/ ) {
        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);
    }
}


Reply via email to