aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/gpgv.c7
-rw-r--r--g10/keylist.c35
-rw-r--r--g10/main.h1
-rw-r--r--g10/mainproc.c1
-rw-r--r--g10/options.h1
5 files changed, 45 insertions, 0 deletions
diff --git a/g10/gpgv.c b/g10/gpgv.c
index 6d3d25f50..686fc8891 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -58,6 +58,7 @@ enum cmd_and_opt_values {
oQuiet = 'q',
oVerbose = 'v',
oOutput = 'o',
+ oPrintNotation = 'N',
oBatch = 500,
oKeyring,
oIgnoreTimeConflict,
@@ -91,6 +92,8 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_s (oWeakDigest, "weak-digest",
N_("|ALGO|reject signatures made with ALGO")),
ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"),
+ ARGPARSE_s_s (oPrintNotation, "print-notation",
+ N_("|NAME|print the notation NAME to stdout")),
ARGPARSE_s_s (oDebug, "debug", "@"),
ARGPARSE_s_s (oAssertPubkeyAlgo,"assert-pubkey-algo", "@"),
@@ -267,6 +270,10 @@ main( int argc, char **argv )
}
break;
+ case oPrintNotation:
+ append_to_strlist (&opt.print_notations, pargs.r.ret_str);
+ break;
+
default : pargs.err = ARGPARSE_PRINT_ERROR; break;
}
}
diff --git a/g10/keylist.c b/g10/keylist.c
index 1c531126f..42e9f65f5 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -709,6 +709,41 @@ show_notation (PKT_signature * sig, int indent, int mode, int which)
}
+/* Output all the notation data in SIG matching a name given by
+ * --print-notation to stdout. */
+void
+print_matching_notations (PKT_signature *sig)
+{
+ notation_t nd, notations;
+ strlist_t sl;
+ const char *s;
+
+ if (!opt.print_notations)
+ return;
+
+ notations = sig_to_notation (sig);
+ for (nd = notations; nd; nd = nd->next)
+ {
+ for (sl=opt.print_notations; sl; sl = sl->next)
+ if (!strcmp (sl->d, nd->name))
+ break;
+ if (!sl || !*nd->value)
+ continue;
+ es_fprintf (es_stdout, "%s: ", nd->name);
+ for (s = nd->value; *s; s++)
+ {
+ if (*s == '\n')
+ es_fprintf (es_stdout, "\n%*s", (int)strlen (nd->name)+2, "");
+ else if (*s >= ' ' || *s != '\t')
+ es_putc (*s, es_stdout);
+ }
+ es_putc ('\n', es_stdout);
+ }
+
+ free_notation (notations);
+}
+
+
static void
print_signature_stats (struct keylist_context *s)
{
diff --git a/g10/main.h b/g10/main.h
index c0a3d5fa2..5d96b5e27 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -488,6 +488,7 @@ void show_preferences (PKT_user_id *uid, int indent, int mode, int verbose);
void show_policy_url(PKT_signature *sig,int indent,int mode);
void show_keyserver_url(PKT_signature *sig,int indent,int mode);
void show_notation(PKT_signature *sig,int indent,int mode,int which);
+void print_matching_notations (PKT_signature *sig);
void dump_attribs (const PKT_user_id *uid, PKT_public_key *pk);
void set_attrib_fd(int fd);
void print_key_info (ctrl_t ctrl, estream_t fp, int indent,
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 22d12799d..5a7961099 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -2497,6 +2497,7 @@ check_sig_and_print (CTX c, kbnode_t node)
));
else
show_notation (sig, 0, 2, 0);
+ print_matching_notations (sig);
}
/* Fill PKSTRBUF with the algostring in case we later need it. */
diff --git a/g10/options.h b/g10/options.h
index cd5c19f45..28fc2207a 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -214,6 +214,7 @@ struct
int no_encrypt_to;
int encrypt_to_default_key;
int interactive;
+ strlist_t print_notations; /* Name of notations to print. */
struct notation *sig_notations;
struct notation *cert_notations;
strlist_t sig_policy_url;