R48655 - /trunk/emailadmin/inc/class.emailadmin_sieve.inc.php

Author: leithoff
New Revision: 48655

URL: http://svn.stylite.de/viewvc/egroupware?rev=48655&view=rev
Log:
fix problem in own _cmdAuthenticate; provide own getBestAuthMethod; intend to use LOGIN as AuthMethod

Modified:
trunk/emailadmin/inc/class.emailadmin_sieve.inc.php

Modified: trunk/emailadmin/inc/class.emailadmin_sieve.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/emailadmin/inc/class.emailadmin_sieve.inc.php?rev=48655&r1=48654&r2=48655&view=diff

— trunk/emailadmin/inc/class.emailadmin_sieve.inc.php (original)
+++ trunk/emailadmin/inc/class.emailadmin_sieve.inc.php Fri Sep 19 12:44:25 2014
@@ -207,7 +207,7 @@
$this->supportedAuthMethods = $sieveAuthMethods[$_icServerID];
}

  •   if(PEAR::isError($this->error = $this->login($username, $password, null, $euser) ) )
    
  •   if(PEAR::isError($this->error = $this->login($username, $password, 'LOGIN', $euser) ) )
      {
      	if ($this->debug)
      	{
    

@@ -298,6 +298,49 @@

     return true;
 }
  • /**

    • Own _getBestAuthMethod as Net/Sieve.php assumes SASLMethods to be working
    • Returns the name of the best authentication method that the server
    • has advertised.
    • @param string if !=null,check this one first if reported as serverMethod.
    •              if so, return as bestauthmethod
      
    • @return mixed Returns a string containing the name of the best
    •              supported authentication method or a PEAR_Error object
      
    •              if a failure condition is encountered.
      
  • */

  • function _getBestAuthMethod($userMethod = null)

  • {

  •   //error_log(__METHOD__.__LINE__.'->'.$userMethod.'<->'.array2string($this->_capability['sasl']));
    
  •   if( isset($this->_capability['sasl']) ){
    
  •   	$serverMethods=$this->_capability['sasl'];
    
  •   }else{
    
  •   	// if the server don't send an sasl capability fallback to login auth
    
  •   	//return 'LOGIN';
    
  •   	return PEAR::raiseError("This server don't support any Auth methods SASL problem?");
    
  •   }
    
  •   $methods = array();
    
  •   if($userMethod != null ){
    
  •   	$methods[] = $userMethod;
    
  •   	array_push($methods,$this->supportedAuthMethods);
    
  •   }else{
    
  •   	$methods = $this->supportedAuthMethods;
    
  •   }
    
  •   if( ($methods != null) && ($serverMethods != null)){
    
  •   	foreach ( $methods as $method ) {
    
  •   		if ( in_array( $method , $serverMethods ) ) {
    
  •   			return $method;
    
  •   		}
    
  •   	}
    
  •   	$serverMethods=implode(',' , $serverMethods );
    
  •   	$myMethods=implode(',' ,$this->supportedAuthMethods);
    
  •   	return PEAR::raiseError("$method NOT supported authentication method!. This server " .
    
  •   		"supports these methods= $serverMethods, but I support $myMethods");
    
  •   }else{
    
  •   	return PEAR::raiseError("This server don't support any Auth methods");
    
  •   }
    
  • }

    /**

    • Handles the authentication using any known method
      @@ -321,7 +364,7 @@
      //error_log(METHOD.LINE.’ using AuthMethod: '.$method);
      switch ($method) {
      case ‘DIGEST-MD5’:
  •            $result = $this->_authDigest_MD5( $uid , $pwd , $euser );
    
  •            $result = $this->_authDigestMD5( $uid , $pwd , $euser );
               if (!PEAR::isError($result))
      		{
      			break;
    

@@ -331,7 +374,7 @@
$this->supportedAuthMethods = array_diff($this->supportedAuthMethods,array($method,‘CRAM-MD5’));
return $this->_cmdAuthenticate($uid , $pwd, null, $euser);
case ‘CRAM-MD5’:

  •            $result = $this->_authCRAM_MD5( $uid , $pwd, $euser);
    
  •            $result = $this->_authCRAMMD5( $uid , $pwd, $euser);
               if (!PEAR::isError($result))
      		{
      			break;
    

Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk


eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs