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
8 changes: 6 additions & 2 deletions lib/chkhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ match_regex(const char *pattern, const char *string)
bool
is_valid_hash(const char *hash)
{
hash = strprefix(hash, "!") ?: hash;
// If the hash starts with '!', it means just lock the password.
if (strprefix(hash, "!"))
return true;
Comment on lines -43 to +45
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change is accepting anything after a !, such as !invalid_hash. We'd want to make sure that for a string !hash we still verify that hash is a valid hash for some algorithm.

I think what you want is to just add a check for an empty string after jumping over the !, as done in #1505.


if (streq(hash, "*"))
// If the hash starts with '*', this is an intentional way to prevent
// a user from logging in with password.
if (strprefix(hash, "*"))
return true;
Comment on lines -45 to 50
Copy link
Collaborator

@alejandro-colomar alejandro-colomar Jan 19, 2026

Choose a reason for hiding this comment

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

@Zugschlus, @zeha , @hallyn

Are you aware of uses of * followed by a hash? As far as I know, * is intended to replace a hash, not to be a prefix.


// Minimum hash length
Expand Down
Loading