From c7747b4d11cbddfd56f5e102fe971923c8907a83 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 18 Jun 2010 09:27:35 +0000 Subject: [PATCH] check if the selected Method (if one is selected by function parameter) of Authentication is valid (suppoted by the Server), if not try BestMethod supported by server --- egw-pear/Net/IMAPProtocol.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/egw-pear/Net/IMAPProtocol.php b/egw-pear/Net/IMAPProtocol.php index 3f30e9ad95..0ec87289d6 100644 --- a/egw-pear/Net/IMAPProtocol.php +++ b/egw-pear/Net/IMAPProtocol.php @@ -721,6 +721,16 @@ class Net_IMAPProtocol { } $serverMethods=implode(',' ,$this->_serverAuthMethods); $myMethods=implode(',' ,$this->supportedAuthMethods); + if (!empty($userMethod) && !in_array($userMethod,$this->_serverAuthMethods)) + { + foreach ( $this->supportedAuthMethods as $method ) { + if ( in_array( $method , $this->_serverAuthMethods ) ) { + error_log(__METHOD__." UserMethod $userMethod not supported by server; trying best ServerMethod $method"); + return $method; + } + } + } + return new PEAR_Error("$method NOT supported authentication method!. This IMAP server " . "supports these methods: $serverMethods, but I support $myMethods"); }else{