Skip Menu |

This queue is for tickets about the Net-Server-Mail-ESMTP-AUTH CPAN distribution.

Report information
The Basics
Id: 36226
Status: resolved
Priority: 0/
Queue: Net-Server-Mail-ESMTP-AUTH

People
Owner: SCRESTO [...] cpan.org
Requestors: Jose Luis Martinez (no email address)
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.1
Fixed in: 0.2



Subject: AUTH PLAIN not working
Hi, The AUTH LOGIN authentication is not working. Sample SMTP conversation with stub login routine: $esmtp->set_callback(AUTH => sub { my ($session, $username, $password) = @_; if ($password eq 'goodpassword'){ return 1; } else { return 0; } }); Sample SMTP conversation: === Trying localhost:2526... === Connected to localhost. <- 220 xxx ESMTP Net::Server::Mail (Perl) Service ready -> EHLO xxx <- 250-xxx Service ready <- 250 AUTH LOGIN PLAIN -> AUTH LOGIN <- 334 VXNlcm5hbWU6 -> dXNlcg== <- 334 UGFzc3dvcmQ6 -> Z29vZHBhc3N3b3Jk And it hangs there... It looks like in AUTH.pm, the $self->next_input_to(\&process_authlogin_password); is not working correctly, because process_authlogin_password seems to never be called. Perl is v5.8.8 built for i486-linux-gnu-thread-multi (Debian etch)
I had to fix AUTH LOGIN because my client uses that. A patch is attached. Also I added some lines to the example in the documentation. I tried to contact the author some weeks ago. He seems to be disappeared. ps: topic is wrong. AUTH PLAIN works!
commit e5fc552300d589c5ba056c4a07ff0a9d1cd4d5d0 Author: chris <chris@ rudorff com> Date: Fri Jun 26 19:16:41 2009 +0200 fix Net::Server::Mail::ESMTP::AUTH LOGIN diff --git a/lib/perl5/Net/Server/Mail/ESMTP/AUTH.pm b/lib/perl5/Net/Server/Mail/ESMTP/AUTH.pm index f87c106..29d9e4d 100644 --- a/lib/perl5/Net/Server/Mail/ESMTP/AUTH.pm +++ b/lib/perl5/Net/Server/Mail/ESMTP/AUTH.pm @@ -6,7 +6,7 @@ use base qw(Net::Server::Mail::ESMTP::Extension); use MIME::Base64; use vars qw( $VERSION ); -$VERSION = '0.1'; +$VERSION = '0.1.1'; =pod @@ -29,6 +29,7 @@ support for SMTP Authentification with Net::Server::Mail::ESMTP module # adding AUTH handler $esmtp->set_callback(AUTH => \&validate_auth); + $esmtp->set_callback(DATA => \&queue_message); $esmtp->process; } @@ -38,6 +39,7 @@ support for SMTP Authentification with Net::Server::Mail::ESMTP module if ($username eq 'ROBERT' and $password eq 'TOTO04') { # AUTH SUCCESFULL + $session->{AUTH}->{ok} = 1; return 1; } else { # AUTH FAILED @@ -45,9 +47,24 @@ support for SMTP Authentification with Net::Server::Mail::ESMTP module } } +sub queue_message { + my($session, $data) = @_; + + # providing AUTH doesn't make it mandatory. + # A client might not use AUTH at all! + # You must deal now with permissions: + + unless ($session->{AUTH}->{ok}) { + # warn "no AUTH supplied!"; + return(0, 530, 'Error: Authentication required'); + } + ... do stuff +} + =head1 FEATURES -* AUTH LOGIN method support -* AUTH PLAIN method support + + * AUTH LOGIN method support + * AUTH PLAIN method support =head1 DESCRIPTION @@ -93,7 +110,7 @@ sub process_authlogin_username $self->{AUTH}->{password} = ''; $self->reply(334, "UGFzc3dvcmQ6"); $self->next_input_to(\&process_authlogin_password); - return 1; + return (); } sub process_authlogin_password @@ -101,8 +118,7 @@ sub process_authlogin_password my ($self, $operation) = @_; $self->{AUTH}->{password} = decode_base64($operation); - exec_auth_callback($self); - return 1; + return exec_auth_callback($self); } sub exec_auth_callback @@ -120,8 +136,10 @@ sub exec_auth_callback if ($authok) { $self->reply(235, "Authentification successful."); + return (); } else { $self->reply(535, "Authentification failed."); + return 1; } } @@ -145,12 +163,11 @@ sub process } else { $self->{AUTH}->{username} = $plaindata[@plaindata-2]; $self->{AUTH}->{password} = $plaindata[@plaindata-1]; - exec_auth_callback($self); - return (); + return exec_auth_callback($self); } } elsif ($operation eq 'LOGIN') { $param=decode_base64($param); - warn " ==> LOGIN ==> $param\n"; + # warn " ==> LOGIN ==> $param\n"; $self->reply(334, "VXNlcm5hbWU6"); $self->next_input_to(\&process_authlogin_username); return (); @@ -176,6 +193,10 @@ Sylvain Cresto E<lt>tost@softhome.netE<gt> Please send bug-reports to tost@softhome.net. +=head1 VERSION + +0.1.1 06/26/2009 fixed AUTH LOGIN -- chr <chris at u- club.de> + =head1 LICENCE This library is free software; you can redistribute it and/or modify
Hi, Sorry I changed my email address