diff --git a/doc/gpgme.texi b/doc/gpgme.texi index fd396e02..4f899a9e 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -4814,6 +4814,11 @@ set to export session keys (see @code{gpgme_set_ctx_flag, "export-session-key"}), and a session key was available for the most recent decryption operation. Otherwise, this is a null pointer. +You must not try to access this member of the struct unless +@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true +(non-empty string). + @end table @end deftp diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index 65624d09..07a8747f 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -174,9 +174,25 @@ main (int argc, char **argv) gpgme_set_ctx_flag (ctx, "full-status", "1"); } if (export_session_key) - gpgme_set_ctx_flag (ctx, "export-session-key", "1"); + { + err = gpgme_set_ctx_flag (ctx, "export-session-key", "1"); + if (err) + { + fprintf (stderr, PGM ": error requesting exported session key: %s\n", + gpgme_strerror (err)); + exit (1); + } + } if (override_session_key) - gpgme_set_ctx_flag (ctx, "override-session-key", override_session_key); + { + err = gpgme_set_ctx_flag (ctx, "overrride-session-key", "1"); + if (err) + { + fprintf (stderr, PGM ": error overriding session key: %s\n", + gpgme_strerror (err)); + exit (1); + } + } err = gpgme_data_new_from_stream (&in, fp_in); if (err) @@ -201,10 +217,11 @@ main (int argc, char **argv) fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err)); exit (1); } - if (result) { - print_result (result); - print_data (out); - } + if (result) + { + print_result (result); + print_data (out); + } gpgme_data_release (out); gpgme_data_release (in);