]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: Invalidate ineffective try_discover_key before trying
authorWill Fancher <elvishjerricco@gmail.com>
Fri, 15 May 2026 01:09:54 +0000 (21:09 -0400)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Jun 2026 06:23:21 +0000 (15:23 +0900)
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

src/cryptsetup/cryptsetup.c

index 9c7b2006baba73cd78b6e6152d49f587017a9a73..50f78a2004ce43e29a502c45db8b5c3c405d4819 100644 (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) {