=== modified file 'TODO' --- TODO 2008-08-16 03:29:08 +0000 +++ TODO 2008-08-16 16:58:31 +0000 @@ -28,16 +28,11 @@ Text needed *** SEE ALSO Explaining test on what you can read -** Support in configuration file for environment variables ** Keydir move: /etc/mandos -> /etc/keys/mandos Must create in preinst if not pre-depending on cryptsetup * Password-request ** [#A] Man page: man8/password-request.8mandos -** Make prompt exactly like the normal prompt - Use environment variables: - "Enter passphrase to unlock the disk $cryptsource ($crypttarget): " - [[file:plugins.d/password-prompt.c::fprintf%20stderr%20s%20Password%20prefix][Here]] ** [#B] Temporarily lower kernel log level for less printouts during sucessfull boot. *** DESCRIPTION @@ -63,6 +58,8 @@ Create this section *** SEE ALSO Refer to mandos-client(8mandos) and password-prompt(8mandos) +*** ENVIRONMENT + Document use of "cryptsource" and "crypttarget". ** IPv4 support ** use strsep instead of strtok? ** Do not depend on GnuPG key rings on disk === modified file 'plugins.d/password-prompt.c' --- plugins.d/password-prompt.c 2008-08-11 16:09:41 +0000 +++ plugins.d/password-prompt.c 2008-08-16 16:58:31 +0000 @@ -36,7 +36,7 @@ #include /* NULL, size_t, ssize_t */ #include /* ssize_t */ #include /* EXIT_SUCCESS, EXIT_FAILURE, - getopt_long */ + getopt_long, getenv() */ #include /* fprintf(), stderr, getline(), stdin, feof(), perror(), fputc(), stdout, getopt_long */ @@ -184,10 +184,28 @@ } if(prefix){ - fprintf(stderr, "%s Password: ", prefix); - } else { - fprintf(stderr, "Password: "); - } + fprintf(stderr, "%s ", prefix); + } + { + const char *cryptsource = getenv("cryptsource"); + const char *crypttarget = getenv("crypttarget"); + const char *const prompt + = "Enter passphrase to unlock the disk"; + if(cryptsource == NULL){ + if(crypttarget == NULL){ + fprintf(stderr, "%s: ", prompt); + } else { + fprintf(stderr, "%s (%s): ", prompt, crypttarget); + } + } else { + if(crypttarget == NULL){ + fprintf(stderr, "%s %s: ", prompt, cryptsource); + } else { + fprintf(stderr, "%s %s (%s): ", prompt, cryptsource, + crypttarget); + } + } + } ret = getline(&buffer, &n, stdin); if (ret > 0){ fprintf(stdout, "%s", buffer);