~ubuntu-branches/ubuntu/feisty/gnupg2/feisty

« back to all changes in this revision

Viewing changes to g10/getkey.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2006-11-24 18:48:23 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20061124184823-17ir9m46tl09n9k4
Tags: 2.0.0-4ubuntu1
* Synchronize to Debian, reapply remaining Ubuntu changes to pristine Debian
  version:
  - Remove libpcsclite-dev, libopensc2-dev build dependencies (they are in
    universe).

Show diffs side-by-side

added added

removed removed

Lines of Context:
578
578
 *   Words are delimited by white space or "()<>[]{}.@-+_,;/&!"
579
579
 *   (note that you can't search for these characters). Compare
580
580
 *   is not case sensitive.
 
581
 * - If the userid starts with a '&' a 40 hex digits keygrip is expected.
581
582
 */
582
583
 
583
584
int
644
645
#endif
645
646
 
646
647
        case '#':  /* local user id */
647
 
            return 0; /* This is now obsolete and van't not be used anymore*/
 
648
            return 0; /* This is now obsolete and can't not be used anymore*/
648
649
        
649
650
        case ':': /*Unified fingerprint */
650
651
            {  
669
670
            } 
670
671
            break;
671
672
           
 
673
        case '&':  /* keygrip */
 
674
          return 0; /* Not yet implememted. */
 
675
 
672
676
        default:
673
677
            if (s[0] == '0' && s[1] == 'x') {
674
678
                hexprefix = 1;
808
812
 */
809
813
 
810
814
static int
811
 
key_byname( GETKEY_CTX *retctx, STRLIST namelist,
 
815
key_byname( GETKEY_CTX *retctx, strlist_t namelist,
812
816
            PKT_public_key *pk, PKT_secret_key *sk,
813
817
            int secmode, int include_unusable,
814
818
            KBNODE *ret_kb, KEYDB_HANDLE *ret_kdbhd )
815
819
{
816
820
    int rc = 0;
817
821
    int n;
818
 
    STRLIST r;
 
822
    strlist_t r;
819
823
    GETKEY_CTX ctx;
820
824
    KBNODE help_kb = NULL;
821
825
    
919
923
                   KEYDB_HANDLE *ret_kdbhd, int include_unusable )
920
924
{
921
925
  int rc;
922
 
  STRLIST namelist = NULL;
 
926
  strlist_t namelist = NULL;
923
927
 
924
928
  add_to_strlist( &namelist, name );
925
929
 
935
939
 
936
940
      for(akl=opt.auto_key_locate;akl;akl=akl->next)
937
941
        {
938
 
          unsigned char *fpr;
 
942
          unsigned char *fpr=NULL;
939
943
          size_t fpr_len;
940
944
 
941
945
          switch(akl->type)
1044
1048
 
1045
1049
int
1046
1050
get_pubkey_bynames( GETKEY_CTX *retctx, PKT_public_key *pk,
1047
 
                    STRLIST names, KBNODE *ret_keyblock )
 
1051
                    strlist_t names, KBNODE *ret_keyblock )
1048
1052
{
1049
1053
    return key_byname( retctx, names, pk, NULL, 0, 1, ret_keyblock, NULL);
1050
1054
}
1195
1199
                    PKT_secret_key *sk, const char *name, int unprotect,
1196
1200
                    KBNODE *retblock )
1197
1201
{
1198
 
  STRLIST namelist = NULL;
 
1202
  strlist_t namelist = NULL;
1199
1203
  int rc,include_unusable=1;
1200
1204
 
1201
1205
  /* If we have no name, try to use the default secret key.  If we
1228
1232
 
1229
1233
int
1230
1234
get_seckey_bynames( GETKEY_CTX *retctx, PKT_secret_key *sk,
1231
 
                    STRLIST names, KBNODE *ret_keyblock )
 
1235
                    strlist_t names, KBNODE *ret_keyblock )
1232
1236
{
1233
1237
    return key_byname( retctx, names, NULL, sk, 1, 1, ret_keyblock, NULL );
1234
1238
}
1507
1511
    /* store the key flags in the helper variable for later processing */
1508
1512
    uid->help_key_usage=parse_key_usage(sig);
1509
1513
 
1510
 
    /* ditto or the key expiration */
1511
 
    uid->help_key_expire = 0;
 
1514
    /* ditto for the key expiration */
1512
1515
    p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
1513
 
    if ( p ) { 
1514
 
        uid->help_key_expire = keycreated + buffer_to_u32(p);
1515
 
    }
 
1516
    if( p && buffer_to_u32(p) )
 
1517
      uid->help_key_expire = keycreated + buffer_to_u32(p);
 
1518
    else
 
1519
      uid->help_key_expire = 0;
1516
1520
 
1517
1521
    /* Set the primary user ID flag - we will later wipe out some
1518
1522
     * of them to only have one in our keyblock */
1724
1728
        key_usage=parse_key_usage(sig);
1725
1729
 
1726
1730
        p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
1727
 
        if ( p )
 
1731
        if( p && buffer_to_u32(p) )
1728
1732
          {
1729
1733
            key_expire = keytimestamp + buffer_to_u32(p);
1730
1734
            key_expire_seen = 1;
2128
2132
    subpk->pubkey_usage = key_usage;
2129
2133
    
2130
2134
    p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
2131
 
    if ( p ) 
 
2135
    if ( p && buffer_to_u32(p) )
2132
2136
        key_expire = keytimestamp + buffer_to_u32(p);
2133
2137
    else
2134
2138
        key_expire = 0;