2003-06-06  Marcus Brinkmann  <marcus@g10code.de>

	* gpgme.texi (Crypto Operations): Rename gpgme_invalid_user_id_t
	to gpgme_invalid_key_t.

gpgme/
2003-06-06  Marcus Brinkmann  <marcus@g10code.de>

	* op-support.c (_gpgme_parse_inv_userid): Rename to
	_gpgme_parse_inv_recp and change to new datatype.
	* ops.h (_gpgme_parse_inv_key): Fix prototype.
	* gpgme.h (struct _gpgme_invalid_user_id): Rename to
	__gpgme_invalid_key.  Rename field ID to KEY.
	(gpgme_invalid_user_id_t): Rename to gpgme_invalid_key_t.
	(struct _gpgme_op_encrypt_result): Here, too.
	(struct _gpgme_op_sign_result): Likewise.
	* encrypt.c (struct op_data): Likewise.
	(release_op_data): Likewise.
	* sign.c (struct op_data): Likewise.
	(release_op_data): Likewise.
This commit is contained in:
Marcus Brinkmann 2003-06-06 00:56:03 +00:00
parent 0b08f4b85f
commit a8fe22ca6b
17 changed files with 87 additions and 71 deletions

4
NEWS
View File

@ -198,7 +198,7 @@ Noteworthy changes in version 0.4.1 (unreleased)
* The new gpgme_op_sign_result function provides detailed information * The new gpgme_op_sign_result function provides detailed information
about the result of a signing operation in gpgme_sign_result_t, about the result of a signing operation in gpgme_sign_result_t,
gpgme_invalid_user_id_t and gpgme_new_signature_t objects. gpgme_invalid_key_t and gpgme_new_signature_t objects.
* The new gpgme_op_encrypt_result function provides detailed * The new gpgme_op_encrypt_result function provides detailed
information about the result of an encryption operation in information about the result of an encryption operation in
@ -352,7 +352,7 @@ gpgme_import_status_t NEW
gpgme_import_result_t NEW gpgme_import_result_t NEW
gpgme_pubkey_algo_t NEW gpgme_pubkey_algo_t NEW
gpgme_hash_algo_t NEW gpgme_hash_algo_t NEW
gpgme_invalid_user_id_t NEW gpgme_invalid_key_t NEW
gpgme_new_signature_t NEW gpgme_new_signature_t NEW
gpgme_sign_result_t NEW gpgme_sign_result_t NEW
gpgme_op_sign_result NEW gpgme_op_sign_result NEW

1
TODO
View File

@ -1,7 +1,6 @@
Hey Emacs, this is -*- outline -*- mode! Hey Emacs, this is -*- outline -*- mode!
* Before release: * Before release:
** Change gpgme_invalid_user_id_t to gpgme_invalid_key_t.
** gpgme-config must include info about libgpg-error. ** gpgme-config must include info about libgpg-error.
* ABI's to break: * ABI's to break:

View File

@ -1,3 +1,8 @@
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Crypto Operations): Rename gpgme_invalid_user_id_t
to gpgme_invalid_key_t.
2003-06-06 Marcus Brinkmann <marcus@g10code.de> 2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi: Change error codes to GPG_ERR_* variants. * gpgme.texi: Change error codes to GPG_ERR_* variants.

View File

@ -3252,24 +3252,24 @@ The function @code{gpgme_trust_item_release} is an alias for
@cindex cryptographic operation @cindex cryptographic operation
Sometimes, the result of a crypto operation returns a list of invalid Sometimes, the result of a crypto operation returns a list of invalid
user IDs encountered in processing the request. The following keys encountered in processing the request. The following structure
structure is used to hold information about such an user ID. is used to hold information about such a key.
@deftp {Data type} {gpgme_invalid_user_id_t} @deftp {Data type} {gpgme_invalid_key_t}
This is a pointer to a structure used to store a part of the result of This is a pointer to a structure used to store a part of the result of
a crypto operation which takes user IDs as one input parameter. The a crypto operation which takes user IDs as one input parameter. The
structure contains the following members: structure contains the following members:
@table @code @table @code
@item gpgme_invalid_user_id_t next @item gpgme_invalid_key_t next
This is a pointer to the next invalid user ID structure in the linked This is a pointer to the next invalid key structure in the linked
list, or @code{NULL} if this is the last element. list, or @code{NULL} if this is the last element.
@item char *id @item char *fpr
The invalid user ID encountered. The fingerprint or key ID of the invalid key encountered.
@item gpgme_error_t reason @item gpgme_error_t reason
An error code describing the reason why the user ID was found invalid. An error code describing the reason why the key was found invalid.
@end table @end table
@end deftp @end deftp
@ -3946,8 +3946,8 @@ signature, you can retrieve the pointer to the result with
members: members:
@table @code @table @code
@item gpgme_invalid_user_id_t invalid_signers @item gpgme_invalid_key_t invalid_signers
A linked list with information about all invalid user IDs for which a A linked list with information about all invalid keys for which a
signature could not be created. signature could not be created.
@item gpgme_new_signature_t signatures @item gpgme_new_signature_t signatures
@ -4053,8 +4053,8 @@ data, you can retrieve the pointer to the result with
members: members:
@table @code @table @code
@item gpgme_invalid_user_id_t invalid_recipients @item gpgme_invalid_key_t invalid_recipients
A linked list with information about all invalid user IDs for which A linked list with information about all invalid keys for which
the data could not be encrypted. the data could not be encrypted.
@end table @end table
@end deftp @end deftp

View File

@ -1,5 +1,18 @@
2003-06-06 Marcus Brinkmann <marcus@g10code.de> 2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* op-support.c (_gpgme_parse_inv_userid): Rename to
_gpgme_parse_inv_recp and change to new datatype.
* ops.h (_gpgme_parse_inv_key): Fix prototype.
* gpgme.h (struct _gpgme_invalid_user_id): Rename to
__gpgme_invalid_key. Rename field ID to KEY.
(gpgme_invalid_user_id_t): Rename to gpgme_invalid_key_t.
(struct _gpgme_op_encrypt_result): Here, too.
(struct _gpgme_op_sign_result): Likewise.
* encrypt.c (struct op_data): Likewise.
(release_op_data): Likewise.
* sign.c (struct op_data): Likewise.
(release_op_data): Likewise.
* posix-io.c (_gpgme_io_read): Save errno across debug calls. * posix-io.c (_gpgme_io_read): Save errno across debug calls.
(_gpgme_io_write): Likewise. (_gpgme_io_write): Likewise.
(_gpgme_io_pipe): Likewise. (_gpgme_io_pipe): Likewise.

View File

@ -37,7 +37,7 @@ typedef struct
/* A pointer to the next pointer of the last invalid recipient in /* A pointer to the next pointer of the last invalid recipient in
the list. This makes appending new invalid recipients painless the list. This makes appending new invalid recipients painless
while preserving the order. */ while preserving the order. */
gpgme_invalid_user_id_t *lastp; gpgme_invalid_key_t *lastp;
} *op_data_t; } *op_data_t;
@ -45,12 +45,13 @@ static void
release_op_data (void *hook) release_op_data (void *hook)
{ {
op_data_t opd = (op_data_t) hook; op_data_t opd = (op_data_t) hook;
gpgme_invalid_user_id_t invalid_recipient = opd->result.invalid_recipients; gpgme_invalid_key_t invalid_recipient = opd->result.invalid_recipients;
while (invalid_recipient) while (invalid_recipient)
{ {
gpgme_invalid_user_id_t next = invalid_recipient->next; gpgme_invalid_key_t next = invalid_recipient->next;
free (invalid_recipient->id); if (invalid_recipient->fpr)
free (invalid_recipient->fpr);
invalid_recipient = next; invalid_recipient = next;
} }
} }
@ -95,7 +96,7 @@ _gpgme_encrypt_status_handler (void *priv, gpgme_status_code_t code,
break; break;
case GPGME_STATUS_INV_RECP: case GPGME_STATUS_INV_RECP:
err = _gpgme_parse_inv_userid (args, opd->lastp); err = _gpgme_parse_inv_recp (args, opd->lastp);
if (err) if (err)
return err; return err;

View File

@ -142,11 +142,11 @@ int gpgme_err_code_to_errno (gpgme_err_code_t code);
/* Return an error value with the error source SOURCE and the system /* Return an error value with the error source SOURCE and the system
error ERR. */ error ERR. */
gpgme_error_t gpgme_err_make_from_errno (gpg_err_source_t source, int err); gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err);
/* Return an error value with the system error ERR. */ /* Return an error value with the system error ERR. */
gpgme_err_code_t gpg_error_from_errno (int err); gpgme_err_code_t gpgme_error_from_errno (int err);
/* The possible encoding mode of gpgme_data_t objects. */ /* The possible encoding mode of gpgme_data_t objects. */
@ -968,20 +968,20 @@ unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx,
/* Crypto Operations. */ /* Crypto Operations. */
struct _gpgme_invalid_user_id struct _gpgme_invalid_key
{ {
struct _gpgme_invalid_user_id *next; struct _gpgme_invalid_key *next;
char *id; char *fpr;
gpgme_error_t reason; gpgme_error_t reason;
}; };
typedef struct _gpgme_invalid_user_id *gpgme_invalid_user_id_t; typedef struct _gpgme_invalid_key *gpgme_invalid_key_t;
/* Encryption. */ /* Encryption. */
struct _gpgme_op_encrypt_result struct _gpgme_op_encrypt_result
{ {
/* The list of invalid recipients. */ /* The list of invalid recipients. */
gpgme_invalid_user_id_t invalid_recipients; gpgme_invalid_key_t invalid_recipients;
}; };
typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t; typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t;
@ -1059,7 +1059,7 @@ typedef struct _gpgme_new_signature *gpgme_new_signature_t;
struct _gpgme_op_sign_result struct _gpgme_op_sign_result
{ {
/* The list of invalid signers. */ /* The list of invalid signers. */
gpgme_invalid_user_id_t invalid_signers; gpgme_invalid_key_t invalid_signers;
gpgme_new_signature_t signatures; gpgme_new_signature_t signatures;
}; };
typedef struct _gpgme_op_sign_result *gpgme_sign_result_t; typedef struct _gpgme_op_sign_result *gpgme_sign_result_t;
@ -1466,7 +1466,6 @@ typedef gpgme_data_write_cb_t GpgmeDataWriteCb _GPGME_DEPRECATED;
typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED; typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED;
typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED; typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED;
#define GpgmeDataCbs gpgme_data_cbs #define GpgmeDataCbs gpgme_data_cbs
typedef gpgme_invalid_user_id_t GpgmeInvalidUserID _GPGME_DEPRECATED;
typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED; typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED;
typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED; typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED;
typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED; typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED;

View File

@ -113,22 +113,22 @@ _gpgme_op_reset (gpgme_ctx_t ctx, int type)
gpgme_error_t gpgme_error_t
_gpgme_parse_inv_userid (char *args, gpgme_invalid_user_id_t *userid) _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key)
{ {
gpgme_invalid_user_id_t inv_userid; gpgme_invalid_key_t inv_key;
char *tail; char *tail;
long int reason; long int reason;
inv_userid = malloc (sizeof (*inv_userid)); inv_key = malloc (sizeof (*inv_key));
if (!inv_userid) if (!inv_key)
return gpg_error_from_errno (errno); return gpg_error_from_errno (errno);
inv_userid->next = NULL; inv_key->next = NULL;
errno = 0; errno = 0;
reason = strtol (args, &tail, 0); reason = strtol (args, &tail, 0);
if (errno || args == tail || *tail != ' ') if (errno || args == tail || *tail != ' ')
{ {
/* The crypto backend does not behave. */ /* The crypto backend does not behave. */
free (inv_userid); free (inv_key);
return gpg_error (GPG_ERR_INV_ENGINE); return gpg_error (GPG_ERR_INV_ENGINE);
} }
@ -136,48 +136,47 @@ _gpgme_parse_inv_userid (char *args, gpgme_invalid_user_id_t *userid)
{ {
default: default:
case 0: case 0:
inv_userid->reason = gpg_error (GPG_ERR_GENERAL); inv_key->reason = gpg_error (GPG_ERR_GENERAL);
break; break;
case 1: case 1:
inv_userid->reason = gpg_error (GPG_ERR_NO_PUBKEY); inv_key->reason = gpg_error (GPG_ERR_NO_PUBKEY);
break; break;
case 2: case 2:
/* FIXME: Ambiguous specification. */ inv_key->reason = gpg_error (GPG_ERR_AMBIGUOUS_NAME);
inv_userid->reason = gpg_error (GPG_ERR_AMBIGUOUS_NAME);
break; break;
case 3: case 3:
inv_userid->reason = gpg_error (GPG_ERR_WRONG_KEY_USAGE); inv_key->reason = gpg_error (GPG_ERR_WRONG_KEY_USAGE);
break; break;
case 4: case 4:
inv_userid->reason = gpg_error (GPG_ERR_CERT_REVOKED); inv_key->reason = gpg_error (GPG_ERR_CERT_REVOKED);
break; break;
case 5: case 5:
inv_userid->reason = gpg_error (GPG_ERR_CERT_EXPIRED); inv_key->reason = gpg_error (GPG_ERR_CERT_EXPIRED);
break; break;
case 6: case 6:
inv_userid->reason = gpg_error (GPG_ERR_NO_CRL_KNOWN); inv_key->reason = gpg_error (GPG_ERR_NO_CRL_KNOWN);
break; break;
case 7: case 7:
inv_userid->reason = gpg_error (GPG_ERR_CRL_TOO_OLD); inv_key->reason = gpg_error (GPG_ERR_CRL_TOO_OLD);
break; break;
case 8: case 8:
inv_userid->reason = gpg_error (GPG_ERR_NO_POLICY_MATCH); inv_key->reason = gpg_error (GPG_ERR_NO_POLICY_MATCH);
break; break;
case 9: case 9:
inv_userid->reason = gpg_error (GPG_ERR_NO_SECKEY); inv_key->reason = gpg_error (GPG_ERR_NO_SECKEY);
break; break;
case 10: case 10:
inv_userid->reason = gpg_error (GPG_ERR_PUBKEY_NOT_TRUSTED); inv_key->reason = gpg_error (GPG_ERR_PUBKEY_NOT_TRUSTED);
break; break;
} }
@ -185,17 +184,17 @@ _gpgme_parse_inv_userid (char *args, gpgme_invalid_user_id_t *userid)
tail++; tail++;
if (*tail) if (*tail)
{ {
inv_userid->id = strdup (tail); inv_key->fpr = strdup (tail);
if (!inv_userid->id) if (!inv_key->fpr)
{ {
int saved_errno = errno; int saved_errno = errno;
free (inv_userid); free (inv_key);
return gpg_error_from_errno (saved_errno); return gpg_error_from_errno (saved_errno);
} }
} }
else else
inv_userid->id = NULL; inv_key->fpr = NULL;
*userid = inv_userid; *key = inv_key;
return 0; return 0;
} }

View File

@ -49,10 +49,9 @@ gpgme_error_t _gpgme_op_data_lookup (gpgme_ctx_t ctx, ctx_op_data_id_t type,
/* Prepare a new operation on CTX. */ /* Prepare a new operation on CTX. */
gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int synchronous); gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int synchronous);
/* Parse the invalid user ID status line in ARGS and return the result /* Parse the INV_RECP status line in ARGS and return the result in
in USERID. */ KEY. */
gpgme_error_t _gpgme_parse_inv_userid (char *args, gpgme_error_t _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key);
gpgme_invalid_user_id_t *userid);
/* From verify.c. */ /* From verify.c. */

View File

@ -37,7 +37,7 @@ typedef struct
/* A pointer to the next pointer of the last invalid signer in /* A pointer to the next pointer of the last invalid signer in
the list. This makes appending new invalid signers painless the list. This makes appending new invalid signers painless
while preserving the order. */ while preserving the order. */
gpgme_invalid_user_id_t *last_signer_p; gpgme_invalid_key_t *last_signer_p;
/* Likewise for signature information. */ /* Likewise for signature information. */
gpgme_new_signature_t *last_sig_p; gpgme_new_signature_t *last_sig_p;
@ -48,13 +48,14 @@ static void
release_op_data (void *hook) release_op_data (void *hook)
{ {
op_data_t opd = (op_data_t) hook; op_data_t opd = (op_data_t) hook;
gpgme_invalid_user_id_t invalid_signer = opd->result.invalid_signers; gpgme_invalid_key_t invalid_signer = opd->result.invalid_signers;
gpgme_new_signature_t sig = opd->result.signatures; gpgme_new_signature_t sig = opd->result.signatures;
while (invalid_signer) while (invalid_signer)
{ {
gpgme_invalid_user_id_t next = invalid_signer->next; gpgme_invalid_key_t next = invalid_signer->next;
free (invalid_signer->id); if (invalid_signer->fpr)
free (invalid_signer->fpr);
free (invalid_signer); free (invalid_signer);
invalid_signer = next; invalid_signer = next;
} }
@ -213,7 +214,7 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args)
break; break;
case GPGME_STATUS_INV_RECP: case GPGME_STATUS_INV_RECP:
err = _gpgme_parse_inv_userid (args, opd->last_signer_p); err = _gpgme_parse_inv_recp (args, opd->last_signer_p);
if (err) if (err)
return err; return err;
@ -222,7 +223,7 @@ _gpgme_sign_status_handler (void *priv, gpgme_status_code_t code, char *args)
case GPGME_STATUS_EOF: case GPGME_STATUS_EOF:
if (opd->result.invalid_signers) if (opd->result.invalid_signers)
return gpg_error (GPG_ERR_INV_USER_ID); return gpg_error (GPG_ERR_UNUSABLE_SECKEY);
break; break;
default: default:

View File

@ -34,7 +34,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
if (result->invalid_signers) if (result->invalid_signers)
{ {
fprintf (stderr, "Invalid signer found: %s\n", fprintf (stderr, "Invalid signer found: %s\n",
result->invalid_signers->id); result->invalid_signers->fpr);
exit (1); exit (1);
} }
if (!result->signatures || result->signatures->next) if (!result->signatures || result->signatures->next)
@ -117,7 +117,7 @@ main (int argc, char **argv)
if (result->invalid_recipients) if (result->invalid_recipients)
{ {
fprintf (stderr, "Invalid recipient encountered: %s\n", fprintf (stderr, "Invalid recipient encountered: %s\n",
result->invalid_recipients->id); result->invalid_recipients->fpr);
exit (1); exit (1);
} }
sign_result = gpgme_op_sign_result (ctx); sign_result = gpgme_op_sign_result (ctx);

View File

@ -64,7 +64,7 @@ main (int argc, char *argv[])
if (result->invalid_recipients) if (result->invalid_recipients)
{ {
fprintf (stderr, "Invalid recipient encountered: %s\n", fprintf (stderr, "Invalid recipient encountered: %s\n",
result->invalid_recipients->id); result->invalid_recipients->fpr);
exit (1); exit (1);
} }
print_data (out); print_data (out);

View File

@ -34,7 +34,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
if (result->invalid_signers) if (result->invalid_signers)
{ {
fprintf (stderr, "Invalid signer found: %s\n", fprintf (stderr, "Invalid signer found: %s\n",
result->invalid_signers->id); result->invalid_signers->fpr);
exit (1); exit (1);
} }
if (!result->signatures || result->signatures->next) if (!result->signatures || result->signatures->next)

View File

@ -36,7 +36,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
if (result->invalid_signers) if (result->invalid_signers)
{ {
fprintf (stderr, "Invalid signer found: %s\n", fprintf (stderr, "Invalid signer found: %s\n",
result->invalid_signers->id); result->invalid_signers->fpr);
exit (1); exit (1);
} }
if (!result->signatures || !result->signatures->next if (!result->signatures || !result->signatures->next

View File

@ -46,11 +46,11 @@ print_data (gpgme_data_t dh)
ret = gpgme_data_seek (dh, 0, SEEK_SET); ret = gpgme_data_seek (dh, 0, SEEK_SET);
if (ret) if (ret)
fail_if_err (gpgme_error_from_errno (errno)); fail_if_err (gpgme_err_code_from_errno (errno));
while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0) while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0)
fwrite (buf, ret, 1, stdout); fwrite (buf, ret, 1, stdout);
if (ret < 0) if (ret < 0)
fail_if_err (gpgme_error_from_errno (errno)); fail_if_err (gpgme_err_code_from_errno (errno));
} }

View File

@ -59,7 +59,7 @@ main (int argc, char **argv)
if (result->invalid_recipients) if (result->invalid_recipients)
{ {
fprintf (stderr, "Invalid recipient encountered: %s\n", fprintf (stderr, "Invalid recipient encountered: %s\n",
result->invalid_recipients->id); result->invalid_recipients->fpr);
exit (1); exit (1);
} }
print_data (out); print_data (out);

View File

@ -32,7 +32,7 @@ check_result (gpgme_sign_result_t result, gpgme_sig_mode_t type)
if (result->invalid_signers) if (result->invalid_signers)
{ {
fprintf (stderr, "Invalid signer found: %s\n", fprintf (stderr, "Invalid signer found: %s\n",
result->invalid_signers->id); result->invalid_signers->fpr);
exit (1); exit (1);
} }
if (!result->signatures || result->signatures->next) if (!result->signatures || result->signatures->next)