r4313 bugfix: queryLDAPServer: Undefined offset: 1
authorAlexey Andriyanov <alan@al-an.info>
Thu, 10 Mar 2011 11:19:40 +0000 (11:19 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Thu, 10 Mar 2011 11:19:40 +0000 (11:19 +0000)
wwwroot/inc/auth.php

index 10a09a0305a0733d98648a268d863abee5257f37..daf8e92b6a83f43aedbba6ece88b24585b4c0981 100644 (file)
@@ -436,7 +436,10 @@ function queryLDAPServer ($username, $password)
                        for ($i = 0; $i < $info[0]['memberof']['count']; $i++)
                                foreach (explode (',', $info[0]['memberof'][$i]) as $pair)
                                {
                        for ($i = 0; $i < $info[0]['memberof']['count']; $i++)
                                foreach (explode (',', $info[0]['memberof'][$i]) as $pair)
                                {
-                                       list ($attr_name, $attr_value) = explode ('=', $pair);
+                                       $items = explode ('=', $pair);
+                                       if (count ($items) != 2)
+                                               continue;
+                                       list ($attr_name, $attr_value) = $items;
                                        if (strtoupper ($attr_name) == 'CN' and validTagName ('$lgcn_' . $attr_value, TRUE))
                                                $ret['memberof'][] = '$lgcn_' . $attr_value;
                                }
                                        if (strtoupper ($attr_name) == 'CN' and validTagName ('$lgcn_' . $attr_value, TRUE))
                                                $ret['memberof'][] = '$lgcn_' . $attr_value;
                                }