Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 16107
Status: resolved
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: agent2002 [...] 126.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.19
Fixed in: (no value)



Subject: Net::SMTP's auth doesn't work
Net::SMTP doesn't seem to support LOGIN, PLAIN, NTLM SMTP authentication. Python's Net::SMTP lib supports them pretty well.
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #16107] Net::SMTP's auth doesn't work
Date: Fri, 25 Nov 2005 08:22:27 -0600
To: bug-libnet [...] rt.cpan.org
RT-Send-Cc:
On Nov 24, 2005, at 11:59 PM, via RT wrote: Show quoted text
> Net::SMTP doesn't seem to support LOGIN, PLAIN, NTLM SMTP > authentication.
Net::SMTP uses Authen::SASL and supports LOGIN and PLAIN, but not NTLM Show quoted text
> Python's Net::SMTP lib supports them pretty well.
So Graham.
From: agent2002 [...] 126.com
[gbarr@pobox.com - Fri Nov 25 09:23:14 2005]: Show quoted text
> On Nov 24, 2005, at 11:59 PM, via RT wrote:
> > Net::SMTP doesn't seem to support LOGIN, PLAIN, NTLM SMTP > > authentication.
> > Net::SMTP uses Authen::SASL and supports LOGIN and PLAIN, but not NTLM >
Well, after checking in the source code of Net::SMTP, I have an impression that ->auth tries to auto-detect the auth mechanism. Unfortunately, that detection fails for my SMTP server. I'm very happy when I see ->auth also acceptes users' Authen::SASL object by which I can specify the mechanism explictily: $sasl = Authen::SASL->new( mechanism => 'LOGIN', callback => { user => $user, pass => $password, }, ); $smtp->auth($sasl); Woot! That works pretty fine, but it is __NOT__ documented at all. But I wish Net::SMTP to provide cleaner interface for its ->auth method. Maybe one day I can specify my auth mechanism without bother defining my own SASL object, and can write something as simple as the following: $smtp->auth($user, $password, type=>'LOGIN'); You see, this won't break the current interface, but is more flexible. What do you think of it? Regards, Agent
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #16107] Net::SMTP's auth doesn't work
Date: Sat, 26 Nov 2005 06:40:12 -0600
To: bug-libnet [...] rt.cpan.org
RT-Send-Cc:
On Nov 26, 2005, at 1:56 AM, via RT wrote: Show quoted text
>> On Nov 24, 2005, at 11:59 PM, via RT wrote:
>>> Net::SMTP doesn't seem to support LOGIN, PLAIN, NTLM SMTP >>> authentication.
>> >> Net::SMTP uses Authen::SASL and supports LOGIN and PLAIN, but not >> NTLM >>
> > Well, after checking in the source code of Net::SMTP, I have an > impression that ->auth tries to auto-detect the auth mechanism.
Yes, it has to determine what mechanisms the server supports so it can tell Authen::SASL which to use. Show quoted text
> Unfortunately, that detection fails for my SMTP server.
Well it would be useful to me if you at least attempted to describe how it fails. What do you see on stderr when debug is on. Just telling someone that something does not work is not useful at all. Show quoted text
> I'm very happy when I see ->auth also acceptes users' Authen::SASL > object by which I can specify the mechanism explictily: > > $sasl = Authen::SASL->new( > mechanism => 'LOGIN', > callback => { > user => $user, > pass => $password, > }, > ); > > $smtp->auth($sasl); > > Woot! That works pretty fine, but it is __NOT__ documented at all.
I am amazed that this works and just passing user/passwd does not. Net::SMTP gets a list of mechanisms from your server which would override yours. Show quoted text
> But I wish Net::SMTP to provide cleaner interface for its ->auth > method. > Maybe one day I can specify my auth mechanism without bother defining > my own SASL object, and can write something as simple as the > following: > > $smtp->auth($user, $password, type=>'LOGIN'); > > You see, this won't break the current interface, but is more > flexible. What do you think of it?
This should not be needed. User and password is all that should be needed. Graham.
Subject: Net::SMTP's auth works now
From: Agent Zhang
[gbarr@pobox.com - Sat Nov 26 07:40:50 2005]: Surprisingly, the following code works when I had another try today: $smtp->auth($user,$pass); I think it was my fault a few days ago. Sorry for the inconvenience I've brought to you and I also appreciate your responsiveness. You're right, if the auth mechanisms can be detected automatically, there's no need for users to specify it explicitly. Auto-detection is truly nicer. :=) So I shall never look back to both Net::SMTP_auth or Authen::SASL from now on. Thanks, Agent