Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added X-MASTERAUTH authentication scheme #53

Open
wants to merge 1 commit into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+18 −4
Diff settings

Always

Just for now

Copy path View file
@@ -2676,14 +2676,28 @@ sub authenticate_imap {
$ssl, $tls, $authmech, $authuser, $reconnectretry,
$proxyauth, $uid, $split, $Side ) = @_ ;

check_capability( $imap, $authmech, $Side ) ;
unless ( $authmech eq 'X-MASTERAUTH' ) {
check_capability( $imap, $authmech, $Side ) ;
}

if ( $proxyauth ) {
$imap->Authmechanism("") ;
$imap->User($authuser) ;
} else {
$imap->Authmechanism( $authmech ) unless ( $authmech eq 'LOGIN' or $authmech eq 'PREAUTH' ) ;
$imap->User($user) ;
if ( $authmech eq 'X-MASTERAUTH' ) {
my @challenge = $imap->tag_and_run( $authmech, "+" ) ;
$challenge[1] =~ s/^\+ |^\s+|\s+$//g ;
$imap->_imap_command( { addcrlf => 1, addtag => 0, tag => $imap->Count }, md5_hex( $challenge[1] . $password ) ) or
die_clean("[$authmech]: ", $imap->LastError, "\n") ;
$imap->State(2) ;
$imap->tag_and_run( 'X-SETUSER ' . $user ) or
die_clean("[X-SETUSER]: ", $imap->LastError, "\n") ;
$imap->State(3) ;
$imap->User($user) ;
} else {
$imap->Authmechanism( $authmech ) unless ( $authmech eq 'LOGIN' or $authmech eq 'PREAUTH' ) ;
$imap->User($user) ;
}
}

$imap->Authcallback(\&xoauth) if ( 'XOAUTH' eq $authmech ) ;
@@ -2694,7 +2708,7 @@ sub authenticate_imap {
$imap->Authuser($authuser) ;
$imap->Password($password) ;

unless ( $authmech eq 'PREAUTH' or $imap->login( ) ) {
unless ( $authmech eq 'PREAUTH' or $authmech eq 'X-MASTERAUTH' or $imap->login( ) ) {
my $info = "$Side failure: Error login on [$host] with user [$user] auth" ;
my $einfo = $imap->LastError || @{$imap->History}[-1] ;
chomp( $einfo ) ;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.