Oh, this is a simple case sensitivity issue - when I tested your patch I must have goofed, John.

The problem is this: $mechanism has been made lowercase, and keys of % auth_mechanisms have all been made uppercase.

I did notice in John's patch a change in where $mechanism = lc ($mechanism) was called: http://svn.perl.org/viewcvs/qpsmtpd/branches/0.3x/lib/Qpsmtpd/ Auth.pm?r1=660&r2=659&pathrev=660 http://svn.perl.org/viewcvs/qpsmtpd/branches/0.3x/lib/Qpsmtpd/ SMTP.pm?r1=660&r2=659&pathrev=660

My hunch without really checking is that this would be fixed if the changes to those two lines were undone, but you might have switched those for some good reason that isn't obvious to me, John. If so, this patch will work:

[EMAIL PROTECTED]:/home/smtpd/qpsmtpd/lib/Qpsmtpd# diff -u SMTP.pm.bak SMTP.pm
--- SMTP.pm.bak 2006-09-23 05:27:46.000000000 -0400
+++ SMTP.pm     2006-09-23 05:28:21.000000000 -0400
@@ -257,7 +257,7 @@
        and $self->transaction->notes('tls_enabled') );
     # if we don't have a plugin implementing this auth mechanism, 504
-    if( exists $auth_mechanisms{$mechanism} ) {
+    if( exists $auth_mechanisms{uc($mechanism)} ) {
return $self->{_auth} = Qpsmtpd::Auth::SASL( $self, $mechanism, @stuff );
     } else {
$self->log(2, "mechanism: $mechanism, avaliable: ".join(" : ", keys %auth_mechanisms)."\n");

Cheers,
Brian

On Sep 23, 2006, at 3:09 AM, Robin Bowes wrote:

Brian Szymanski wrote:

Can you send a copy of your config/plugins and any custom auth/ plugins
you are using?

Sure. See attached.

The patch is quite simple, I'd be quite surprised if it turns out to be a bug in the code - more likely the patch (me) or your auth plugins made some bad assumption. I just tested John's patch, and it works the same as my own does on my testbed server. My suspicion is that the problem is
something about the way you are registering your auth hooks.

It could well be.


Cheers,
Brian

PS - You're going to want to change your password, as you just sent it
unencrypted (just encoded in Base64) to a list :)

Ooops. Done!

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 )
        = @_;

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

    # 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);
    }
}
# __ CONNECT ________________________________________
check_earlytalker
count_unrecognized_commands 4
auth/auth_vpopmaild
#auth/auth_vchkpw
#qppoprelay
# tls ssl/smtp.robinbowes.com.cert ssl/smtp.robinbowes.com.key
tls

# __ RCPT FROM ______________________________________
#rhsbl
check_validrcptto_cdb cdb_file config/validrcptto.cdb
#check_localuser
check_badmailfrom
check_badrcptto
check_spamhelo
check_relay
#require_resolvable_fromhost
dnsbl

# __ DATAPOST _______________________________________
#virus/clamav clamscan_path=/usr/bin/clamdscan clamd_conf=/etc/ clamd.d/qpsmtpd.conf action=reject max_size=1048576 spamassassin reject_threshold 8 spamd_socket /var/run/spamassassin/ spamd.socket
#maillog
#virus/klez_filter
queue/qmail-queue

logging/accept_reject

# __ QUIT ___________________________________________
quit_fortune

rcpt_ok


---
Brian Szymanski
[EMAIL PROTECTED]




Reply via email to