mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Do not accept password login when the system is configured to not require a password
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -648,6 +648,11 @@ int api_auth(struct ftl_conn *api)
|
||||
"Rate-limiting login attempts",
|
||||
NULL);
|
||||
}
|
||||
else if(result == NO_PASSWORD_SET)
|
||||
{
|
||||
// No password set
|
||||
log_debug(DEBUG_API, "API: Trying to auth with password but none set: '%s'", password);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_debug(DEBUG_API, "API: Password incorrect: '%s'", password);
|
||||
|
||||
@@ -328,6 +328,7 @@ enum password_result verify_login(const char *password)
|
||||
log_debug(DEBUG_API, "App password correct");
|
||||
return APPPASSWORD_CORRECT;
|
||||
}
|
||||
|
||||
// Return result
|
||||
return pw;
|
||||
}
|
||||
@@ -336,7 +337,7 @@ enum password_result verify_password(const char *password, const char *pwhash, c
|
||||
{
|
||||
// No password set
|
||||
if(pwhash == NULL || pwhash[0] == '\0')
|
||||
return PASSWORD_CORRECT;
|
||||
return NO_PASSWORD_SET;
|
||||
|
||||
// No password supplied
|
||||
if(password == NULL || password[0] == '\0')
|
||||
|
||||
@@ -26,6 +26,7 @@ enum password_result {
|
||||
PASSWORD_INCORRECT = 0,
|
||||
PASSWORD_CORRECT = 1,
|
||||
APPPASSWORD_CORRECT = 2,
|
||||
NO_PASSWORD_SET = 3,
|
||||
PASSWORD_RATE_LIMITED = -1
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user