mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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.
This commit is contained in:
parent
903328a3ef
commit
67a4bc8d53
@ -96,6 +96,7 @@ enum
|
||||
STATUS_SIG_CREATED,
|
||||
STATUS_SESSION_KEY,
|
||||
STATUS_NOTATION_NAME,
|
||||
STATUS_NOTATION_FLAGS,
|
||||
STATUS_NOTATION_DATA,
|
||||
STATUS_POLICY_URL,
|
||||
STATUS_KEY_CREATED,
|
||||
|
@ -520,14 +520,17 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
|
||||
letter 'T'.
|
||||
|
||||
*** NOTATION_
|
||||
There are actually two related status codes to convey notation
|
||||
There are actually three related status codes to convey notation
|
||||
data:
|
||||
|
||||
- NOTATION_NAME <name>
|
||||
- NOTATION_FLAGS <critical> <human_readable>
|
||||
- NOTATION_DATA <string>
|
||||
|
||||
<name> and <string> are %XX escaped; the data may be split among
|
||||
several NOTATION_DATA lines.
|
||||
<name> and <string> are %XX escaped. The data may be split among
|
||||
several NOTATION_DATA lines. NOTATION_FLAGS is emitted after
|
||||
NOTATION_NAME and gives the critical and human readable flags;
|
||||
the flag values are either 0 or 1.
|
||||
|
||||
*** POLICY_URL <string>
|
||||
Note that URL in <string> is %XX escaped.
|
||||
|
@ -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. */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user