/mandos/release

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

« back to all changes in this revision

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

merge
new approve/deny functionallity in mandos-monitor

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
                                */
47
47
#include <iso646.h>             /* or, not */
48
48
#include <stdbool.h>            /* bool, false, true */
49
 
#include <string.h>             /* strlen, rindex, strncmp, strcmp */
 
49
#include <string.h>             /* strlen, rindex */
50
50
#include <argp.h>               /* struct argp_option, struct
51
51
                                   argp_state, struct argp,
52
52
                                   argp_parse(), error_t,
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
    }