function ldap_internal_auth_user_id($result) { global $config; // For AD, convert SID S-1-5-21-4113566099-323201010-15454308-1104 to 1104 as our numeric unique ID if ($config['auth_ldap_attr']['uidNumber'] == "objectSid") { $sid = explode('-', ldap_bin_to_str_sid($result['objectsid'][0])); $userid = $sid[count($sid) - 1]; print_debug("LDAP[UserID][Converted objectSid " . ldap_bin_to_str_sid($result['objectsid'][0]) . " to user ID " . $userid . "]"); } else { $userid = $result[strtolower($config['auth_ldap_attr']['uidNumber'])][0]; print_debug("LDAP[UserID][Attribute " . $config['auth_ldap_attr']['uidNumber'] . " yields user ID " . $userid . "]"); } return $userid; }
function ldap_auth_user_id($result) { global $config, $debug; // For AD, convert SID S-1-5-21-4113566099-323201010-15454308-1104 to 1104 as our numeric unique ID if ($config['auth_ldap_attr']['uidNumber'] == "objectSid") { $sid = explode('-', ldap_bin_to_str_sid($result['objectsid'][0])); $userid = $sid[count($sid) - 1]; } else { $userid = $result[strtolower($config['auth_ldap_attr']['uidNumber'])][0]; } return $userid; }