aboutsummaryrefslogtreecommitdiffstats
path: root/gpgmeplug/gpgmeplug.c
diff options
context:
space:
mode:
authorKarl-Heinz Zimmer <[email protected]>2002-06-27 08:21:58 +0000
committerKarl-Heinz Zimmer <[email protected]>2002-06-27 08:21:58 +0000
commit095eef179277e6bec2baf597652be35d6142d1f4 (patch)
treea7cae8d04ccf2e29dcdd333662fc90d039adbdf9 /gpgmeplug/gpgmeplug.c
parentBugfix: enable function receiverCertificateDaysLeftToExpiry(). (diff)
downloadgpgme-095eef179277e6bec2baf597652be35d6142d1f4.tar.gz
gpgme-095eef179277e6bec2baf597652be35d6142d1f4.zip
Missing implementation bug fixed: Return both error id and error plain text from decryptMessage().
Diffstat (limited to 'gpgmeplug/gpgmeplug.c')
-rw-r--r--gpgmeplug/gpgmeplug.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gpgmeplug/gpgmeplug.c b/gpgmeplug/gpgmeplug.c
index d56a6fc6..25f7e2ae 100644
--- a/gpgmeplug/gpgmeplug.c
+++ b/gpgmeplug/gpgmeplug.c
@@ -1797,7 +1797,9 @@ bool decryptMessage( const char* ciphertext,
bool cipherIsBinary,
int cipherLen,
const char** cleartext,
- const char* certificate )
+ const char* certificate,
+ int* errId,
+ char** errTxt )
{
GpgmeCtx ctx;
GpgmeError err;
@@ -1827,7 +1829,19 @@ bool decryptMessage( const char* ciphertext,
gpgme_data_new( &gPlaintext );
- gpgme_op_decrypt( ctx, gCiphertext, gPlaintext );
+ err = err = gpgme_op_decrypt( ctx, gCiphertext, gPlaintext );
+ if( err ) {
+ fprintf( stderr, "\ngpgme_op_decrypt() returned this error code: %i\n\n", err );
+ if( errId )
+ *errId = err;
+ if( errTxt ) {
+ const char* _errTxt = gpgme_strerror( err );
+ *errTxt = malloc( strlen( _errTxt ) + 1 );
+ if( *errTxt )
+ strcpy(*errTxt, _errTxt );
+ }
+ }
+
gpgme_data_release( gCiphertext );
rCiph = gpgme_data_release_and_get_mem( gPlaintext, &rCLen );