Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions oauth/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ function messageShow($html_template, $message = 'No Msg') {
$user=strtolower(strip_tags(htmlspecialchars(trim($_POST['user']))));
$password=$_POST['password'];

// Sherwin Ldap-escape
if (!filter_var($user, FILTER_VALIDATE_EMAIL)) {
messageShow($prompt_template, 'Username contains invalid charecters.');
exit();
}

if (!function_exists('ldap_escape')) {
function ldap_escape($value) {
return preg_replace_callback('/[\\x00-\\x1F\\x7F\\(\\)\\\\\\*\\0]/', function ($matches) {
return '\\' . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT);
}, $value);
}
}
$user = ldap_escape($user);
// Sherwin Ldap-escape

// Open a LDAP connection
$ldap = new LDAP($ldap_host,$ldap_port,$ldap_version,$ldap_start_tls);

Expand Down