/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/password-prompt.c

  • Committer: Teddy Hogeborn
  • Date: 2009-10-30 16:23:43 UTC
  • Revision ID: teddy@fukt.bsnet.se-20091030162343-1p2a8bf3gc084kc9
* plugins.d/password-prompt.c: Use environment variables and prompt
                               text from cryptsetup 1.1.
* plugins.d/password-prompt.xml (ENVIRONMENT): Document change in
                                               environment variables
                                               used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
258
258
      fprintf(stderr, "%s ", prefix);
259
259
    }
260
260
    {
261
 
      const char *cryptsource = getenv("cryptsource");
262
 
      const char *crypttarget = getenv("crypttarget");
263
 
      const char *const prompt
264
 
        = "Enter passphrase to unlock the disk";
 
261
      const char *cryptsource = getenv("CRYPTTAB_SOURCE");
 
262
      const char *crypttarget = getenv("CRYPTTAB_NAME");
 
263
      /* Before cryptsetup 1.1.0~rc2 */
 
264
      if(cryptsource == NULL){
 
265
        cryptsource = getenv("cryptsource");
 
266
      }
 
267
      if(crypttarget == NULL){
 
268
        crypttarget = getenv("crypttarget");
 
269
      }
 
270
      const char *const prompt1 = "Unlocking the disk";
 
271
      const char *const prompt2 = "Enter passphrase";
265
272
      if(cryptsource == NULL){
266
273
        if(crypttarget == NULL){
267
 
          fprintf(stderr, "%s: ", prompt);
 
274
          fprintf(stderr, "%s to unlock the disk: ", prompt2);
268
275
        } else {
269
 
          fprintf(stderr, "%s (%s): ", prompt, crypttarget);
 
276
          fprintf(stderr, "%s (%s)\n%s: ", prompt1, crypttarget,
 
277
                  prompt2);
270
278
        }
271
279
      } else {
272
280
        if(crypttarget == NULL){
273
 
          fprintf(stderr, "%s %s: ", prompt, cryptsource);
 
281
          fprintf(stderr, "%s %s\n%s: ", prompt1, cryptsource,
 
282
                  prompt2);
274
283
        } else {
275
 
          fprintf(stderr, "%s %s (%s): ", prompt, cryptsource,
276
 
                  crypttarget);
 
284
          fprintf(stderr, "%s %s (%s)\n%s: ", prompt1, cryptsource,
 
285
                  crypttarget, prompt2);
277
286
        }
278
287
      }
279
288
    }