cryptsetup: Invalidate ineffective try_discover_key before trying

A single incorrect password attempt from the user would be tried
twice, because the first failed try would think it was the
try_discover_key method that failed, and would invalidate that instead
of the actual failed password. This resulted in the user being
prompted one fewer time than they should be.

Fixes #38495
This commit is contained in:
Will Fancher
2026-06-19 15:23:21 +09:00
committed by Yu Watanabe
parent b0f3e068e2
commit 7aaa26571d
+2
View File
@@ -2755,6 +2755,8 @@ static int verb_attach(int argc, char *argv[], uintptr_t _data, void *userdata)
return r;
if (r > 0)
key_data = &discovered_key_data;
else
try_discover_key = false;
}
if (token_type < 0 && !key_file && !key_data && !passwords) {