~logan/ubuntu/wily/pinentry/0.9.2

« back to all changes in this revision

Viewing changes to pinentry/pinentry.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2010-03-18 23:36:51 UTC
  • mfrom: (1.1.6 upstream) (4.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100318233651-w7bs3r8rdyaa6oty
* New upstream release
* Changed source format to 3.0 (quilt)
* Updated standards version

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* pinentry.c - The PIN entry support library
2
 
   Copyright (C) 2002, 2003, 2007, 2008 g10 Code GmbH
 
2
   Copyright (C) 2002, 2003, 2007, 2008, 2010 g10 Code GmbH
3
3
   
4
4
   This file is part of PINENTRY.
5
5
   
63
63
    0,          /* TTY LC_CTYPE.  */
64
64
    0,          /* TTY LC_MESSAGES.  */
65
65
    0,          /* Debug mode.  */
 
66
#ifdef ENABLE_ENHANCED
66
67
    0,          /* Enhanced mode.  */
 
68
#endif
67
69
    1,          /* Global grab.  */
68
70
    0,          /* Parent Window ID.  */
69
71
    NULL,       /* Touch file.  */
78
80
    PINENTRY_COLOR_DEFAULT,
79
81
    PINENTRY_COLOR_DEFAULT,
80
82
    0,
81
 
    NULL        /* Assuan context.  */
 
83
    NULL,        /* default_ok  */
 
84
    NULL,        /* default_cancel  */
 
85
    NULL,        /* default_prompt  */
 
86
    NULL         /* Assuan context.  */
82
87
  };
83
88
 
84
89
 
396
401
"      --ttytype NAME    Set the tty terminal type\n"
397
402
"      --lc-ctype        Set the tty LC_CTYPE value\n"
398
403
"      --lc-messages     Set the tty LC_MESSAGES value\n"
 
404
#ifdef ENABLE_ENHANCED
399
405
"  -e, --enhanced        Ask for timeout and insurance, too\n"
 
406
#endif
400
407
"  -g, --no-global-grab  Grab keyboard only while window is focused\n"
401
408
"      --parent-wid      Parent window ID (for positioning)\n"
402
409
"  -d, --debug           Turn on debugging output\n"
471
478
     { "ttytype", required_argument,     0, 'N' },
472
479
     { "lc-ctype", required_argument,    0, 'C' },
473
480
     { "lc-messages", required_argument, 0, 'M' },
 
481
#ifdef ENABLE_ENHANCED
474
482
     { "enhanced", no_argument,          0, 'e' },
 
483
#endif
475
484
     { "no-global-grab", no_argument,    0, 'g' },
476
485
     { "parent-wid", required_argument,  0, 'W' },
477
486
     { "colors", required_argument,      0, 'c' },
489
498
        case 'd':
490
499
          pinentry.debug = 1;
491
500
          break;
 
501
#ifdef ENABLE_ENHANCED
492
502
        case 'e':
493
503
          pinentry.enhanced = 1;
494
504
          break;
 
505
#endif
495
506
        case 'g':
496
507
          pinentry.grab = 0;
497
508
          break;
637
648
      if (!pinentry.touch_file)
638
649
        return ASSUAN_Out_Of_Core;
639
650
    }
 
651
  else if (!strcmp (key, "default-ok"))
 
652
    {
 
653
      pinentry.default_ok = strdup (value);
 
654
      if (!pinentry.default_ok)
 
655
        return ASSUAN_Out_Of_Core;
 
656
    }
 
657
  else if (!strcmp (key, "default-cancel"))
 
658
    {
 
659
      pinentry.default_cancel = strdup (value);
 
660
      if (!pinentry.default_cancel)
 
661
        return ASSUAN_Out_Of_Core;
 
662
    }
 
663
  else if (!strcmp (key, "default-prompt"))
 
664
    {
 
665
      pinentry.default_prompt = strdup (value);
 
666
      if (!pinentry.default_prompt)
 
667
        return ASSUAN_Out_Of_Core;
 
668
    }
640
669
  else
641
670
    return ASSUAN_Invalid_Option;
642
671
  return 0;
646
675
/* Note, that it is sufficient to allocate the target string D as
647
676
   long as the source string S, i.e.: strlen(s)+1; */
648
677
static void
649
 
strcpy_escaped (char *d, const unsigned char *s)
 
678
strcpy_escaped (char *d, const char *s)
650
679
{
651
680
  while (*s)
652
681
    {
834
863
    return ASSUAN_Out_Of_Core;
835
864
  if (!pinentry.prompt)
836
865
    {
837
 
      pinentry.prompt = "PIN:";
 
866
      pinentry.prompt = pinentry.default_prompt?pinentry.default_prompt:"PIN:";
838
867
      set_prompt = 1;
839
868
    }
840
869
  pinentry.locale_err = 0;