aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Net/IMAP/Sync.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/IMAP/Sync.pm')
-rw-r--r--lib/Net/IMAP/Sync.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm
index 4a9d431..85ca487 100644
--- a/lib/Net/IMAP/Sync.pm
+++ b/lib/Net/IMAP/Sync.pm
@@ -347,9 +347,13 @@ sub new($%) {
elsif ($mech eq 'PLAIN') {
require 'MIME/Base64.pm';
$self->fail("Missing option $_") foreach grep {!defined $self->{$_}} qw/username password/;
- $command = "AUTHENTICATE $mech";
my $credentials = MIME::Base64::encode_base64("\x00".$username."\x00".$password, '');
- $callback = sub($) {return $credentials};
+ $command = "AUTHENTICATE $mech";
+ if ($self->_capable('SASL-IR')) { # RFC 4959 SASL-IR
+ $command .= " $credentials";
+ } else {
+ $callback = sub($) {return $credentials};
+ }
}
else {
$self->fail("Unsupported authentication mechanism: $mech");