mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-11 22:52:47 +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_SIG_CREATED,
|
||||||
STATUS_SESSION_KEY,
|
STATUS_SESSION_KEY,
|
||||||
STATUS_NOTATION_NAME,
|
STATUS_NOTATION_NAME,
|
||||||
|
STATUS_NOTATION_FLAGS,
|
||||||
STATUS_NOTATION_DATA,
|
STATUS_NOTATION_DATA,
|
||||||
STATUS_POLICY_URL,
|
STATUS_POLICY_URL,
|
||||||
STATUS_KEY_CREATED,
|
STATUS_KEY_CREATED,
|
||||||
|
@ -520,14 +520,17 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
|
|||||||
letter 'T'.
|
letter 'T'.
|
||||||
|
|
||||||
*** NOTATION_
|
*** NOTATION_
|
||||||
There are actually two related status codes to convey notation
|
There are actually three related status codes to convey notation
|
||||||
data:
|
data:
|
||||||
|
|
||||||
- NOTATION_NAME <name>
|
- NOTATION_NAME <name>
|
||||||
|
- NOTATION_FLAGS <critical> <human_readable>
|
||||||
- NOTATION_DATA <string>
|
- NOTATION_DATA <string>
|
||||||
|
|
||||||
<name> and <string> are %XX escaped; the data may be split among
|
<name> and <string> are %XX escaped. The data may be split among
|
||||||
several NOTATION_DATA lines.
|
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>
|
*** POLICY_URL <string>
|
||||||
Note that URL in <string> is %XX escaped.
|
Note that URL in <string> is %XX escaped.
|
||||||
|
@ -1277,8 +1277,9 @@ sig_to_notation(PKT_signature *sig)
|
|||||||
{
|
{
|
||||||
const byte *p;
|
const byte *p;
|
||||||
size_t len;
|
size_t len;
|
||||||
int seq=0,crit;
|
int seq = 0;
|
||||||
struct notation *list=NULL;
|
int crit;
|
||||||
|
notation_t list = NULL;
|
||||||
|
|
||||||
/* See RFC 4880, 5.2.3.16 for the format of notation data. In
|
/* See RFC 4880, 5.2.3.16 for the format of notation data. In
|
||||||
short, a notation has:
|
short, a notation has:
|
||||||
@ -1323,6 +1324,7 @@ sig_to_notation(PKT_signature *sig)
|
|||||||
n->value=xmalloc(n2+1);
|
n->value=xmalloc(n2+1);
|
||||||
memcpy(n->value,&p[8+n1],n2);
|
memcpy(n->value,&p[8+n1],n2);
|
||||||
n->value[n2]='\0';
|
n->value[n2]='\0';
|
||||||
|
n->flags.human = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* Binary data. */
|
/* Binary data. */
|
||||||
|
@ -401,7 +401,7 @@ void
|
|||||||
show_notation (PKT_signature * sig, int indent, int mode, int which)
|
show_notation (PKT_signature * sig, int indent, int mode, int which)
|
||||||
{
|
{
|
||||||
estream_t fp = mode ? log_get_stream () : es_stdout;
|
estream_t fp = mode ? log_get_stream () : es_stdout;
|
||||||
struct notation *nd, *notations;
|
notation_t nd, notations;
|
||||||
|
|
||||||
if (which == 0)
|
if (which == 0)
|
||||||
which = 3;
|
which = 3;
|
||||||
@ -448,6 +448,10 @@ show_notation (PKT_signature * sig, int indent, int mode, int which)
|
|||||||
{
|
{
|
||||||
write_status_buffer (STATUS_NOTATION_NAME,
|
write_status_buffer (STATUS_NOTATION_NAME,
|
||||||
nd->name, strlen (nd->name), 0);
|
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,
|
write_status_buffer (STATUS_NOTATION_DATA,
|
||||||
nd->value, strlen (nd->value), 50);
|
nd->value, strlen (nd->value), 50);
|
||||||
}
|
}
|
||||||
|
@ -531,12 +531,14 @@ struct notation
|
|||||||
/* The notation's name. */
|
/* The notation's name. */
|
||||||
char *name;
|
char *name;
|
||||||
/* If the notation is human readable, then the value is stored here
|
/* 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;
|
char *value;
|
||||||
/* Sometimes we want to %-expand the value. In these cases, we save
|
/* Sometimes we want to %-expand the value. In these cases, we save
|
||||||
that transformed value here. */
|
that transformed value here. */
|
||||||
char *altvalue;
|
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. */
|
here. */
|
||||||
unsigned char *bdat;
|
unsigned char *bdat;
|
||||||
/* The amount of data stored in BDAT.
|
/* The amount of data stored in BDAT.
|
||||||
@ -552,6 +554,8 @@ struct notation
|
|||||||
{
|
{
|
||||||
/* The notation is critical. */
|
/* The notation is critical. */
|
||||||
unsigned int critical:1;
|
unsigned int critical:1;
|
||||||
|
/* The notation is human readable. */
|
||||||
|
unsigned int human:1;
|
||||||
/* The notation should be deleted. */
|
/* The notation should be deleted. */
|
||||||
unsigned int ignore:1;
|
unsigned int ignore:1;
|
||||||
} flags;
|
} flags;
|
||||||
@ -559,6 +563,7 @@ struct notation
|
|||||||
/* A field to facilitate creating a list of notations. */
|
/* A field to facilitate creating a list of notations. */
|
||||||
struct notation *next;
|
struct notation *next;
|
||||||
};
|
};
|
||||||
|
typedef struct notation *notation_t;
|
||||||
|
|
||||||
/*-- mainproc.c --*/
|
/*-- mainproc.c --*/
|
||||||
void reset_literals_seen(void);
|
void reset_literals_seen(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user