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.
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)
+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>
* gpgme.texi (Cancelling an Operation): Removed.
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.
@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.
@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.
@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}})
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
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
@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}})
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
@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
@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
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.
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
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}})
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
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
+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>
* gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError,
struct gpgme_context_s
{
int initialized;
- /* An engine request is still pending. */
- int pending;
int use_cms;
case GPGME_Invalid_Value:
errno = EINVAL;
return -1;
- case GPGME_Busy:
- errno = EBUSY;
- return -1;
case GPGME_Not_Implemented:
errno = EOPNOTSUPP;
return -1;
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
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;
symmetric = 1;
else if (!gpgme_recipients_count (recp))
{
- err = GPGME_No_Recipients;
+ err = GPGME_No_UserID;
goto leave;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
/* 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;
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
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;
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
*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);
}
{
if (!ctx)
return GPGME_Invalid_Value;
- if (!ctx->pending)
- return GPGME_No_Request;
- ctx->pending = 0;
return 0;
}
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)
case GPGME_STATUS_EOF:
if (result->no_passphrase
|| result->bad_passphrase)
- return GPGME_No_Passphrase;
+ return GPGME_Bad_Passphrase;
break;
default:
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
*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);
}
{
if (!ctx)
return GPGME_Invalid_Value;
- if (!ctx->pending)
- return GPGME_No_Request;
- ctx->pending = 0;
return 0;
}
leave:
if (err)
{
- ctx->pending = 0;
_gpgme_engine_release (ctx->engine);
ctx->engine = NULL;
}
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;
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;
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;
if (!ctx || !r_key)
return GPGME_Invalid_Value;
- if (ctx->pending)
- return GPGME_Busy;
-
op_data = ctx->op_data;
while (op_data)
{
{
ctx = dctx;
hang = 0;
- ctx->pending = 0;
}
}
}
break;
case GPGME_EVENT_DONE:
- ctx->pending = 0;
break;
case GPGME_EVENT_NEXT_KEY:
{
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);
}