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
4 changes: 2 additions & 2 deletions src/include/functions_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ function CheckLDAPUserLogin( $username, $password )
// for the moment when a user logs in from LDAP, create it in the DB.
// then the prefs and group management is done in the DB and we don't rewrite the whole Loganalyzer code�

/* DB_RemoveBadChars() needs to be done here to maintain backwards compatibility even if it is not needed here*/
$md5pass = md5(DB_RemoveBadChars($password));
/* Don't store LDAP passwords in database */
$md5pass = '';
Comment on lines +391 to +392

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While setting the password to an empty string works, a more robust and conventional approach to disable password-based login for an account is to set the password hash to an invalid value that cannot be generated by the hashing algorithm. A common convention, for example in /etc/shadow files, is to use a single asterisk (*). This makes it clearer that password login is intentionally disabled and prevents any potential edge cases with empty strings.

	/* Don't store LDAP passwords in database, and disable login with local password */
	$md5pass = '*';


// check if the user already exist
$sqlquery = "SELECT * FROM `" . DB_USERS . "` WHERE username = '" . $username . "'";
Expand Down