329c329,331 < strlen ($LDAP_options['search_attr']) --- > strlen ($LDAP_options['search_attr']) and > isset ($LDAP_options['group_attr']) and > strlen ($LDAP_options['group_attr']) 337c339 < array_merge (array ('memberof'), explode (' ', $LDAP_options['displayname_attrs'])) --- > array_merge (array ($LDAP_options['group_attr']), explode (' ', $LDAP_options['displayname_attrs'])) 353,355c355,363 < if (isset ($info[0]['memberof'])) < for ($i = 0; $i < $info[0]['memberof']['count']; $i++) < foreach (explode (',', $info[0]['memberof'][$i]) as $pair) --- > if (isset ($info[0][$LDAP_options['group_attr']])) > for ($i = 0; $i < $info[0][$LDAP_options['group_attr']]['count']; $i++) > { > $pair = $info[0][$LDAP_options['group_attr']][$i]; > if > ( > isset ($LDAP_options['group_filter']) and > strlen ($LDAP_options['group_filter']) > ) 357,359c365,371 < list ($attr_name, $attr_value) = explode ('=', $pair); < if (strtoupper ($attr_name) == 'CN' and validTagName ('$lgcn_' . $attr_value, TRUE)) < $ret['memberof'][] = '$lgcn_' . $attr_value; --- > if (preg_match($LDAP_options['group_filter'], $pair, $matches)) > { > $attr_name = $matches[1]; > $attr_value = $matches[2]; > } > else > $attr_name = 'undefined'; 360a373,381 > else > { > $pairs = explode (',', $info[0][$LDAP_options['group_attr']][$i]); > // group CN in only first element > list ($attr_name, $attr_value) = explode ('=', $pairs[0]); > } > if (strtoupper ($attr_name) == 'CN' and validTagName ('$lgcn_' . $attr_value, TRUE)) > $ret['memberof'][] = '$lgcn_' . $attr_value; > }