DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] [PATCH] When reading no single byte for the key abort.
@ 2009-09-25  7:21 Ludwig Nussel
  2009-09-28 18:51 ` Milan Broz
  0 siblings, 1 reply; 6+ messages in thread
From: Ludwig Nussel @ 2009-09-25  7:21 UTC (permalink / raw)
  To: dm-crypt; +Cc: Ludwig Nussel

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@suse.de>
---
 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-29 10:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-25  7:21 [dm-crypt] [PATCH] When reading no single byte for the key abort Ludwig Nussel
2009-09-28 18:51 ` Milan Broz
2009-09-29  9:25   ` Ludwig Nussel
2009-09-29 10:03   ` anton ivanov
2009-09-29 10:04     ` anton ivanov
2009-09-29 10:23     ` Milan Broz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox