From 8208786b9198c34e05dfcde3f818a01b44522339 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 24 Apr 2003 14:33:13 +0000 Subject: [PATCH] doc/ 2003-04-24 Marcus Brinkmann * gpgme.texi (Error Values): Rename GPGME_No_Passphrase to GPGME_Bad_Passphrase. * gpgme.texi (Decrypt): Likewise. (Decrypt and Verify): Likewise. (Creating a Signature): Likewise. (Encrypting a Plaintext): Likewise. * gpgme.texi (Error Values): Rename GPGME_No_Recipients to GPGME_No_UserID and GPGME_Invalid_Recipient to GPGME_Invalid_UserID. (Encrypting a Plaintext): Likewise. * gpgme.texi (Error Values): Remove GPGME_Busy and GPGME_No_Request. (Listing Keys): Likewise. (Listing Trust Items): Likewise. gpgme/ 2003-04-24 Marcus Brinkmann * gpgme.h (GpgmeError): Rename GPGME_No_Passphrase to GPGME_Bad_Passphrase. * passphrase.c (_gpgme_passphrase_status_handler): Use GPGME_Bad_Passphrase instead GPGME_No_Passphrase. * gpgme.h (GpgmeError): Rename GPGME_No_Recipients to GPGME_No_UserID and GPGME_Invalid_Recipient to GPGME_Invalid_UserID. * encrypt.c (_gpgme_encrypt_status_handler): Use GPGME_No_UserID instead GPGME_No_Recipients and GPGME_Invalid_UserID instead GPGME_Invalid_Recipient. (_gpgme_op_encrypt_start): Likewise. * gpgme.h (GpgmeError): Remove GPGME_Busy and GPGME_No_Request. * wait-user.c (_gpgme_wait_user_event_cb): Don't clear CTX->pending. * wait-private.c (_gpgme_wait_private_event_cb): Likewise. * wait-global.c (gpgme_wait): Likewise. * verify.c (_gpgme_op_verify_start): Likewise. (gpgme_get_sig_status): Don't check pending flag. (gpgme_get_sig_string_attr): Likewise. (gpgme_get_sig_ulong_attr): Likewise. (gpgme_get_sig_key): Likewise. * op-support.c (_gpgme_op_reset): Likewise. * trustlist.c (gpgme_op_trustlist_start): Don't clear pending flag. (gpgme_op_trustlist_next): Don't check or clear pending flag. (gpgme_op_trustlist_end): Likewise. * sign.c (_gpgme_op_sign_start): Likewise. * context.h (struct gpgme_context_s): Remove member PENDING. * decrypt.c (_gpgme_decrypt_start): Likewise. * delete.c (_gpgme_op_delete_start): Likewise. * edit.c (_gpgme_op_edit_start): Likewise. * encrypt.c (_gpgme_op_encrypt_start): Likewise. * encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise. * export.c (_gpgme_op_export_start): Likewise. * genkey.c (_gpgme_op_genkey_start): Likewise. * import.c (_gpgme_op_import_start): Likewise. * key.c (gpgme_get_key): Likewise. * keylist.c (gpgme_op_keylist_start): Likewise. (gpgme_op_keylist_ext_start): Likewise. (gpgme_op_keylist_next): Likewise. (gpgme_op_keylist_end): Likewise. * data-compat.c (gpgme_error_to_errno): Don't convert EBUSY. --- NEWS | 8 ++++++ doc/ChangeLog | 18 ++++++++++++ doc/gpgme.texi | 66 +++++++++++++++++--------------------------- gpgme/ChangeLog | 45 ++++++++++++++++++++++++++++++ gpgme/context.h | 2 -- gpgme/data-compat.c | 3 -- gpgme/decrypt.c | 1 - gpgme/delete.c | 1 - gpgme/edit.c | 1 - gpgme/encrypt-sign.c | 1 - gpgme/encrypt.c | 7 ++--- gpgme/export.c | 1 - gpgme/genkey.c | 1 - gpgme/gpgme.h | 49 ++++++++++++++++---------------- gpgme/import.c | 1 - gpgme/key.c | 2 -- gpgme/keylist.c | 26 ++--------------- gpgme/op-support.c | 4 --- gpgme/passphrase.c | 2 +- gpgme/sign.c | 1 - gpgme/trustlist.c | 25 ++--------------- gpgme/verify.c | 10 ++----- gpgme/wait-global.c | 1 - gpgme/wait-private.c | 1 - gpgme/wait-user.c | 3 -- 25 files changed, 132 insertions(+), 148 deletions(-) diff --git a/NEWS b/NEWS index b3e9bf5e..926739a6 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,11 @@ Noteworthy changes in version 0.4.1 (unreleased) function has been removed, just return GPGME_Canceled in the passphrase callback directly. + * For clarity and better reusability, the error codes + GPGME_No_Recipients, GPGME_Invalid_Recipient and + GPGME_No_Passphrase have been renamed to GPGME_No_UserID, + GPGME_Invalid_UserID and GPGME_Bad_Passphrase resp. + * Interface changes relative to the 0.4.0 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GpgmeIOCb CHANGED: Return type from void to GpgmeError. @@ -56,6 +61,9 @@ gpgme_get_engine_info CHANGED: Return info structure instead XML. gpgme_get_protocol_name NEW GpgmePassphraseCb CHANGED: Return error value, new argument. gpgme_cancel REMOVED: Return error in callback directly. +GPGME_No_Recipients CHANGED: GPGME_No_UserID +GPGME_Invalid_Recipient CHANGED: GPGME_Invalid_UserID +GPGME_No_Passphrase CHANGED: GPGME_Bad_Passphrase ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Noteworthy changes in version 0.4.0 (2002-12-23) diff --git a/doc/ChangeLog b/doc/ChangeLog index 37a7f086..e9e1d1fa 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,21 @@ +2003-04-24 Marcus Brinkmann + + * gpgme.texi (Error Values): Rename GPGME_No_Passphrase to + GPGME_Bad_Passphrase. + * gpgme.texi (Decrypt): Likewise. + (Decrypt and Verify): Likewise. + (Creating a Signature): Likewise. + (Encrypting a Plaintext): Likewise. + + * gpgme.texi (Error Values): Rename GPGME_No_Recipients to + GPGME_No_UserID and GPGME_Invalid_Recipient to + GPGME_Invalid_UserID. + (Encrypting a Plaintext): Likewise. + + * gpgme.texi (Error Values): Remove GPGME_Busy and GPGME_No_Request. + (Listing Keys): Likewise. + (Listing Trust Items): Likewise. + 2003-02-06 Marcus Brinkmann * gpgme.texi (Cancelling an Operation): Removed. diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 2db45382..5edf7b80 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -783,16 +783,6 @@ can also refer to objects. For example, if an empty @code{GpgmeData} object was expected, but one containing data was provided, this error value is returned. -@item GPGME_Busy -This value is returned if you try to start a new operation in a -context that is already busy with some earlier operation which was not -cancelled or finished yet. - -@item GPGME_No_Request -This value is in some sense the opposite of @code{GPGME_Busy}. There -is no pending operation, but it is required for the function to -succeed. - @item GPGME_Exec_Error This value means that an error occurred when trying to spawn a child process. @@ -803,10 +793,10 @@ This value means that there are too many active backend processes. @item GPGME_Pipe_Error This value means that the creation of a pipe failed. -@item GPGME_No_Recipients +@item GPGME_No_UserID This value means that no valid recipients for a message have been set. -@item GPGME_Invalid_Recipients +@item GPGME_Invalid_UserID This value means that some, but not all, recipients for a message have been invalid. @@ -846,9 +836,9 @@ This value means that a file I/O operation failed. The value of @item GPGME_Decryption_Failed This value indicates that a decryption operation was unsuccessful. -@item GPGME_No_Passphrase -This value means that the user did not provide a passphrase when -requested. +@item GPGME_Bad_Passphrase +This value means that the user did not provide a correct passphrase +when requested. @item GPGME_Canceled This value means that the operation was canceled. @@ -1727,9 +1717,8 @@ If the last key in the list has already been returned, @code{gpgme_op_keylist_next} returns @code{GPGME_EOF}. The function returns @code{GPGME_Invalid_Value} if @var{ctx} or -@var{r_key} is not a valid pointer, @code{GPGME_No_Request} if there -is no pending operation, @code{GPGME_Out_Of_Core} if there is not -enough memory for the operation. +@var{r_key} is not a valid pointer, and @code{GPGME_Out_Of_Core} if +there is not enough memory for the operation. @end deftypefun @deftypefun GpgmeError gpgme_op_keylist_end (@w{GpgmeCtx @var{ctx}}) @@ -1737,8 +1726,7 @@ The function @code{gpgme_op_keylist_next} ends a pending key list operation in the context @var{ctx}. The function returns @code{GPGME_Invalid_Value} if @var{ctx} is not a -valid pointer, @code{GPGME_No_Request} if there is no pending -operation, @code{GPGME_Out_Of_Core} if at some time during the +valid pointer, and @code{GPGME_Out_Of_Core} if at some time during the operation there was not enough memory available. @end deftypefun @@ -1785,10 +1773,10 @@ If the @code{GPGME_KEYLIST_MODE_SIGS} mode is active, the key will be retrieved with the key signatures (and updated if necessary). The function returns @code{GPGME_Invalid_Value} if @var{ctx} or -@var{r_key} is not a valid pointer, @code{GPGME_Busy} if there is a -pending operation, @code{GPGME_Invalid_Key} if @var{fpr} is not a -fingerprint or key ID, @code{GPGME_Out_Of_Core} if at some time during -the operation there was not enough memory available. +@var{r_key} is not a valid pointer, @code{GPGME_Invalid_Key} if +@var{fpr} is not a fingerprint or key ID, @code{GPGME_Out_Of_Core} if +at some time during the operation there was not enough memory +available. @end deftypefun @@ -2359,9 +2347,8 @@ If the last trust item in the list has already been returned, @code{gpgme_op_trustlist_next} returns @code{GPGME_EOF}. The function returns @code{GPGME_Invalid_Value} if @var{ctx} or -@var{r_item} is not a valid pointer, @code{GPGME_No_Request} if there -is no pending operation, @code{GPGME_Out_Of_Core} if there is not -enough memory for the operation. +@var{r_item} is not a valid pointer, and @code{GPGME_Out_Of_Core} if +there is not enough memory for the operation. @end deftypefun @deftypefun GpgmeError gpgme_op_trustlist_end (@w{GpgmeCtx @var{ctx}}) @@ -2369,8 +2356,7 @@ The function @code{gpgme_op_trustlist_next} ends a pending key list operation in the context @var{ctx}. The function returns @code{GPGME_Invalid_Value} if @var{ctx} is not a -valid pointer, @code{GPGME_No_Request} if there is no pending -operation, @code{GPGME_Out_Of_Core} if at some time during the +valid pointer, and @code{GPGME_Out_Of_Core} if at some time during the operation there was not enough memory available. @end deftypefun @@ -2450,7 +2436,7 @@ decrypted successfully, @code{GPGME_Invalid_Value} if @var{ctx}, @var{cipher} or @var{plain} is not a valid pointer, @code{GPGME_No_Data} if @var{cipher} does not contain any data to decrypt, @code{GPGME_Decryption_Failed} if @var{cipher} is not a valid -cipher text, @code{GPGME_No_Passphrase} if the passphrase for the +cipher text, @code{GPGME_Bad_Passphrase} if the passphrase for the secret key could not be retrieved, and passes through any errors that are reported by the crypto engine support routines. @end deftypefun @@ -2729,7 +2715,7 @@ decrypted successfully, @code{GPGME_Invalid_Value} if @var{ctx}, @var{cipher}, @var{plain} or @var{r_stat} is not a valid pointer, @code{GPGME_No_Data} if @var{cipher} does not contain any data to decrypt, @code{GPGME_Decryption_Failed} if @var{cipher} is not a valid -cipher text, @code{GPGME_No_Passphrase} if the passphrase for the +cipher text, @code{GPGME_Bad_Passphrase} if the passphrase for the secret key could not be retrieved, and passes through any errors that are reported by the crypto engine support routines. @end deftypefun @@ -2833,7 +2819,7 @@ with @code{gpgme_set_include_certs}. @xref{Included Certificates}. The function returns @code{GPGME_No_Error} if the signature could be created successfully, @code{GPGME_Invalid_Value} if @var{ctx}, @var{plain} or @var{sig} is not a valid pointer, @code{GPGME_No_Data} -if the signature could not be created, @code{GPGME_No_Passphrase} if +if the signature could not be created, @code{GPGME_Bad_Passphrase} if the passphrase for the secret key could not be retrieved, and passes through any errors that are reported by the crypto engine support routines. @@ -2956,7 +2942,7 @@ ciphertext in the data object @var{cipher}. The type of the ciphertext created is determined by the @acronym{ASCII} armor and text mode attributes set for the context @var{ctx}. -If @code{GPGME_Invalid_Recipients} is returned, some recipients in +If @code{GPGME_Invalid_UserID} is returned, some recipients in @var{rset} are invalid, but not all. In this case the plaintext is encrypted for all valid recipients and returned in @var{cipher}. More information about the invalid recipients is available with @@ -2972,11 +2958,11 @@ crypto backend. The function returns @code{GPGME_No_Error} if the ciphertext could be created successfully, @code{GPGME_Invalid_Value} if @var{ctx}, @var{rset}, @var{plain} or @var{cipher} is not a valid pointer, -@code{GPGME_No_Recipients} if @var{rset} does not contain any valid -recipients, @code{GPGME_Invalid_Recipients} if @var{rset} contains -some invalid recipients, @code{GPGME_No_Passphrase} if the passphrase -for the secret key could not be retrieved, and passes through any -errors that are reported by the crypto engine support routines. +@code{GPGME_No_UserID} if @var{rset} does not contain any valid +recipients, @code{GPGME_Invalid_UserID} if @var{rset} contains some +invalid recipients, @code{GPGME_Bad_Passphrase} if the passphrase for +the secret key could not be retrieved, and passes through any errors +that are reported by the crypto engine support routines. @end deftypefun @deftypefun GpgmeError gpgme_op_encrypt_start (@w{GpgmeCtx @var{ctx}}, @w{GpgmeRecipients @var{rset}}, @w{GpgmeData @var{plain}}, @w{GpgmeData @var{cipher}}) @@ -2987,7 +2973,7 @@ The function @code{gpgme_op_encrypt_start} initiates a The function returns @code{GPGME_No_Error} if the operation could be started successfully, @code{GPGME_Invalid_Value} if @var{ctx}, @var{rset}, @var{plain} or @var{cipher} is not a valid pointer, and -@code{GPGME_No_Recipients} if @var{rset} does not contain any valid +@code{GPGME_No_UserID} if @var{rset} does not contain any valid recipients. @end deftypefun @@ -3011,7 +2997,7 @@ Completion}. The function returns @code{GPGME_No_Error} if the operation could be started successfully, @code{GPGME_Invalid_Value} if @var{ctx}, @var{rset}, @var{plain} or @var{cipher} is not a valid pointer, and -@code{GPGME_No_Recipients} if @var{rset} does not contain any valid +@code{GPGME_No_UserID} if @var{rset} does not contain any valid recipients. @end deftypefun diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 0ab95236..219bcff6 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,48 @@ +2003-04-24 Marcus Brinkmann + + * gpgme.h (GpgmeError): Rename GPGME_No_Passphrase to + GPGME_Bad_Passphrase. + * passphrase.c (_gpgme_passphrase_status_handler): Use + GPGME_Bad_Passphrase instead GPGME_No_Passphrase. + + * gpgme.h (GpgmeError): Rename GPGME_No_Recipients to + GPGME_No_UserID and GPGME_Invalid_Recipient to + GPGME_Invalid_UserID. + * encrypt.c (_gpgme_encrypt_status_handler): Use GPGME_No_UserID + instead GPGME_No_Recipients and GPGME_Invalid_UserID instead + GPGME_Invalid_Recipient. + (_gpgme_op_encrypt_start): Likewise. + + * gpgme.h (GpgmeError): Remove GPGME_Busy and GPGME_No_Request. + * wait-user.c (_gpgme_wait_user_event_cb): Don't clear CTX->pending. + * wait-private.c (_gpgme_wait_private_event_cb): Likewise. + * wait-global.c (gpgme_wait): Likewise. + * verify.c (_gpgme_op_verify_start): Likewise. + (gpgme_get_sig_status): Don't check pending flag. + (gpgme_get_sig_string_attr): Likewise. + (gpgme_get_sig_ulong_attr): Likewise. + (gpgme_get_sig_key): Likewise. + * op-support.c (_gpgme_op_reset): Likewise. + * trustlist.c (gpgme_op_trustlist_start): Don't clear pending flag. + (gpgme_op_trustlist_next): Don't check or clear pending flag. + (gpgme_op_trustlist_end): Likewise. + * sign.c (_gpgme_op_sign_start): Likewise. + * context.h (struct gpgme_context_s): Remove member PENDING. + * decrypt.c (_gpgme_decrypt_start): Likewise. + * delete.c (_gpgme_op_delete_start): Likewise. + * edit.c (_gpgme_op_edit_start): Likewise. + * encrypt.c (_gpgme_op_encrypt_start): Likewise. + * encrypt-sign.c (_gpgme_op_encrypt_sign_start): Likewise. + * export.c (_gpgme_op_export_start): Likewise. + * genkey.c (_gpgme_op_genkey_start): Likewise. + * import.c (_gpgme_op_import_start): Likewise. + * key.c (gpgme_get_key): Likewise. + * keylist.c (gpgme_op_keylist_start): Likewise. + (gpgme_op_keylist_ext_start): Likewise. + (gpgme_op_keylist_next): Likewise. + (gpgme_op_keylist_end): Likewise. + * data-compat.c (gpgme_error_to_errno): Don't convert EBUSY. + 2003-02-06 Marcus Brinkmann * gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError, diff --git a/gpgme/context.h b/gpgme/context.h index d2b22d6e..41f25c62 100644 --- a/gpgme/context.h +++ b/gpgme/context.h @@ -75,8 +75,6 @@ struct trust_queue_item_s struct gpgme_context_s { int initialized; - /* An engine request is still pending. */ - int pending; int use_cms; diff --git a/gpgme/data-compat.c b/gpgme/data-compat.c index c5ec0716..0c0d34b1 100644 --- a/gpgme/data-compat.c +++ b/gpgme/data-compat.c @@ -120,9 +120,6 @@ gpgme_error_to_errno (GpgmeError err) case GPGME_Invalid_Value: errno = EINVAL; return -1; - case GPGME_Busy: - errno = EBUSY; - return -1; case GPGME_Not_Implemented: errno = EOPNOTSUPP; return -1; diff --git a/gpgme/decrypt.c b/gpgme/decrypt.c index 68555630..40ae932b 100644 --- a/gpgme/decrypt.c +++ b/gpgme/decrypt.c @@ -195,7 +195,6 @@ _gpgme_decrypt_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/delete.c b/gpgme/delete.c index e711b30d..1bed6d5f 100644 --- a/gpgme/delete.c +++ b/gpgme/delete.c @@ -82,7 +82,6 @@ _gpgme_op_delete_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/edit.c b/gpgme/edit.c index 1fa39290..e46f42bc 100644 --- a/gpgme/edit.c +++ b/gpgme/edit.c @@ -128,7 +128,6 @@ _gpgme_op_edit_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/encrypt-sign.c b/gpgme/encrypt-sign.c index fd277abf..b20f2b32 100644 --- a/gpgme/encrypt-sign.c +++ b/gpgme/encrypt-sign.c @@ -79,7 +79,6 @@ _gpgme_op_encrypt_sign_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/encrypt.c b/gpgme/encrypt.c index 5f95151c..7679d747 100644 --- a/gpgme/encrypt.c +++ b/gpgme/encrypt.c @@ -118,9 +118,9 @@ _gpgme_encrypt_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args) result->xmlinfo = NULL; } if (result && result->no_valid_recipients) - return GPGME_No_Recipients; + return GPGME_No_UserID; if (result && result->invalid_recipients) - return GPGME_Invalid_Recipients; + return GPGME_Invalid_UserID; } break; @@ -168,7 +168,7 @@ _gpgme_op_encrypt_start (GpgmeCtx ctx, int synchronous, symmetric = 1; else if (!gpgme_recipients_count (recp)) { - err = GPGME_No_Recipients; + err = GPGME_No_UserID; goto leave; } @@ -208,7 +208,6 @@ _gpgme_op_encrypt_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/export.c b/gpgme/export.c index 2cf9169b..40319862 100644 --- a/gpgme/export.c +++ b/gpgme/export.c @@ -61,7 +61,6 @@ _gpgme_op_export_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/genkey.c b/gpgme/genkey.c index 2636c0f1..1d078b0e 100644 --- a/gpgme/genkey.c +++ b/gpgme/genkey.c @@ -135,7 +135,6 @@ _gpgme_op_genkey_start (GpgmeCtx ctx, int synchronous, const char *parms, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 9d395951..4a718f11 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -73,31 +73,30 @@ typedef struct gpgme_trust_item_s *GpgmeTrustItem; /* The error numbers used by GPGME. */ typedef enum { - GPGME_EOF = -1, - GPGME_No_Error = 0, - GPGME_General_Error = 1, - GPGME_Out_Of_Core = 2, - GPGME_Invalid_Value = 3, - GPGME_Busy = 4, - GPGME_No_Request = 5, - GPGME_Exec_Error = 6, - GPGME_Too_Many_Procs = 7, - GPGME_Pipe_Error = 8, - GPGME_No_Recipients = 9, - GPGME_No_Data = 10, - GPGME_Conflict = 11, - GPGME_Not_Implemented = 12, - GPGME_Read_Error = 13, - GPGME_Write_Error = 14, - GPGME_Invalid_Type = 15, - GPGME_Invalid_Mode = 16, - GPGME_File_Error = 17, /* errno is set in this case. */ - GPGME_Decryption_Failed = 18, - GPGME_No_Passphrase = 19, - GPGME_Canceled = 20, - GPGME_Invalid_Key = 21, - GPGME_Invalid_Engine = 22, - GPGME_Invalid_Recipients = 23 + GPGME_EOF = -1, + GPGME_No_Error = 0x0000, + GPGME_General_Error = 0x0001, + GPGME_Out_Of_Core = 0x0002, + GPGME_Invalid_Value = 0x0003, + GPGME_No_Request = 0x0004, + GPGME_Exec_Error = 0x0005, + GPGME_Too_Many_Procs = 0x0006, + GPGME_Pipe_Error = 0x0007, + GPGME_No_Data = 0x0008, + GPGME_Conflict = 0x0009, + GPGME_Not_Implemented = 0x000a, + GPGME_Read_Error = 0x000b, + GPGME_Write_Error = 0x000c, + GPGME_Invalid_Type = 0x000d, + GPGME_Invalid_Mode = 0x000e, + GPGME_File_Error = 0x000f, /* errno is set in this case. */ + GPGME_Decryption_Failed = 0x0010, + GPGME_Bad_Passphrase = 0x0011, + GPGME_Canceled = 0x0012, + GPGME_Invalid_Key = 0x0013, + GPGME_Invalid_Engine = 0x0014, + GPGME_No_UserID = 0x0015, + GPGME_Invalid_UserID = 0x0016, } GpgmeError; diff --git a/gpgme/import.c b/gpgme/import.c index ada3dd8b..30138bcd 100644 --- a/gpgme/import.c +++ b/gpgme/import.c @@ -204,7 +204,6 @@ _gpgme_op_import_start (GpgmeCtx ctx, int synchronous, GpgmeData keydata) leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/key.c b/gpgme/key.c index 1f8e0117..7a2b7544 100644 --- a/gpgme/key.c +++ b/gpgme/key.c @@ -1195,8 +1195,6 @@ gpgme_get_key (GpgmeCtx ctx, const char *fpr, GpgmeKey *r_key, if (!ctx || !r_key) return GPGME_Invalid_Value; - if (ctx->pending) - return GPGME_Busy; if (strlen (fpr) < 16) /* We have at least a key ID. */ return GPGME_Invalid_Key; diff --git a/gpgme/keylist.c b/gpgme/keylist.c index e6cc5cec..29e2459f 100644 --- a/gpgme/keylist.c +++ b/gpgme/keylist.c @@ -755,7 +755,6 @@ gpgme_op_keylist_start (GpgmeCtx ctx, const char *pattern, int secret_only) leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } @@ -806,7 +805,6 @@ gpgme_op_keylist_ext_start (GpgmeCtx ctx, const char *pattern[], leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } @@ -837,31 +835,14 @@ gpgme_op_keylist_next (GpgmeCtx ctx, GpgmeKey *r_key) *r_key = NULL; if (!ctx) return GPGME_Invalid_Value; - if (!ctx->pending) - return GPGME_No_Request; if (!ctx->key_queue) { GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond); if (err) - { - ctx->pending = 0; - return err; - } - if (!ctx->pending) - { - /* The operation finished. Because not all keys might have - been returned to the caller yet, we just reset the - pending flag to 1. This will cause us to call - _gpgme_wait_on_condition without any active file - descriptors, but that is a no-op, so it is safe. */ - ctx->pending = 1; - } + return err; if (!ctx->key_cond) - { - ctx->pending = 0; - return GPGME_EOF; - } + return GPGME_EOF; ctx->key_cond = 0; assert (ctx->key_queue); } @@ -888,9 +869,6 @@ gpgme_op_keylist_end (GpgmeCtx ctx) { if (!ctx) return GPGME_Invalid_Value; - if (!ctx->pending) - return GPGME_No_Request; - ctx->pending = 0; return 0; } diff --git a/gpgme/op-support.c b/gpgme/op-support.c index 909b75d1..4bf5bb5d 100644 --- a/gpgme/op-support.c +++ b/gpgme/op-support.c @@ -66,15 +66,11 @@ _gpgme_op_reset (GpgmeCtx ctx, int type) GpgmeError err = 0; struct GpgmeIOCbs io_cbs; - if (ctx->pending) - return GPGME_Busy; - _gpgme_release_result (ctx); /* Create an engine object. */ _gpgme_engine_release (ctx->engine); ctx->engine = NULL; - ctx->pending = 1; err = _gpgme_engine_new (ctx->use_cms ? GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP, &ctx->engine); if (err) diff --git a/gpgme/passphrase.c b/gpgme/passphrase.c index fd492ac7..d56562f8 100644 --- a/gpgme/passphrase.c +++ b/gpgme/passphrase.c @@ -97,7 +97,7 @@ _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args case GPGME_STATUS_EOF: if (result->no_passphrase || result->bad_passphrase) - return GPGME_No_Passphrase; + return GPGME_Bad_Passphrase; break; default: diff --git a/gpgme/sign.c b/gpgme/sign.c index eeebe7ad..f45879a7 100644 --- a/gpgme/sign.c +++ b/gpgme/sign.c @@ -223,7 +223,6 @@ _gpgme_op_sign_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } diff --git a/gpgme/trustlist.c b/gpgme/trustlist.c index 0a6f635f..ba1188a9 100644 --- a/gpgme/trustlist.c +++ b/gpgme/trustlist.c @@ -192,7 +192,6 @@ gpgme_op_trustlist_start (GpgmeCtx ctx, const char *pattern, int max_level) leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } @@ -210,31 +209,14 @@ gpgme_op_trustlist_next (GpgmeCtx ctx, GpgmeTrustItem *r_item) *r_item = NULL; if (!ctx) return GPGME_Invalid_Value; - if (!ctx->pending) - return GPGME_No_Request; if (!ctx->trust_queue) { GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond); if (err) - { - ctx->pending = 0; - return err; - } - if (!ctx->pending) - { - /* The operation finished. Because not all keys might have - been returned to the caller yet, we just reset the - pending flag to 1. This will cause us to call - _gpgme_wait_on_condition without any active file - descriptors, but that is a no-op, so it is safe. */ - ctx->pending = 1; - } + return err; if (!ctx->key_cond) - { - ctx->pending = 0; - return GPGME_EOF; - } + return GPGME_EOF; ctx->key_cond = 0; assert (ctx->trust_queue); } @@ -259,10 +241,7 @@ gpgme_op_trustlist_end (GpgmeCtx ctx) { if (!ctx) return GPGME_Invalid_Value; - if (!ctx->pending) - return GPGME_No_Request; - ctx->pending = 0; return 0; } diff --git a/gpgme/verify.c b/gpgme/verify.c index 7817668d..190418f4 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -400,7 +400,6 @@ _gpgme_op_verify_start (GpgmeCtx ctx, int synchronous, leave: if (err) { - ctx->pending = 0; _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } @@ -483,7 +482,7 @@ gpgme_get_sig_status (GpgmeCtx ctx, int idx, struct ctx_op_data *op_data; VerifyResult result; - if (!ctx || ctx->pending) + if (!ctx) return NULL; /* No results yet or verification error. */ op_data = ctx->op_data; @@ -570,7 +569,7 @@ gpgme_get_sig_string_attr (GpgmeCtx ctx, int idx, GpgmeAttr what, int whatidx) struct ctx_op_data *op_data; VerifyResult result; - if (!ctx || ctx->pending) + if (!ctx) return NULL; /* No results yet or verification error. */ op_data = ctx->op_data; @@ -608,7 +607,7 @@ gpgme_get_sig_ulong_attr (GpgmeCtx ctx, int idx, GpgmeAttr what, int reserved) struct ctx_op_data *op_data; VerifyResult result; - if (!ctx || ctx->pending) + if (!ctx) return 0; /* No results yet or verification error. */ op_data = ctx->op_data; @@ -663,9 +662,6 @@ gpgme_get_sig_key (GpgmeCtx ctx, int idx, GpgmeKey *r_key) if (!ctx || !r_key) return GPGME_Invalid_Value; - if (ctx->pending) - return GPGME_Busy; - op_data = ctx->op_data; while (op_data) { diff --git a/gpgme/wait-global.c b/gpgme/wait-global.c index 4025d2b9..12d2cec3 100644 --- a/gpgme/wait-global.c +++ b/gpgme/wait-global.c @@ -343,7 +343,6 @@ gpgme_wait (GpgmeCtx ctx, GpgmeError *status, int hang) { ctx = dctx; hang = 0; - ctx->pending = 0; } } } diff --git a/gpgme/wait-private.c b/gpgme/wait-private.c index de7f5353..134e389a 100644 --- a/gpgme/wait-private.c +++ b/gpgme/wait-private.c @@ -54,7 +54,6 @@ _gpgme_wait_private_event_cb (void *data, GpgmeEventIO type, void *type_data) break; case GPGME_EVENT_DONE: - ctx->pending = 0; break; case GPGME_EVENT_NEXT_KEY: diff --git a/gpgme/wait-user.c b/gpgme/wait-user.c index 02a60767..d3d789a9 100644 --- a/gpgme/wait-user.c +++ b/gpgme/wait-user.c @@ -119,9 +119,6 @@ _gpgme_wait_user_event_cb (void *data, GpgmeEventIO type, void *type_data) { GpgmeCtx ctx = data; - if (type == GPGME_EVENT_DONE) - ctx->pending = 0; - if (ctx->io_cbs.event) (*ctx->io_cbs.event) (ctx->io_cbs.event_priv, type, type_data); }