mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
* parse-packet.c (parse_key): Clear disabled flag when parsing a new key.
Just in case someone forgets to clear the whole key. * getkey.c (merge_selfsigs_main): Add an "if all else fails" path for setting a single user ID primary when there are multiple set primaries all at the same second, or no primaries set and the most recent user IDs are at the same second, or no signed user IDs at all. This is arbitrary, but deterministic. * exec.h, photoid.h: Add copyright message.
This commit is contained in:
parent
c28abad3b6
commit
020ace9330
@ -1,3 +1,16 @@
|
||||
2003-05-11 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* parse-packet.c (parse_key): Clear disabled flag when parsing a
|
||||
new key. Just in case someone forgets to clear the whole key.
|
||||
|
||||
* getkey.c (merge_selfsigs_main): Add an "if all else fails" path
|
||||
for setting a single user ID primary when there are multiple set
|
||||
primaries all at the same second, or no primaries set and the most
|
||||
recent user IDs are at the same second, or no signed user IDs at
|
||||
all. This is arbitrary, but deterministic.
|
||||
|
||||
* exec.h, photoid.h: Add copyright message.
|
||||
|
||||
2003-05-09 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* g10.c (main): New --gnupg option to disable the various
|
||||
|
20
g10/exec.h
20
g10/exec.h
@ -1,3 +1,23 @@
|
||||
/* exec.h
|
||||
* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#ifndef _EXEC_H_
|
||||
#define _EXEC_H_
|
||||
|
||||
|
80
g10/getkey.c
80
g10/getkey.c
@ -1,5 +1,6 @@
|
||||
/* getkey.c - Get a key from the database
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
||||
* 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -1331,7 +1332,6 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode, u32 keycreated )
|
||||
p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n);
|
||||
if (p && n && (p[0] & 0x01))
|
||||
uid->mdc_feature = 1;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1694,14 +1694,38 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
||||
if ( k->pkt->pkttype == PKT_USER_ID &&
|
||||
!k->pkt->pkt.user_id->attrib_data) {
|
||||
PKT_user_id *uid = k->pkt->pkt.user_id;
|
||||
if ( uid->is_primary && uid->created > uiddate ) {
|
||||
uiddate = uid->created;
|
||||
uidnode = k;
|
||||
}
|
||||
if ( !uid->is_primary && uid->created > uiddate2 ) {
|
||||
uiddate2 = uid->created;
|
||||
uidnode2 = k;
|
||||
}
|
||||
if (uid->is_primary)
|
||||
{
|
||||
if(uid->created > uiddate)
|
||||
{
|
||||
uiddate = uid->created;
|
||||
uidnode = k;
|
||||
}
|
||||
else if(uid->created==uiddate && uidnode)
|
||||
{
|
||||
/* The dates are equal, so we need to do a
|
||||
different (and arbitrary) comparison. This
|
||||
should rarely, if ever, happen. It's good to
|
||||
try and guarantee that two different GnuPG
|
||||
users with two different keyrings at least pick
|
||||
the same primary. */
|
||||
if(cmp_user_ids(uid,uidnode->pkt->pkt.user_id)>0)
|
||||
uidnode=k;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(uid->created > uiddate2)
|
||||
{
|
||||
uiddate2 = uid->created;
|
||||
uidnode2 = k;
|
||||
}
|
||||
else if(uid->created==uiddate2 && uidnode2)
|
||||
{
|
||||
if(cmp_user_ids(uid,uidnode2->pkt->pkt.user_id)>0)
|
||||
uidnode2=k;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( uidnode ) {
|
||||
@ -1716,23 +1740,43 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
|
||||
}
|
||||
}
|
||||
else if( uidnode2 ) {
|
||||
/* none is flagged primary - use the latest user ID we have */
|
||||
/* none is flagged primary - use the latest user ID we have,
|
||||
and disambiguate with the arbitrary packet comparison. */
|
||||
uidnode2->pkt->pkt.user_id->is_primary = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* None of our uids were self-signed, so pick the first one to
|
||||
be the primary. This is the best we can do here since
|
||||
there are no self sigs to date the uids. */
|
||||
/* None of our uids were self-signed, so pick the one that
|
||||
sorts first to be the primary. This is the best we can do
|
||||
here since there are no self sigs to date the uids. */
|
||||
|
||||
uidnode = NULL;
|
||||
|
||||
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
|
||||
k = k->next )
|
||||
{
|
||||
if(k->pkt->pkttype==PKT_USER_ID &&
|
||||
!k->pkt->pkt.user_id->attrib_data)
|
||||
if(k->pkt->pkttype==PKT_USER_ID
|
||||
&& !k->pkt->pkt.user_id->attrib_data)
|
||||
{
|
||||
k->pkt->pkt.user_id->is_primary=1;
|
||||
break;
|
||||
if(!uidnode)
|
||||
{
|
||||
uidnode=k;
|
||||
uidnode->pkt->pkt.user_id->is_primary=1;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cmp_user_ids(k->pkt->pkt.user_id,
|
||||
uidnode->pkt->pkt.user_id)>0)
|
||||
{
|
||||
uidnode->pkt->pkt.user_id->is_primary=0;
|
||||
uidnode=k;
|
||||
uidnode->pkt->pkt.user_id->is_primary=1;
|
||||
}
|
||||
else
|
||||
k->pkt->pkt.user_id->is_primary=0; /* just to be
|
||||
safe */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* parse-packet.c - read packets
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002,
|
||||
* 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -1521,6 +1522,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
|
||||
pk->req_usage = 0;
|
||||
pk->pubkey_usage = 0; /* not yet used */
|
||||
pk->is_revoked = 0;
|
||||
pk->is_disabled = 0;
|
||||
pk->keyid[0] = 0;
|
||||
pk->keyid[1] = 0;
|
||||
}
|
||||
|
@ -1,3 +1,23 @@
|
||||
/* photoid.h
|
||||
* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
* GnuPG is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GnuPG is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
/* Photo ID functions */
|
||||
|
||||
#ifndef _PHOTOID_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user