aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-03-24 04:54:58 +0000
committerDavid Shaw <[email protected]>2002-03-24 04:54:58 +0000
commitff8460f20d69269d53e70cb955a17bb87ce5b5cb (patch)
treeb322616135988dc737f0839ef9fbfd37e7745b51
parentAdd some comments (diff)
downloadgnupg-ff8460f20d69269d53e70cb955a17bb87ce5b5cb.tar.gz
gnupg-ff8460f20d69269d53e70cb955a17bb87ce5b5cb.zip
Minor tweak to importing to allow more non-signed uids (now that
--allow-non-selfsigned-uid allows for completey unsigned uids). Do not choose an attribute packet (i.e. photo) as primary uid. This prevents oddities like "Good signature from [image of size 2671]". This is still not perfect (one can still select an attribute packet as primary in --edit), but is closer to the way the draft is going. The algorithms list should include #110. --pgp2 implies --no-ask-sig-expire and --no-ask-cert-expire as those would cause a v4 sig/cert. Be more lenient in what constitutes a valid armor header (i.e. -----BEGIN blah blah-----) as some Windows programs seem to add spaces at the end. --openpgp makes it strict again
-rw-r--r--g10/ChangeLog21
-rw-r--r--g10/armor.c8
-rw-r--r--g10/g10.c6
-rw-r--r--g10/getkey.c10
-rw-r--r--g10/import.c11
5 files changed, 40 insertions, 16 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 04c149083..a170c915d 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,24 @@
+2002-03-23 David Shaw <[email protected]>
+
+ * import.c (append_uid, merge_sigs): it is okay to import
+ completely non-signed uids now (with --allow-non-selfsigned-uid).
+
+ * getkey.c (get_primary_uid, merge_selfsigs_main): do not choose
+ an attribute packet (i.e. photo) as primary uid. This prevents
+ oddities like "Good signature from [image of size 2671]". This is
+ still not perfect (one can still select an attribute packet as
+ primary in --edit), but is closer to the way the draft is going.
+
+ * g10.c (build_list): algorithms should include 110.
+
+ * g10.c (main): --pgp2 implies --no-ask-sig-expire and
+ --no-ask-cert-expire as those would cause a v4 sig/cert.
+
+ * armor.c (is_armor_header): be more lenient in what constitutes a
+ valid armor header (i.e. -----BEGIN blah blah-----) as some
+ Windows programs seem to add spaces at the end. --openpgp makes
+ it strict again.
+
2002-03-18 David Shaw <[email protected]>
* keyserver.c (keyserver_search_prompt): Properly handle a "no
diff --git a/g10/armor.c b/g10/armor.c
index 1729217a5..da08acf85 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -287,6 +287,14 @@ is_armor_header( byte *line, unsigned len )
return -1;
save_p = p;
p += 5;
+
+ /* Some mail programs on Windows seem to add spaces to the end of
+ the line. This becomes strict if --openpgp is set. */
+
+ if(!opt.rfc2440)
+ while(*p==' ')
+ p++;
+
if( *p == '\r' )
p++;
if( *p == '\n' )
diff --git a/g10/g10.c b/g10/g10.c
index c2c35da8a..22acf8897 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -616,11 +616,11 @@ build_list( const char *text, const char * (*mapf)(int), int (*chkf)(int) )
if( maybe_setuid )
secmem_init( 0 ); /* drop setuid */
- for(i=1; i < 110; i++ )
+ for(i=1; i <= 110; i++ )
if( !chkf(i) && (s=mapf(i)) )
n += strlen(s) + 2;
list = m_alloc( 21 + n ); *list = 0;
- for(p=NULL, i=1; i < 110; i++ ) {
+ for(p=NULL, i=1; i <= 110; i++ ) {
if( !chkf(i) && (s=mapf(i)) ) {
if( !p )
p = stpcpy( list, text );
@@ -1416,6 +1416,8 @@ main( int argc, char **argv )
opt.escape_from = 1;
opt.force_v3_sigs = 1;
opt.pgp2_workarounds = 1;
+ opt.ask_sig_expire = 0;
+ opt.ask_cert_expire = 0;
m_free(def_digest_string);
def_digest_string = m_strdup("md5");
opt.def_compress_algo = 1;
diff --git a/g10/getkey.c b/g10/getkey.c
index 337a0369a..901ea9b00 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -176,6 +176,7 @@ get_primary_uid ( KBNODE keyblock, size_t *uidlen )
for (k=keyblock; k; k=k->next ) {
if ( k->pkt->pkttype == PKT_USER_ID
+ && !k->pkt->pkt.user_id->attrib_data
&& k->pkt->pkt.user_id->is_primary ) {
*uidlen = k->pkt->pkt.user_id->len;
return k->pkt->pkt.user_id->name;
@@ -1429,7 +1430,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
uiddate = uiddate2 = 0;
uidnode = uidnode2 = NULL;
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next ) {
- if ( k->pkt->pkttype == PKT_USER_ID ) {
+ 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;
@@ -1444,7 +1446,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
if ( uidnode ) {
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
k = k->next ) {
- if ( k->pkt->pkttype == PKT_USER_ID ) {
+ if ( k->pkt->pkttype == PKT_USER_ID &&
+ !k->pkt->pkt.user_id->attrib_data) {
PKT_user_id *uid = k->pkt->pkt.user_id;
if ( k != uidnode )
uid->is_primary = 0;
@@ -1464,7 +1467,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
k = k->next )
{
- if(k->pkt->pkttype==PKT_USER_ID)
+ if(k->pkt->pkttype==PKT_USER_ID &&
+ !k->pkt->pkt.user_id->attrib_data)
{
k->pkt->pkt.user_id->is_primary=1;
break;
diff --git a/g10/import.c b/g10/import.c
index fff54eedb..8281d00e8 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -1338,11 +1338,6 @@ append_uid( KBNODE keyblock, KBNODE node, int *n_sigs,
KBNODE n, n_where=NULL;
assert(node->pkt->pkttype == PKT_USER_ID );
- if( !node->next || node->next->pkt->pkttype == PKT_USER_ID ) {
- log_error( _("key %08lX: our copy has no self-signature\n"),
- (ulong)keyid[1]);
- return G10ERR_GENERAL;
- }
/* find the position */
for( n = keyblock; n; n_where = n, n = n->next ) {
@@ -1391,12 +1386,6 @@ merge_sigs( KBNODE dst, KBNODE src, int *n_sigs,
assert(dst->pkt->pkttype == PKT_USER_ID );
assert(src->pkt->pkttype == PKT_USER_ID );
- if( !dst->next || dst->next->pkt->pkttype == PKT_USER_ID ) {
- log_error( _("key %08lX: our copy has no self-signature\n"),
- (ulong)keyid[1]);
- return 0;
- }
-
for(n=src->next; n && n->pkt->pkttype != PKT_USER_ID; n = n->next ) {
if( n->pkt->pkttype != PKT_SIGNATURE )