diff options
author | Marcus Brinkmann <[email protected]> | 2003-01-29 15:20:58 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2003-01-29 15:20:58 +0000 |
commit | 2c543f6a86969e6437289471975a3e3d333b4d3c (patch) | |
tree | 31f453f5417641484a99d4ab69522542af3c2377 /gpgme/passphrase.c | |
parent | 2003-01-29 Marcus Brinkmann <[email protected]> (diff) | |
download | gpgme-2c543f6a86969e6437289471975a3e3d333b4d3c.tar.gz gpgme-2c543f6a86969e6437289471975a3e3d333b4d3c.zip |
doc/
2003-01-29 Marcus Brinkmann <[email protected]>
* gpgme.texi (I/O Callback Interface): Document new even
GPGME_EVENT_START.
(Waiting For Completion): Document new possible return values.
(I/O Callback Interface): Document return type of GpgmeIOCb.
gpgme/
2003-01-29 Marcus Brinkmann <[email protected]>
* context.h (gpgme_context_s): Remove member ERROR.
* types.h (GpgmeStatusHandler): Change return type to GpgmeError.
(GpgmeCommandHandler): Change return type to GpgmeError and add
new argument RESULT.
* gpgme.h (GpgmeIOCb): Change return type to GpgmeError.
(GpgmeEventIO): New event GPGME_EVENT_START.
(GpgmeIdleFunc): Remove type.
(gpgme_register_idle): Remove prototype.
* data.c: Include <assert.h>.
(_gpgme_data_inbound_handler): Change return type to GpgmeError.
Return any error instead ignoring it, don't close file descriptor
on error.
(_gpgme_data_outbound_handler): Likewise.
* decrypt.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(_gpgme_decrypt_status_handler): Change return type to GpgmeError.
Return error instead setting ctx->error. Return success at end of
function.
(gpgme_op_decrypt): Don't work around the old kludge anymore.
* decrypt-verify.c (decrypt_verify_status_handler): Change return
type to GpgmeError. Return possible errors.
* delete.c: Do not include <stdio.h>, <string.h>, <time.h> and
<assert.h>.
(delete_status_handler): Change return type to GpgmeError. Return
error instead setting ctx->error. Return success at end of
function.
* edit.c: Do not include <stdio.h> and <string.h>.
(_gpgme_edit_status_handler): Change type to GpgmeError,
make static and rename to ...
(edit_status_handler): ... this. Return error directly.
(command_handler): Change return type to GpgmeError, add result
argument. Return error directly.
* encrypt.c (status_handler_finish): Remove function.
(_gpgme_encrypt_status_handler): Change return type to GpgmeError.
Return error directly.
(_gpgme_encrypt_sym_status_handler): Likewise.
* encrypt-sign.c (encrypt_sign_status_handler): Likewise.
* engine-gpgsm.c (close_notify_handler): Do not signal done event
anymore.
(status_handler): Change return type to GpgmeError. Diddle things
around a bit to return errors directly.
(start): Send start event.
* export.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(export_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* genkey.c: Do not include <stdio.h> and <assert.h>.
(genkey_status_handler): Change return type to GpgmeError. Don't
check ctx->error. Return errors directly.
* gpgme.c (_gpgme_release_result): Do not initialize ctx->error.
(_gpgme_op_event_cb): Function removed.
(_gpgme_op_event_cb_user): Likewise.
* import.c: Do not include <stdio.h>, <string.h> and <assert.h>.
(import_status_handler): Change return type to GpgmeError. Don't
check ctx->error.
* keylist.c (keylist_colon_handler, keylist_status_handler, finish_key):
Change return type to GpgmeError, return error directly.
* Makefile (libgpgme_la_SOURCES): Add wait-global.c,
wait-private.c and wait-user.c
* ops.h (test_and_allocate_result): Return error instead setting
ctx->error.
(_gpgme_data_inbound_handler, _gpgme_data_outbound_handler,
_gpgme_verify_status_handler, _gpgme_decrypt_status_handler,
_gpgme_sign_status_handler, _gpgme_encrypt_staus_handler,
_gpgme_passphrase_status_handler, _gpgme_progress_status_handler):
Change return type to GpgmeError.
(_gpgme_passphease_command_handler): Change return type to
GpgmeError and add new argument RESULT.
* op-support.c: Use new callback functions, and change private
data to ctx everywhere.
* passphrase.c (_gpgme_passphrase_status_handler): Change return
type to GpgmeError, return error directly.
(_gpgme_passphrase_command_handler): Change return type to
GpgmeError, add result argument. Return results accordingly.
* progress.c (_gpgme_progress_status_handler): Change return type
to GpgmeError, return errors directly.
* rungpg.c (status_handler): Change return type to GpgmeError.
Return error directly.
(close_notify_handler): Don't send done event.
(colon_line_handler): Change return type to GpgmeError, return
errors directly.
* rungpg.c (start): Send start event.
* sign.c (_gpgme_sign_status_handler): Change return type to
GpgmeError, return errors directly.
* trustlist.c (trustlist_status_handler): Change return type to
GpgmeError. Return 0.
(trustlist_colon_handler): Change return type GpgmeError. Return
errors directly.
* verify.c (add_notation): Change return type to GpgmeError,
return errors directly.
(_gpgme_verify_status_handler): Likewise.
* wait.h (struct fd_table): Remove lock member.
(struct wait_item_s): Moved here from wait.c.
(struct tag): New structure.
(_gpgme_wait_event_cb): Remove prototype.
(_gpgme_wait_private_event_cb, _gpgme_wait_global_event_cb,
_gpgme_wait_user_add_io_cb, _gpgme_wait_user_remove_io_cb,
_gpgme_wait_user_event_io_cb): New prototypes.
* wait.c: Don't include <stdio.h>.
(ftd_global, ctx_done_list, ctx_done_list_size,
ctx_done_list_length, ctx_done_list_lock, idle_function): Remove
global variable.
(gpgme_register_idle, do_select, _gpgme_wait_event_cb): Remove
function.
(gpgme_wait): Move to file wait-global.c.
(_gpgme_add_io_cb): Take ctx as private argument, initialize ctx
member in wait item and tag.
(_gpgme_remove_io_cb): Take ctx from tag. Don't use FDT lock.
(_gpgme_wait_one, _gpgme_wait_on_condition): Move to
wait-private.c.
(gpgme_fd_table_init): Don't initialize FDT->lock.
(gpgme_fd_table_deinit): Don't destroy FDT->lock.
(_gpgme_fd_table_put): Make static and rename to ...
(fd_table_put): ... this function. Don't use FDT->lock.
(struct wait_item_s): Move to wait.h.
* wait-global.c: New file.
* wait-private.c: New file.
* wait-user.c: New file.
Diffstat (limited to '')
-rw-r--r-- | gpgme/passphrase.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/gpgme/passphrase.c b/gpgme/passphrase.c index a8900a7b..9bcbd17b 100644 --- a/gpgme/passphrase.c +++ b/gpgme/passphrase.c @@ -52,11 +52,9 @@ _gpgme_release_passphrase_result (PassphraseResult result) } -void +GpgmeError _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args) { - if (ctx->error) - return; test_and_allocate_result (ctx, passphrase); switch (code) @@ -64,7 +62,7 @@ _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args case GPGME_STATUS_USERID_HINT: free (ctx->result.passphrase->userid_hint); if (!(ctx->result.passphrase->userid_hint = strdup (args))) - ctx->error = mk_error (Out_Of_Core); + return mk_error (Out_Of_Core); break; case GPGME_STATUS_BAD_PASSPHRASE: @@ -82,7 +80,7 @@ _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args free (ctx->result.passphrase->passphrase_info); ctx->result.passphrase->passphrase_info = strdup (args); if (!ctx->result.passphrase->passphrase_info) - ctx->error = mk_error (Out_Of_Core); + return mk_error (Out_Of_Core); break; case GPGME_STATUS_MISSING_PASSPHRASE: @@ -93,18 +91,20 @@ _gpgme_passphrase_status_handler (GpgmeCtx ctx, GpgmeStatusCode code, char *args case GPGME_STATUS_EOF: if (ctx->result.passphrase->no_passphrase || ctx->result.passphrase->bad_passphrase) - ctx->error = mk_error (No_Passphrase); + return mk_error (No_Passphrase); break; default: /* Ignore all other codes. */ break; } + return 0; } -const char * -_gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code, const char *key) +GpgmeError +_gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code, + const char *key, const char **result) { GpgmeCtx ctx = opaque; @@ -112,10 +112,7 @@ _gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code, const cha { ctx->result.passphrase = calloc (1, sizeof *ctx->result.passphrase); if (!ctx->result.passphrase) - { - ctx->error = mk_error (Out_Of_Core); - return NULL; - } + return mk_error (Out_Of_Core); } if (!code) @@ -127,11 +124,15 @@ _gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code, const cha ctx->passphrase_cb (ctx->passphrase_cb_value, NULL, &ctx->result.passphrase->last_pw_handle); } - return NULL; + *result = NULL; + return 0; } if (!key || !ctx->passphrase_cb) - return NULL; + { + *result = NULL; + return 0; + } if (code == GPGME_STATUS_GET_HIDDEN && !strcmp (key, "passphrase.enter")) { @@ -139,7 +140,6 @@ _gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code, const cha const char *passphrase_info = ctx->result.passphrase->passphrase_info; int bad_passphrase = ctx->result.passphrase->bad_passphrase; char *buf; - const char *s; ctx->result.passphrase->bad_passphrase = 0; if (!userid_hint) @@ -149,21 +149,19 @@ _gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code, const cha buf = malloc (20 + strlen (userid_hint) + strlen (passphrase_info) + 3); if (!buf) - { - ctx->error = mk_error (Out_Of_Core); - return NULL; - } + return mk_error (Out_Of_Core); sprintf (buf, "%s\n%s\n%s", bad_passphrase ? "TRY_AGAIN":"ENTER", userid_hint, passphrase_info); - s = ctx->passphrase_cb (ctx->passphrase_cb_value, - buf, &ctx->result.passphrase->last_pw_handle); + *result = ctx->passphrase_cb (ctx->passphrase_cb_value, buf, + &ctx->result.passphrase->last_pw_handle); free (buf); - return s; + return 0; } - return NULL; + *result = NULL; + return 0; } |