[systemd-devel] [PATCH] cryptsetup: ask for password, if key file cannot be accessed

harald at redhat.com harald at redhat.com
Thu Apr 11 04:08:00 PDT 2013


From: Harald Hoyer <harald at redhat.com>

If the key file cannot be accessed, we can at least ask for the
password.
---
 src/cryptsetup/cryptsetup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index ae4aa8d..29b0dae 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -390,6 +390,12 @@ int main(int argc, char *argv[]) {
                         strv_free(passwords);
                         passwords = NULL;
 
+                        /* We can't access the key_file, so ask for the password */
+                        if (access(key_file, R_OK)) {
+                                log_error("Can't access key file '%s': %m", key_file);
+                                key_file = NULL;
+                        }
+
                         if (!key_file) {
                                 char *text, **p;
 
-- 
1.8.2



More information about the systemd-devel mailing list