mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: Prevent accidental anonymous binds (#4784)
* Prevent ldap and Active Directory authentication from allowing anonymous binds * fix style
This commit is contained in:
@@ -20,7 +20,7 @@ function authenticate($username, $password)
|
||||
ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, $config['auth_ldap_version']);
|
||||
}
|
||||
|
||||
if (ldap_bind($ldap_connection, $config['auth_ldap_prefix'].$username.$config['auth_ldap_suffix'], $password)) {
|
||||
if ($password && ldap_bind($ldap_connection, $config['auth_ldap_prefix'].$username.$config['auth_ldap_suffix'], $password)) {
|
||||
if (!$config['auth_ldap_group']) {
|
||||
return 1;
|
||||
} else {
|
||||
@@ -37,6 +37,8 @@ function authenticate($username, $password)
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif (!isset($password) || $password == '') {
|
||||
echo 'A password is required';
|
||||
} else {
|
||||
echo ldap_error($ldap_connection);
|
||||
}
|
||||
|
Reference in New Issue
Block a user