From 889c4afd78cad05978209cc8ee70df63fc419d1c Mon Sep 17 00:00:00 2001 From: David Shaw Date: Wed, 8 Mar 2006 23:42:45 +0000 Subject: [PATCH] * packet.h, build-packet.c (sig_to_notation), keygen.c (keygen_add_notations): Tweak to handle non-human-readable notation values. --- g10/ChangeLog | 4 ++++ g10/build-packet.c | 10 +++++----- g10/keygen.c | 5 ++++- g10/packet.h | 2 ++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index cdd772235..421891dac 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,9 @@ 2006-03-08 David Shaw + * packet.h, build-packet.c (sig_to_notation), keygen.c + (keygen_add_notations): Tweak to handle non-human-readable + notation values. + * options.h, sign.c (mk_notation_policy_etc), gpg.c (add_notation_data): Use it here for the various notation commands. diff --git a/g10/build-packet.c b/g10/build-packet.c index 1ceac358d..ea8a40041 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -1000,18 +1000,18 @@ sig_to_notation(PKT_signature *sig) if(p[0]&0x80) { + n->flags.human=1; n->value=xmalloc(n2+1); - memcpy(n->value,&p[8+n1],n2); n->value[n2]='\0'; } else { - n->value=xmalloc(2+strlen(_("not human readable"))+2+1); - strcpy(n->value,"[ "); - strcat(n->value,_("not human readable")); - strcat(n->value," ]"); + n->value=xmalloc(n2); + n->blen=n2; } + memcpy(n->value,&p[8+n1],n2); + n->flags.critical=crit; n->next=list; diff --git a/g10/keygen.c b/g10/keygen.c index ba7616bf3..0ef2499b6 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -708,12 +708,15 @@ keygen_add_notations(PKT_signature *sig,void *opaque) n1=strlen(notation->name); if(notation->altvalue) n2=strlen(notation->altvalue); + else if(!notation->flags.human) + n2=notation->blen; else n2=strlen(notation->value); buf = xmalloc( 8 + n1 + n2 ); - buf[0] = 0x80; /* human readable */ + /* human readable or not */ + buf[0] = notation->flags.human?0x80:0; buf[1] = buf[2] = buf[3] = 0; buf[4] = n1 >> 8; buf[5] = n1; diff --git a/g10/packet.h b/g10/packet.h index c40f2f123..7e0f9d0ac 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -411,10 +411,12 @@ struct notation { char *name; char *value; + size_t blen; char *altvalue; struct { unsigned int critical:1; + unsigned int human:1; unsigned int ignore:1; } flags; struct notation *next;