Skip to content

Commit

Permalink
Add special handling for systems without password in the password che…
Browse files Browse the repository at this point in the history
…cking short-circuiting

Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Jun 13, 2024
1 parent 2406e1a commit 5a6a212
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/config/password.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,11 @@ 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)
// Check if the user wants to set an empty password but the password is
// already empty, or if the newly set password is the same as the old
// one
if((strlen(password) == 0 && strlen(config.webserver.api.pwhash.v.s) == 0) ||
verify_password(password, config.webserver.api.pwhash.v.s, false) == PASSWORD_CORRECT)
{
log_debug(DEBUG_CONFIG, "Password unchanged, not updating");
return true;
Expand Down

0 comments on commit 5a6a212

Please sign in to comment.