diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2015-07-26 00:58:12 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2015-07-26 01:15:51 +0200 |
commit | ebdf2537dc0eb1b54e4420c2bdd673110ced30d3 (patch) | |
tree | 5921219d7fd1f06a395980d700a3a93cffc5027e /lib | |
parent | acea34e9b9bb89c9ed5cebecdfb5e7fbcf90f427 (diff) |
LOGINDISABLED only disables plain-text mechanisms.
Also, LOGIN is always supported.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Net/IMAP/Sync.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Net/IMAP/Sync.pm b/lib/Net/IMAP/Sync.pm index 9db339b..cea647f 100644 --- a/lib/Net/IMAP/Sync.pm +++ b/lib/Net/IMAP/Sync.pm @@ -335,11 +335,12 @@ sub new($%) { @caps = $self->capabilities(); } - $self->fail("Logins are disabled.") if grep {$_ eq 'LOGINDISABLED'} @caps; - my @mechs = grep defined, map { /^AUTH=(.+)/ ? $1 : undef } @caps; + my @mechs = ('LOGIN', grep defined, map { /^AUTH=(.+)/ ? $1 : undef } @caps); my $mech = (grep defined, map {my $m = $_; (grep {$m eq $_} @mechs) ? $m : undef} split(/ /, $self->{auth}))[0]; $self->fail("Failed to choose an authentication mechanism") unless defined $mech; + $self->fail("Logins are disabled.") if ($mech eq 'LOGIN' or $mech eq 'PLAIN') and + grep {$_ eq 'LOGINDISABLED'} @caps; my ($command, $callback); my ($username, $password) = @$self{qw/username password/}; |