Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > fc6f60ad5dc13a448a13eb625263b62c > files > 52

squirrelmail-1.4.23-0.svn20201220_0200.1.mga7.src.rpm

Description: fix auth failure due to uppercase/lowercase mix
Origin: upstream, http://email.uoa.gr/avelsieve/changeset/1144
Bug: http://email.uoa.gr/avelsieve/ticket/275
Bug-Debian: http://bugs.debian.org/618569
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+bug/498921
Author: avel
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2012-09-09
Applied-Upstream: yes, cf. Origin

--- a/include/managesieve.lib.php
+++ b/include/managesieve.lib.php
@@ -321,7 +321,7 @@
         $this->auth = $this->user;
     else
         $this->auth = $auth;
-    $this->auth_types=$auth_types;    /* Allowed authentication types */
+    $this->auth_types = strtolower($auth_types);    /* Allowed authentication types */
     
     $this->broken_tls = false;
 
@@ -456,8 +456,8 @@
               }
               $this->modules = split(" ", $this->item[1]);
               if(is_array($this->modules)){
-                  foreach($this->modules as $this->module)
-                      $this->capabilities[$this->cap_type][$this->module]=true;
+                  foreach($this->modules as $m)
+                      $this->capabilities[$this->cap_type][strtolower($m)]=true;
               } /* end if */
               elseif(is_string($this->modules))
                   $this->capabilites[$this->cap_type][$this->modules]=true;
@@ -535,7 +535,7 @@
 
     /* Loop through each allowed authentication type and see if the server allows the type */
     foreach(explode(" ", $this->auth_types) as $auth_type) {
-        if ($this->capabilities["auth"][$auth_type]) {
+        if (isset($this->capabilities["auth"][$auth_type])) {
             /* We found an auth type that is allowed. */
             $this->auth_in_use = $auth_type;
         }
@@ -724,7 +724,7 @@
 
     switch ($this->auth_in_use) {
 
-        case "PLAIN":
+        case "plain":
             $auth=base64_encode($this->user."\0".$this->auth."\0".$this->pass);
    
             $this->len=strlen($auth);            
@@ -741,7 +741,7 @@
                return true;    
         break;
     
-        case "DIGEST-MD5":
+        case "digest-md5":
          // SASL DIGEST-MD5 support works with timsieved 1.1.0
          // follows rfc2831 for generating the $response to $challenge
          fputs($this->fp, "AUTHENTICATE \"DIGEST-MD5\"\r\n");
@@ -790,7 +790,7 @@
                return TRUE;    
              break;
     
-        case "CRAM-MD5":
+        case "cram-md5":
            // SASL CRAM-MD5 support works with timsieved 1.1.0
          // follows rfc2195 for generating the $response to $challenge
          // CRAM-MD5 does not support proxy of $auth by $user
@@ -816,7 +816,7 @@
                return TRUE;    
              break;
 
-    case "LOGIN":
+    case "login":
           $login=base64_encode($this->user);
           $pass=base64_encode($this->pass);