2009-03-09 00:18:36 +01:00
|
|
|
exit unsuccessfully on empty passphrase if input is a tty
|
|
|
|
|
|
|
|
allows user to press ctrl-d to abort
|
2007-06-05 04:29:16 +02:00
|
|
|
|
|
|
|
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
|
|
|
|
|
|
|
|
Index: hashalot-0.3/hashalot.c
|
|
|
|
===================================================================
|
2009-03-09 00:18:36 +01:00
|
|
|
--- hashalot-0.3.orig/hashalot.c
|
2007-06-05 04:29:16 +02:00
|
|
|
+++ hashalot-0.3/hashalot.c
|
2009-03-09 00:18:36 +01:00
|
|
|
@@ -135,10 +135,14 @@ phash_lookup(const char phash_name[], si
|
|
|
|
static char *
|
|
|
|
xgetpass(const char *prompt)
|
|
|
|
{
|
|
|
|
- if (isatty(STDIN_FILENO)) /* terminal */
|
|
|
|
- return getpass(prompt); /* FIXME getpass(3) obsolete */
|
|
|
|
- else { /* file descriptor */
|
|
|
|
- char *pass = NULL;
|
|
|
|
+ char *pass = NULL;
|
|
|
|
+ if (isatty(STDIN_FILENO)) { /* terminal */
|
|
|
|
+ pass = getpass(prompt); /* FIXME getpass(3) obsolete */
|
|
|
|
+ if(!pass || !*pass) {
|
|
|
|
+ exit(EXIT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ return pass;
|
|
|
|
+ } else { /* file descriptor */
|
|
|
|
int buflen, i;
|
2007-06-05 04:29:16 +02:00
|
|
|
|
2009-03-09 00:18:36 +01:00
|
|
|
buflen=0;
|