[PATCH] When reading no single byte for the key abort.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allows keyscripts that pipe into cryptsetup to quit due to e.g. a
timeout or user pressing ^D.

Signed-off-by: Ludwig Nussel <ludwig.nussel@xxxxxxx>
---
 lib/utils.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/utils.c b/lib/utils.c
index 05d33cd..25f7714 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -490,6 +490,8 @@ void get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
 		}
 		if(key_file)
 			close(fd);
+		if(!i) // we didn't read anything, user pressed ^D?
+			goto out_err;
 		pass[i] = 0;
 		*key = pass;
 		*passLen = i;
-- 
1.6.2.1

_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
http://www.saout.de/mailman/listinfo/dm-crypt

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux