2003-04-24  Marcus Brinkmann  <marcus@g10code.de>

	* 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  <marcus@g10code.de>

	* 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.
This commit is contained in:
Marcus Brinkmann 2003-04-24 14:33:13 +00:00
parent 9b740d740b
commit 8208786b91
25 changed files with 132 additions and 148 deletions

8
NEWS
View File

@ -41,6 +41,11 @@ Noteworthy changes in version 0.4.1 (unreleased)
function has been removed, just return GPGME_Canceled in the function has been removed, just return GPGME_Canceled in the
passphrase callback directly. 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: * Interface changes relative to the 0.4.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GpgmeIOCb CHANGED: Return type from void to GpgmeError. 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 gpgme_get_protocol_name NEW
GpgmePassphraseCb CHANGED: Return error value, new argument. GpgmePassphraseCb CHANGED: Return error value, new argument.
gpgme_cancel REMOVED: Return error in callback directly. 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) Noteworthy changes in version 0.4.0 (2002-12-23)

View File

@ -1,3 +1,21 @@
2003-04-24 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de> 2003-02-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Cancelling an Operation): Removed. * gpgme.texi (Cancelling an Operation): Removed.

View File

@ -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 object was expected, but one containing data was provided, this error
value is returned. 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 @item GPGME_Exec_Error
This value means that an error occurred when trying to spawn a child This value means that an error occurred when trying to spawn a child
process. process.
@ -803,10 +793,10 @@ This value means that there are too many active backend processes.
@item GPGME_Pipe_Error @item GPGME_Pipe_Error
This value means that the creation of a pipe failed. 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. 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 This value means that some, but not all, recipients for a message have
been invalid. been invalid.
@ -846,9 +836,9 @@ This value means that a file I/O operation failed. The value of
@item GPGME_Decryption_Failed @item GPGME_Decryption_Failed
This value indicates that a decryption operation was unsuccessful. This value indicates that a decryption operation was unsuccessful.
@item GPGME_No_Passphrase @item GPGME_Bad_Passphrase
This value means that the user did not provide a passphrase when This value means that the user did not provide a correct passphrase
requested. when requested.
@item GPGME_Canceled @item GPGME_Canceled
This value means that the operation was 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}. @code{gpgme_op_keylist_next} returns @code{GPGME_EOF}.
The function returns @code{GPGME_Invalid_Value} if @var{ctx} or 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 @var{r_key} is not a valid pointer, and @code{GPGME_Out_Of_Core} if
is no pending operation, @code{GPGME_Out_Of_Core} if there is not there is not enough memory for the operation.
enough memory for the operation.
@end deftypefun @end deftypefun
@deftypefun GpgmeError gpgme_op_keylist_end (@w{GpgmeCtx @var{ctx}}) @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}. operation in the context @var{ctx}.
The function returns @code{GPGME_Invalid_Value} if @var{ctx} is not a The function returns @code{GPGME_Invalid_Value} if @var{ctx} is not a
valid pointer, @code{GPGME_No_Request} if there is no pending valid pointer, and @code{GPGME_Out_Of_Core} if at some time during the
operation, @code{GPGME_Out_Of_Core} if at some time during the
operation there was not enough memory available. operation there was not enough memory available.
@end deftypefun @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). retrieved with the key signatures (and updated if necessary).
The function returns @code{GPGME_Invalid_Value} if @var{ctx} or 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 @var{r_key} is not a valid pointer, @code{GPGME_Invalid_Key} if
pending operation, @code{GPGME_Invalid_Key} if @var{fpr} is not a @var{fpr} is not a fingerprint or key ID, @code{GPGME_Out_Of_Core} if
fingerprint or key ID, @code{GPGME_Out_Of_Core} if at some time during at some time during the operation there was not enough memory
the operation there was not enough memory available. available.
@end deftypefun @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}. @code{gpgme_op_trustlist_next} returns @code{GPGME_EOF}.
The function returns @code{GPGME_Invalid_Value} if @var{ctx} or 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 @var{r_item} is not a valid pointer, and @code{GPGME_Out_Of_Core} if
is no pending operation, @code{GPGME_Out_Of_Core} if there is not there is not enough memory for the operation.
enough memory for the operation.
@end deftypefun @end deftypefun
@deftypefun GpgmeError gpgme_op_trustlist_end (@w{GpgmeCtx @var{ctx}}) @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}. operation in the context @var{ctx}.
The function returns @code{GPGME_Invalid_Value} if @var{ctx} is not a The function returns @code{GPGME_Invalid_Value} if @var{ctx} is not a
valid pointer, @code{GPGME_No_Request} if there is no pending valid pointer, and @code{GPGME_Out_Of_Core} if at some time during the
operation, @code{GPGME_Out_Of_Core} if at some time during the
operation there was not enough memory available. operation there was not enough memory available.
@end deftypefun @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, @var{cipher} or @var{plain} is not a valid pointer,
@code{GPGME_No_Data} if @var{cipher} does not contain any data to @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 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 secret key could not be retrieved, and passes through any errors that
are reported by the crypto engine support routines. are reported by the crypto engine support routines.
@end deftypefun @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, @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 @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 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 secret key could not be retrieved, and passes through any errors that
are reported by the crypto engine support routines. are reported by the crypto engine support routines.
@end deftypefun @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 The function returns @code{GPGME_No_Error} if the signature could be
created successfully, @code{GPGME_Invalid_Value} if @var{ctx}, created successfully, @code{GPGME_Invalid_Value} if @var{ctx},
@var{plain} or @var{sig} is not a valid pointer, @code{GPGME_No_Data} @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 the passphrase for the secret key could not be retrieved, and passes
through any errors that are reported by the crypto engine support through any errors that are reported by the crypto engine support
routines. 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 ciphertext created is determined by the @acronym{ASCII} armor and text
mode attributes set for the context @var{ctx}. 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 @var{rset} are invalid, but not all. In this case the plaintext is
encrypted for all valid recipients and returned in @var{cipher}. More encrypted for all valid recipients and returned in @var{cipher}. More
information about the invalid recipients is available with 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 The function returns @code{GPGME_No_Error} if the ciphertext could be
created successfully, @code{GPGME_Invalid_Value} if @var{ctx}, created successfully, @code{GPGME_Invalid_Value} if @var{ctx},
@var{rset}, @var{plain} or @var{cipher} is not a valid pointer, @var{rset}, @var{plain} or @var{cipher} is not a valid pointer,
@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, @code{GPGME_Invalid_Recipients} if @var{rset} contains recipients, @code{GPGME_Invalid_UserID} if @var{rset} contains some
some invalid recipients, @code{GPGME_No_Passphrase} if the passphrase invalid recipients, @code{GPGME_Bad_Passphrase} if the passphrase for
for the secret key could not be retrieved, and passes through any the secret key could not be retrieved, and passes through any errors
errors that are reported by the crypto engine support routines. that are reported by the crypto engine support routines.
@end deftypefun @end deftypefun
@deftypefun GpgmeError gpgme_op_encrypt_start (@w{GpgmeCtx @var{ctx}}, @w{GpgmeRecipients @var{rset}}, @w{GpgmeData @var{plain}}, @w{GpgmeData @var{cipher}}) @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 The function returns @code{GPGME_No_Error} if the operation could be
started successfully, @code{GPGME_Invalid_Value} if @var{ctx}, started successfully, @code{GPGME_Invalid_Value} if @var{ctx},
@var{rset}, @var{plain} or @var{cipher} is not a valid pointer, and @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. recipients.
@end deftypefun @end deftypefun
@ -3011,7 +2997,7 @@ Completion}.
The function returns @code{GPGME_No_Error} if the operation could be The function returns @code{GPGME_No_Error} if the operation could be
started successfully, @code{GPGME_Invalid_Value} if @var{ctx}, started successfully, @code{GPGME_Invalid_Value} if @var{ctx},
@var{rset}, @var{plain} or @var{cipher} is not a valid pointer, and @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. recipients.
@end deftypefun @end deftypefun

View File

@ -1,3 +1,48 @@
2003-04-24 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de> 2003-02-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError, * gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError,

View File

@ -75,8 +75,6 @@ struct trust_queue_item_s
struct gpgme_context_s struct gpgme_context_s
{ {
int initialized; int initialized;
/* An engine request is still pending. */
int pending;
int use_cms; int use_cms;

View File

@ -120,9 +120,6 @@ gpgme_error_to_errno (GpgmeError err)
case GPGME_Invalid_Value: case GPGME_Invalid_Value:
errno = EINVAL; errno = EINVAL;
return -1; return -1;
case GPGME_Busy:
errno = EBUSY;
return -1;
case GPGME_Not_Implemented: case GPGME_Not_Implemented:
errno = EOPNOTSUPP; errno = EOPNOTSUPP;
return -1; return -1;

View File

@ -195,7 +195,6 @@ _gpgme_decrypt_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -82,7 +82,6 @@ _gpgme_op_delete_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -128,7 +128,6 @@ _gpgme_op_edit_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -79,7 +79,6 @@ _gpgme_op_encrypt_sign_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -118,9 +118,9 @@ _gpgme_encrypt_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args)
result->xmlinfo = NULL; result->xmlinfo = NULL;
} }
if (result && result->no_valid_recipients) if (result && result->no_valid_recipients)
return GPGME_No_Recipients; return GPGME_No_UserID;
if (result && result->invalid_recipients) if (result && result->invalid_recipients)
return GPGME_Invalid_Recipients; return GPGME_Invalid_UserID;
} }
break; break;
@ -168,7 +168,7 @@ _gpgme_op_encrypt_start (GpgmeCtx ctx, int synchronous,
symmetric = 1; symmetric = 1;
else if (!gpgme_recipients_count (recp)) else if (!gpgme_recipients_count (recp))
{ {
err = GPGME_No_Recipients; err = GPGME_No_UserID;
goto leave; goto leave;
} }
@ -208,7 +208,6 @@ _gpgme_op_encrypt_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -61,7 +61,6 @@ _gpgme_op_export_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -135,7 +135,6 @@ _gpgme_op_genkey_start (GpgmeCtx ctx, int synchronous, const char *parms,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -73,31 +73,30 @@ typedef struct gpgme_trust_item_s *GpgmeTrustItem;
/* The error numbers used by GPGME. */ /* The error numbers used by GPGME. */
typedef enum typedef enum
{ {
GPGME_EOF = -1, GPGME_EOF = -1,
GPGME_No_Error = 0, GPGME_No_Error = 0x0000,
GPGME_General_Error = 1, GPGME_General_Error = 0x0001,
GPGME_Out_Of_Core = 2, GPGME_Out_Of_Core = 0x0002,
GPGME_Invalid_Value = 3, GPGME_Invalid_Value = 0x0003,
GPGME_Busy = 4, GPGME_No_Request = 0x0004,
GPGME_No_Request = 5, GPGME_Exec_Error = 0x0005,
GPGME_Exec_Error = 6, GPGME_Too_Many_Procs = 0x0006,
GPGME_Too_Many_Procs = 7, GPGME_Pipe_Error = 0x0007,
GPGME_Pipe_Error = 8, GPGME_No_Data = 0x0008,
GPGME_No_Recipients = 9, GPGME_Conflict = 0x0009,
GPGME_No_Data = 10, GPGME_Not_Implemented = 0x000a,
GPGME_Conflict = 11, GPGME_Read_Error = 0x000b,
GPGME_Not_Implemented = 12, GPGME_Write_Error = 0x000c,
GPGME_Read_Error = 13, GPGME_Invalid_Type = 0x000d,
GPGME_Write_Error = 14, GPGME_Invalid_Mode = 0x000e,
GPGME_Invalid_Type = 15, GPGME_File_Error = 0x000f, /* errno is set in this case. */
GPGME_Invalid_Mode = 16, GPGME_Decryption_Failed = 0x0010,
GPGME_File_Error = 17, /* errno is set in this case. */ GPGME_Bad_Passphrase = 0x0011,
GPGME_Decryption_Failed = 18, GPGME_Canceled = 0x0012,
GPGME_No_Passphrase = 19, GPGME_Invalid_Key = 0x0013,
GPGME_Canceled = 20, GPGME_Invalid_Engine = 0x0014,
GPGME_Invalid_Key = 21, GPGME_No_UserID = 0x0015,
GPGME_Invalid_Engine = 22, GPGME_Invalid_UserID = 0x0016,
GPGME_Invalid_Recipients = 23
} }
GpgmeError; GpgmeError;

View File

@ -204,7 +204,6 @@ _gpgme_op_import_start (GpgmeCtx ctx, int synchronous, GpgmeData keydata)
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -1195,8 +1195,6 @@ gpgme_get_key (GpgmeCtx ctx, const char *fpr, GpgmeKey *r_key,
if (!ctx || !r_key) if (!ctx || !r_key)
return GPGME_Invalid_Value; return GPGME_Invalid_Value;
if (ctx->pending)
return GPGME_Busy;
if (strlen (fpr) < 16) /* We have at least a key ID. */ if (strlen (fpr) < 16) /* We have at least a key ID. */
return GPGME_Invalid_Key; return GPGME_Invalid_Key;

View File

@ -755,7 +755,6 @@ gpgme_op_keylist_start (GpgmeCtx ctx, const char *pattern, int secret_only)
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }
@ -806,7 +805,6 @@ gpgme_op_keylist_ext_start (GpgmeCtx ctx, const char *pattern[],
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }
@ -837,31 +835,14 @@ gpgme_op_keylist_next (GpgmeCtx ctx, GpgmeKey *r_key)
*r_key = NULL; *r_key = NULL;
if (!ctx) if (!ctx)
return GPGME_Invalid_Value; return GPGME_Invalid_Value;
if (!ctx->pending)
return GPGME_No_Request;
if (!ctx->key_queue) if (!ctx->key_queue)
{ {
GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond); GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond);
if (err) if (err)
{ return 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;
}
if (!ctx->key_cond) if (!ctx->key_cond)
{ return GPGME_EOF;
ctx->pending = 0;
return GPGME_EOF;
}
ctx->key_cond = 0; ctx->key_cond = 0;
assert (ctx->key_queue); assert (ctx->key_queue);
} }
@ -888,9 +869,6 @@ gpgme_op_keylist_end (GpgmeCtx ctx)
{ {
if (!ctx) if (!ctx)
return GPGME_Invalid_Value; return GPGME_Invalid_Value;
if (!ctx->pending)
return GPGME_No_Request;
ctx->pending = 0;
return 0; return 0;
} }

View File

@ -66,15 +66,11 @@ _gpgme_op_reset (GpgmeCtx ctx, int type)
GpgmeError err = 0; GpgmeError err = 0;
struct GpgmeIOCbs io_cbs; struct GpgmeIOCbs io_cbs;
if (ctx->pending)
return GPGME_Busy;
_gpgme_release_result (ctx); _gpgme_release_result (ctx);
/* Create an engine object. */ /* Create an engine object. */
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
ctx->pending = 1;
err = _gpgme_engine_new (ctx->use_cms ? GPGME_PROTOCOL_CMS err = _gpgme_engine_new (ctx->use_cms ? GPGME_PROTOCOL_CMS
: GPGME_PROTOCOL_OpenPGP, &ctx->engine); : GPGME_PROTOCOL_OpenPGP, &ctx->engine);
if (err) if (err)

View File

@ -97,7 +97,7 @@ _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args
case GPGME_STATUS_EOF: case GPGME_STATUS_EOF:
if (result->no_passphrase if (result->no_passphrase
|| result->bad_passphrase) || result->bad_passphrase)
return GPGME_No_Passphrase; return GPGME_Bad_Passphrase;
break; break;
default: default:

View File

@ -223,7 +223,6 @@ _gpgme_op_sign_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }

View File

@ -192,7 +192,6 @@ gpgme_op_trustlist_start (GpgmeCtx ctx, const char *pattern, int max_level)
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }
@ -210,31 +209,14 @@ gpgme_op_trustlist_next (GpgmeCtx ctx, GpgmeTrustItem *r_item)
*r_item = NULL; *r_item = NULL;
if (!ctx) if (!ctx)
return GPGME_Invalid_Value; return GPGME_Invalid_Value;
if (!ctx->pending)
return GPGME_No_Request;
if (!ctx->trust_queue) if (!ctx->trust_queue)
{ {
GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond); GpgmeError err = _gpgme_wait_on_condition (ctx, &ctx->key_cond);
if (err) if (err)
{ return 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;
}
if (!ctx->key_cond) if (!ctx->key_cond)
{ return GPGME_EOF;
ctx->pending = 0;
return GPGME_EOF;
}
ctx->key_cond = 0; ctx->key_cond = 0;
assert (ctx->trust_queue); assert (ctx->trust_queue);
} }
@ -259,10 +241,7 @@ gpgme_op_trustlist_end (GpgmeCtx ctx)
{ {
if (!ctx) if (!ctx)
return GPGME_Invalid_Value; return GPGME_Invalid_Value;
if (!ctx->pending)
return GPGME_No_Request;
ctx->pending = 0;
return 0; return 0;
} }

View File

@ -400,7 +400,6 @@ _gpgme_op_verify_start (GpgmeCtx ctx, int synchronous,
leave: leave:
if (err) if (err)
{ {
ctx->pending = 0;
_gpgme_engine_release (ctx->engine); _gpgme_engine_release (ctx->engine);
ctx->engine = NULL; ctx->engine = NULL;
} }
@ -483,7 +482,7 @@ gpgme_get_sig_status (GpgmeCtx ctx, int idx,
struct ctx_op_data *op_data; struct ctx_op_data *op_data;
VerifyResult result; VerifyResult result;
if (!ctx || ctx->pending) if (!ctx)
return NULL; /* No results yet or verification error. */ return NULL; /* No results yet or verification error. */
op_data = ctx->op_data; 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; struct ctx_op_data *op_data;
VerifyResult result; VerifyResult result;
if (!ctx || ctx->pending) if (!ctx)
return NULL; /* No results yet or verification error. */ return NULL; /* No results yet or verification error. */
op_data = ctx->op_data; 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; struct ctx_op_data *op_data;
VerifyResult result; VerifyResult result;
if (!ctx || ctx->pending) if (!ctx)
return 0; /* No results yet or verification error. */ return 0; /* No results yet or verification error. */
op_data = ctx->op_data; op_data = ctx->op_data;
@ -663,9 +662,6 @@ gpgme_get_sig_key (GpgmeCtx ctx, int idx, GpgmeKey *r_key)
if (!ctx || !r_key) if (!ctx || !r_key)
return GPGME_Invalid_Value; return GPGME_Invalid_Value;
if (ctx->pending)
return GPGME_Busy;
op_data = ctx->op_data; op_data = ctx->op_data;
while (op_data) while (op_data)
{ {

View File

@ -343,7 +343,6 @@ gpgme_wait (GpgmeCtx ctx, GpgmeError *status, int hang)
{ {
ctx = dctx; ctx = dctx;
hang = 0; hang = 0;
ctx->pending = 0;
} }
} }
} }

View File

@ -54,7 +54,6 @@ _gpgme_wait_private_event_cb (void *data, GpgmeEventIO type, void *type_data)
break; break;
case GPGME_EVENT_DONE: case GPGME_EVENT_DONE:
ctx->pending = 0;
break; break;
case GPGME_EVENT_NEXT_KEY: case GPGME_EVENT_NEXT_KEY:

View File

@ -119,9 +119,6 @@ _gpgme_wait_user_event_cb (void *data, GpgmeEventIO type, void *type_data)
{ {
GpgmeCtx ctx = data; GpgmeCtx ctx = data;
if (type == GPGME_EVENT_DONE)
ctx->pending = 0;
if (ctx->io_cbs.event) if (ctx->io_cbs.event)
(*ctx->io_cbs.event) (ctx->io_cbs.event_priv, type, type_data); (*ctx->io_cbs.event) (ctx->io_cbs.event_priv, type, type_data);
} }