summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-05-31 15:43:51 +0200
committerWerner Koch <wk@gnupg.org>2016-05-31 15:51:18 +0200
commit67a4bc8d536f6997f14daff4c039abd48a172100 (patch)
tree743e50929a97c4d54e0ea13a5b2b15fa79f76a07 /g10
parentbuild: Fix URL. (diff)
downloadgnupg2-67a4bc8d536f6997f14daff4c039abd48a172100.tar.xz
gnupg2-67a4bc8d536f6997f14daff4c039abd48a172100.zip
gpg: New status code NOTATION_FLAGS.
* common/status.h (STATUS_NOTATION_FLAGS: New. * g10/packet.h (struct notation): Add flags.human. (notation_t): New typedef. * g10/build-packet.c (sig_to_notation): Set flags.human. * g10/keylist.c (show_notation): Write STATUS_NOTATION_FLAGS.
Diffstat (limited to 'g10')
-rw-r--r--g10/build-packet.c6
-rw-r--r--g10/keylist.c6
-rw-r--r--g10/packet.h9
3 files changed, 16 insertions, 5 deletions
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 9b6496766..4bfc2ac10 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -1277,8 +1277,9 @@ sig_to_notation(PKT_signature *sig)
{
const byte *p;
size_t len;
- int seq=0,crit;
- struct notation *list=NULL;
+ int seq = 0;
+ int crit;
+ notation_t list = NULL;
/* See RFC 4880, 5.2.3.16 for the format of notation data. In
short, a notation has:
@@ -1323,6 +1324,7 @@ sig_to_notation(PKT_signature *sig)
n->value=xmalloc(n2+1);
memcpy(n->value,&p[8+n1],n2);
n->value[n2]='\0';
+ n->flags.human = 1;
}
else
/* Binary data. */
diff --git a/g10/keylist.c b/g10/keylist.c
index cbde0bb72..2a1ef2e12 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -401,7 +401,7 @@ void
show_notation (PKT_signature * sig, int indent, int mode, int which)
{
estream_t fp = mode ? log_get_stream () : es_stdout;
- struct notation *nd, *notations;
+ notation_t nd, notations;
if (which == 0)
which = 3;
@@ -448,6 +448,10 @@ show_notation (PKT_signature * sig, int indent, int mode, int which)
{
write_status_buffer (STATUS_NOTATION_NAME,
nd->name, strlen (nd->name), 0);
+ if (nd->flags.critical || nd->flags.human)
+ write_status_text (STATUS_NOTATION_FLAGS,
+ nd->flags.critical && nd->flags.human? "1 1" :
+ nd->flags.critical? "1 0" : "0 1");
write_status_buffer (STATUS_NOTATION_DATA,
nd->value, strlen (nd->value), 50);
}
diff --git a/g10/packet.h b/g10/packet.h
index 194c13442..6ea2f8314 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -531,12 +531,14 @@ struct notation
/* The notation's name. */
char *name;
/* If the notation is human readable, then the value is stored here
- as a NUL-terminated string. */
+ as a NUL-terminated string. If it is not human readable a human
+ readable approximation of the binary value _may_ be stored
+ here. */
char *value;
/* Sometimes we want to %-expand the value. In these cases, we save
that transformed value here. */
char *altvalue;
- /* If the notation is not human readable, then the value is strored
+ /* If the notation is not human readable, then the value is stored
here. */
unsigned char *bdat;
/* The amount of data stored in BDAT.
@@ -552,6 +554,8 @@ struct notation
{
/* The notation is critical. */
unsigned int critical:1;
+ /* The notation is human readable. */
+ unsigned int human:1;
/* The notation should be deleted. */
unsigned int ignore:1;
} flags;
@@ -559,6 +563,7 @@ struct notation
/* A field to facilitate creating a list of notations. */
struct notation *next;
};
+typedef struct notation *notation_t;
/*-- mainproc.c --*/
void reset_literals_seen(void);