~ubuntu-branches/ubuntu/hardy/gnupg/hardy-updates

« back to all changes in this revision

Viewing changes to g10/parse-packet.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-16 16:57:39 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20051216165739-v0m2d1you6hd8jho
Tags: upstream-1.4.2
ImportĀ upstreamĀ versionĀ 1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* parse-packet.c  - read packets
2
 
 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
3
 
 *               2004, 2005 Free Software Foundation, Inc.
 
2
 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 
3
 *               2005 Free Software Foundation, Inc.
4
4
 *
5
5
 * This file is part of GnuPG.
6
6
 *
16
16
 *
17
17
 * You should have received a copy of the GNU General Public License
18
18
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
20
 * USA.
20
21
 */
21
22
 
22
23
#include <config.h>
1016
1017
        break;
1017
1018
      return 0;
1018
1019
    case SIGSUBPKT_NOTATION:
1019
 
      if( n < 8 ) /* minimum length needed */
 
1020
      /* minimum length needed, and the subpacket must be well-formed
 
1021
         where the name length and value length all fit inside the
 
1022
         packet. */
 
1023
      if(n<8 || 8+((buffer[4]<<8)|buffer[5])+((buffer[6]<<8)|buffer[7]) != n)
1020
1024
        break;
1021
1025
      return 0;
1022
1026
    case SIGSUBPKT_PRIMARY_UID:
1032
1036
  return -2;
1033
1037
}
1034
1038
 
 
1039
/* Not many critical notations we understand yet... */
 
1040
static int
 
1041
can_handle_critical_notation(const byte *name,size_t len)
 
1042
{
 
1043
  if(len==32 && memcmp(name,"preferred-email-encoding@pgp.com",32)==0)
 
1044
    return 1;
 
1045
 
 
1046
  return 0;
 
1047
}
1035
1048
 
1036
1049
static int
1037
1050
can_handle_critical( const byte *buffer, size_t n, int type )
1039
1052
  switch( type )
1040
1053
    {
1041
1054
    case SIGSUBPKT_NOTATION:
1042
 
      if( n >= 8 && (*buffer & 0x80) )
1043
 
        return 1; /* human readable is handled */
1044
 
      return 0;
1045
 
 
 
1055
      if(n>=8)
 
1056
        return can_handle_critical_notation(buffer+8,(buffer[4]<<8)|buffer[5]);
 
1057
      else
 
1058
        return 0;
1046
1059
    case SIGSUBPKT_SIGNATURE:
1047
1060
    case SIGSUBPKT_SIG_CREATED:
1048
1061
    case SIGSUBPKT_SIG_EXPIRE:
1324
1337
        if(p)
1325
1338
          sig->timestamp = buffer_to_u32(p);
1326
1339
        else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110))
1327
 
          log_error("signature packet without timestamp\n");
 
1340
          log_info ("signature packet without timestamp\n");
1328
1341
 
1329
1342
        p = parse_sig_subpkt2( sig, SIGSUBPKT_ISSUER, NULL );
1330
1343
        if(p)
1333
1346
            sig->keyid[1] = buffer_to_u32(p+4);
1334
1347
          }
1335
1348
        else if(!(sig->pubkey_algo>=100 && sig->pubkey_algo<=110))
1336
 
          log_error("signature packet without keyid\n");
 
1349
          log_info ("signature packet without keyid\n");
1337
1350
 
1338
1351
        p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_SIG_EXPIRE,NULL);
1339
1352
        if(p)