/** * Authenticates the specified user id / password based on the simulation data. * * @param string $p_username The username. * @param string $p_password The password. * @return bool true for authenticated, false otherwise. */ function ldap_simulation_authenticate_by_username($p_username, $p_password) { $c_username = ldap_escape_string($p_username); $t_user = ldap_simulation_get_user($c_username); if ($t_user === null) { log_event(LOG_LDAP, "ldap_simulation_authenticate: user '{$p_username}' not found."); return false; } if ($t_user['password'] != $p_password) { log_event(LOG_LDAP, "ldap_simulation_authenticate: expected password '{$t_user['password']}' and got '{$p_password}'."); return false; } log_event(LOG_LDAP, "ldap_simulation_authenticate: authentication successful for user '{$p_username}'."); return true; }
/** * Authenticates the specified user id / password based on the simulation data. * * @param string $p_username The username. * @param string $p_password The password. * @return boolean true for authenticated, false otherwise. */ function ldap_simulation_authenticate_by_username($p_username, $p_password) { $c_username = ldap_escape_string($p_username); $t_user = ldap_simulation_get_user($c_username); if ($t_user === null) { log_event(LOG_LDAP, 'ldap_simulation_authenticate: user \'' . $p_username . '\' not found.'); return false; } if ($t_user['password'] != $p_password) { log_event(LOG_LDAP, 'ldap_simulation_authenticate: expected password \'' . $t_user['password'] . '\' and got \'' . $p_password . '\'.'); return false; } log_event(LOG_LDAP, 'ldap_simulation_authenticate: authentication successful for user \'' . $p_username . '\'.'); return true; }