This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Perl module Net::SMTP->auth() error with Authen::SASL::XS


Hi there,

Versions:

    Windows XP SP3 32-bit
    CYGWIN_NT-5.1 2.5.1(0.297/5/3) 2016-04-21 22:12 i686 Cygwin
    This is perl 5, version 22, subversion 2 (v5.22.2) built for cygwin-thread-multi-64int
    perl-Authen-SASL-2.16-2
    perl-Authen-SASL-XS-1.00-1

When I've installed perl-Authen-SASL-XS package required by perl-Authen-SASL
my script can't auth() on SMTP server. Debug log:

Net::SMTP::_SSL>>> Net::SMTP::_SSL
Net::SMTP::_SSL>>>   IO::Socket::SSL(2.027)
Net::SMTP::_SSL>>>     IO::Socket::IP(0.37)
Net::SMTP::_SSL>>>       IO::Socket(1.38)
Net::SMTP::_SSL>>>         IO::Handle(1.35)
Net::SMTP::_SSL>>>           Exporter(5.72)
Net::SMTP::_SSL>>>   Net::SMTP(3.05)
Net::SMTP::_SSL>>>     Net::Cmd(3.05)
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 220 smtp3h.mail.yandex.net ESMTP (Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru)
Net::SMTP::_SSL=GLOB(0x206713a8)>>> EHLO localhost.localdomain
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250-smtp3h.mail.yandex.net
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250-8BITMIME
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250-PIPELINING
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250-SIZE 42991616
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250-AUTH LOGIN PLAIN XOAUTH2
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250-DSN
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 250 ENHANCEDSTATUSCODES
Connected to smtp.yandex.ru at /cygdrive/c/do/scripts/Yotools.pm line 559.
Auth'n as user-name... at /cygdrive/c/do/scripts/Yotools.pm line 562.
auth() error at /cygdrive/c/do/scripts/Yotools.pm line 564.
Net::SMTP::_SSL=GLOB(0x206713a8)>>> QUIT
Net::SMTP::_SSL=GLOB(0x206713a8)<<< 221 2.0.0 Closing connection.

No any diagnostics from Authen::SASL.

If I've uninstalled perl-Authen-SASL-XS all work. Debug log (base64'd user name
and password at login are changed):

Net::SMTP::_SSL>>> Net::SMTP::_SSL
Net::SMTP::_SSL>>>   IO::Socket::SSL(2.027)
Net::SMTP::_SSL>>>     IO::Socket::IP(0.37)
Net::SMTP::_SSL>>>       IO::Socket(1.38)
Net::SMTP::_SSL>>>         IO::Handle(1.35)
Net::SMTP::_SSL>>>           Exporter(5.72)
Net::SMTP::_SSL>>>   Net::SMTP(3.05)
Net::SMTP::_SSL>>>     Net::Cmd(3.05)
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 220 smtp1h.mail.yandex.net ESMTP (Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru)
Net::SMTP::_SSL=GLOB(0x206715f0)>>> EHLO localhost.localdomain
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250-smtp1h.mail.yandex.net
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250-8BITMIME
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250-PIPELINING
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250-SIZE 42991616
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250-AUTH LOGIN PLAIN XOAUTH2
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250-DSN
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250 ENHANCEDSTATUSCODES
Connected to smtp.yandex.ru at /cygdrive/c/do/scripts/Yotools.pm line 559.
Auth'n as user-name... at /cygdrive/c/do/scripts/Yotools.pm line 562.
Net::SMTP::_SSL=GLOB(0x206715f0)>>> AUTH LOGIN
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 334 VXNlcm5hbWU6
Net::SMTP::_SSL=GLOB(0x206715f0)>>> USER_NAME
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 334 UGFzc3dvcmQ6
Net::SMTP::_SSL=GLOB(0x206715f0)>>> PASSWORD
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 235 2.7.0 Authentication successful.
auth()'d at 'smtp.yandex.ru' as 'user-name'
2016-06-01 05:13:46: Mail'n from 'Account <user-name@yandex.ru>'... Net::SMTP::_SSL=GLOB(0x206715f0)>>> MAIL FROM:<user-name@yandex.ru>
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250 2.1.0 <user-name@yandex.ru> ok
To: recipient@yandex.ru
Net::SMTP::_SSL=GLOB(0x206715f0)>>> RCPT TO:<olnd@yandex.ru>
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250 2.1.5 <recipient@yandex.ru> recipient ok
Net::SMTP::_SSL=GLOB(0x206715f0)>>> DATA
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 354 Enter mail, end with "." on a line by itself
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Date: Wed, 01 Jun 2016 05:13:45 +0300
Net::SMTP::_SSL=GLOB(0x206715f0)>>> From: <user-name@yandex.ru>
Net::SMTP::_SSL=GLOB(0x206715f0)>>> MIME-Version: 1.0
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Reply-To: <user-name@yandex.ru>
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Subject: Test
Net::SMTP::_SSL=GLOB(0x206715f0)>>> To: <recipient@yandex.ru>
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Content-Type: text/plain; charset=UTF-8
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Content-Transfer-Encoding: quoted-printable
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Content-Disposition: inline
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Howdy! This is test message.
Net::SMTP::_SSL=GLOB(0x206715f0)>>> --
Net::SMTP::_SSL=GLOB(0x206715f0)>>>
Net::SMTP::_SSL=GLOB(0x206715f0)>>> Best regards.
Net::SMTP::_SSL=GLOB(0x206715f0)>>> .
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 250 2.0.0 Ok: queued on smtp1h.mail.yandex.net as 1464747226-BQFvPGbm8R-DjMKLPln
Net::SMTP::_SSL=GLOB(0x206715f0)>>> QUIT
Net::SMTP::_SSL=GLOB(0x206715f0)<<< 221 2.0.0 Closing connection.

Authen::SASL POD says:

    The framework allows different implementations of the connection class to be
    plugged in...

    By default the order in which these plugins are selected is
    Authen::SASL::XS, Authen::SASL::Cyrus and then Authen::SASL::Perl.

    If you want to change it or want to specifically use one implementation only
    simply do

        use Authen::SASL qw(Perl);

but I don't want to change Net::SMTP module that uses that code (uses default
Authen::SASL plugin):

/usr/lib/perl5/5.22/Net/SMTP.pm (160):

    eval {
      require MIME::Base64;
      require Authen::SASL;
    } or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0;

Problem? Is Authen::SASL::XS so required to install with Authen::SASL if
Authen::SASL works fine without it? I'm not expert in Perl, but I think that
module's code says "use what you found":

/usr/lib/perl5/vendor_perl/5.22/Authen/SASL.pm (13):

    @Plugins = qw(
        Authen::SASL::XS
        Authen::SASL::Cyrus
        Authen::SASL::Perl
    );

    sub import {
      shift;
      return unless @_;

      local $SIG{__DIE__};
      @Plugins = grep { /^[:\w]+$/ and eval "require $_" } map { /::/ ? $_ : "Authen::SASL::$_" } @_
          or croak "no valid Authen::SASL plugins found";
    }

Google found couple pages for me where advised to remove Authen::SASL::XS.

https://foswiki.org/Support/Faq69

    Authen::SASL comes with a pure perl version of the mechanism, and can also
    use some optional implementations: Authen::SASL::XS or Authen::SASL:Cyrus.
    If either the XS or Cyrus modules are installed, try removing them.

https://rtcpan.develooper.com/Public/Bug/Display.html?id=100235

    $client is now set but $client->mechanism returns undef. Therefore
    $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; does not change $mechanisms at
    all and the loop tries the same $mechanisms over and over again.

    Uninstalling Authen::SASL::XS is as a workaround for us since with
    Authen::SASL::Perl everything seems to work just fine.

They says about "Error: Use of uninitialized value $_..." and unknown
authentication mechanism but about removing Authen::SMTP::XS too.

Thanks.

Sorry for the verbosity. 

-- 
  Oleg


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]