Skip to content

Commit

Permalink
Check if the newly set password is the same as the old one
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Jun 6, 2024
1 parent 9491cdf commit 2406e1a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/config/password.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,13 @@ int run_performance_test(void)

bool set_and_check_password(struct conf_item *conf_item, const char *password)
{
// Check if the newly set password is the same as the old one
if(verify_password(password, config.webserver.api.pwhash.v.s, false) == PASSWORD_CORRECT)
{
log_debug(DEBUG_CONFIG, "Password unchanged, not updating");
return true;
}

// Get password hash as allocated string (an empty string is hashed to an empty string)
char *pwhash = strlen(password) > 0 ? create_password(password) : strdup("");

Expand Down

0 comments on commit 2406e1a

Please sign in to comment.