[systemd-commits] 2 commits - src/cryptsetup.c

Lennart Poettering lennart at kemper.freedesktop.org
Mon Nov 15 18:24:26 PST 2010


 src/cryptsetup.c |   25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

New commits:
commit 494856b55c78e92109891cf453fc831544efc488
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Nov 16 03:24:17 2010 +0100

    cryptsetup: include device name in password question

diff --git a/src/cryptsetup.c b/src/cryptsetup.c
index c103aa9..5afac64 100644
--- a/src/cryptsetup.c
+++ b/src/cryptsetup.c
@@ -232,8 +232,17 @@ int main(int argc, char *argv[]) {
                         password = NULL;
 
                         if (!key_file) {
+                                char *text;
 
-                                if ((k = ask_password_auto("Please enter passphrase for disk:", "drive-harddisk", until, &password)) < 0) {
+                                if (asprintf(&text, "Please enter passphrase for disk %s", argv[3]) < 0) {
+                                        log_error("Out of memory");
+                                        goto finish;
+                                }
+
+                                k = ask_password_auto(text, "drive-harddisk", until, &password);
+                                free(text);
+
+                                if (k < 0) {
                                         log_error("Failed to query password: %s", strerror(-k));
                                         goto finish;
                                 }
@@ -241,7 +250,15 @@ int main(int argc, char *argv[]) {
                                 if (opt_verify) {
                                         char *password2 = NULL;
 
-                                        if ((k = ask_password_auto("Please enter passphrase for disk (verification):", "drive-harddisk", until, &password2)) < 0) {
+                                        if (asprintf(&text, "Please enter passphrase for disk %s (verification)", argv[3]) < 0) {
+                                                log_error("Out of memory");
+                                                goto finish;
+                                        }
+
+                                        k = ask_password_auto(text, "drive-harddisk", until, &password2);
+                                        free(text);
+
+                                        if (k < 0) {
                                                 log_error("Failed to query verification password: %s", strerror(-k));
                                                 goto finish;
                                         }

commit b853f6e9d60c0eab2038227718ee1ed1266f94de
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Nov 16 03:23:52 2010 +0100

    cryptsetup: lock ourselves into memory as long as we deal with passwords

diff --git a/src/cryptsetup.c b/src/cryptsetup.c
index c007b87..c103aa9 100644
--- a/src/cryptsetup.c
+++ b/src/cryptsetup.c
@@ -21,6 +21,7 @@
 
 #include <string.h>
 #include <errno.h>
+#include <sys/mman.h>
 
 #include <libcryptsetup.h>
 
@@ -181,6 +182,9 @@ int main(int argc, char *argv[]) {
                 if (argc >= 6 && argv[5][0] && !streq(argv[5], "-"))
                         parse_options(argv[5]);
 
+                /* A delicious drop of snake oil */
+                mlockall(MCL_FUTURE);
+
                 if ((k = crypt_init(&cd, argv[3]))) {
                         log_error("crypt_init() failed: %s", strerror(-k));
                         goto finish;



More information about the systemd-commits mailing list