*** core/ldap_api.php.orig 2011-04-05 18:24:17.000000000 +0000 --- core/ldap_api.php 2011-07-22 11:29:15.000000000 +0000 *************** *** 360,365 **** --- 360,370 ---- 'dn', ); + $t_ldap_group_dn = config_get( 'ldap_group_dn', ''); + $t_ldap_group_member_field = config_get( 'ldap_group_member_field', 'memberuid' ) ; + $t_search_attrs_group = array( $t_ldap_group_member_field, 'dn' ); + $t_search_filter_group = "(&($t_ldap_group_member_field=$c_username))"; + # Bind log_event( LOG_LDAP, "Binding to LDAP server" ); $t_ds = ldap_connect_bind(); *************** *** 396,403 **** # Attempt to bind with the DN and password if ( @ldap_bind( $t_ds, $t_dn, $p_password ) ) { ! $t_authenticated = true; ! break; } } } else { --- 401,421 ---- # Attempt to bind with the DN and password if ( @ldap_bind( $t_ds, $t_dn, $p_password ) ) { ! if ($t_ldap_group_dn != '') { ! # check for group mantis for this user ! $t_sr2 = ldap_read( $t_ds, $t_ldap_group_dn, $t_search_filter_group, $t_search_attrs_group); ! $t_info2 = ldap_get_entries( $t_ds, $t_sr2 ); ! if ($t_info2[0]['memberuid']) { ! # We don't need check recived memberuid listi ($t_info2[0]['memberuid']) ! # becouse filter in ldap_read() guarantees (if $t_info2[0]['memberuid'] is not empty) ! # occurrence $t_username in this list ! $t_authenticated = true; ! break; # Don't need to go any further ! } ! } else { ! $t_authenticated = true; ! break; # Don't need to go any further ! } } } } else {