doc/
2003-02-06 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Cancelling an Operation): Removed. (Passphrase Callback): Document new type for GpgmePassphraseCb. gpgme/ 2003-02-06 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError, and add argument for returning the result string. (gpgme_cancel): Remove prototype. * gpgme.c (gpgme_cancel): Remove function. * context.h (struct gpgme_context_s): Remove member cancel. * passphrase.c (_gpgme_passphrase_command_handler): Call the passphrase callback in the new way. tests/ 2003-02-06 Marcus Brinkmann <marcus@g10code.de> * gpg/t-decrypt.c (passphrase_cb): Fix to new prototype. * gpg/t-decrypt-verify.c (passphrase_cb): Likewise. * gpg/t-edit.c (passphrase_cb): Likewise. * gpg/t-encrypt-sign.c (passphrase_cb): Likewise. * gpg/t-encrypt-sym.c (passphrase_cb): Likewise. * gpg/t-sign.c (passphrase_cb): Likewise. * gpg/t-signers.c (passphrase_cb): Likewise.
This commit is contained in:
parent
654ab24164
commit
5a37051361
7
NEWS
7
NEWS
@ -36,6 +36,11 @@ Noteworthy changes in version 0.4.1 (unreleased)
|
||||
* The new function gpgme_get_protocol_name can be used to convert a
|
||||
GpgmeProtocol value into a string.
|
||||
|
||||
* The GpgmePassphraseCb type now returns a GpgmeError value, and
|
||||
returns the password string in a new parameter. The gpgme_cancel
|
||||
function has been removed, just return GPGME_Canceled in the
|
||||
passphrase callback directly.
|
||||
|
||||
* Interface changes relative to the 0.4.0 release:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
GpgmeIOCb CHANGED: Return type from void to GpgmeError.
|
||||
@ -49,6 +54,8 @@ gpgme_register_idle REMOVED
|
||||
GpgmeEngineInfo NEW
|
||||
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.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Noteworthy changes in version 0.4.0 (2002-12-23)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Cancelling an Operation): Removed.
|
||||
(Passphrase Callback): Document new type for GpgmePassphraseCb.
|
||||
|
||||
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.texi (Engine Information): Rename member part to
|
||||
|
@ -1537,20 +1537,25 @@ current mode otherwise. Note that 0 is not a valid mode value.
|
||||
@cindex callback, passphrase
|
||||
@cindex passphrase callback
|
||||
|
||||
@deftp {Data type} {const char *(*GpgmePassphraseCb)(void *@var{hook}, const char *@var{desc}, void **@var{r_hd})}
|
||||
@deftp {Data type} {GpgmeError (*GpgmePassphraseCb)(void *@var{hook}, const char *@var{desc}, void **@var{r_hd}, const char **@var{result})}
|
||||
@tindex GpgmePassphraseCb
|
||||
The @code{GpgmePassphraseCb} type is the type of functions usable as
|
||||
passphrase callback function.
|
||||
|
||||
The string @var{desc} contains a text usable to be displayed to the
|
||||
user of the application. The function should return a passphrase for
|
||||
the context when invoked with @var{desc} not being @code{NULL}.
|
||||
the context when invoked with @var{desc} not being @code{NULL} in
|
||||
*@var{result}.
|
||||
|
||||
The user may store information about the resources associated with the
|
||||
returned passphrase in @var{*r_hd}. When the passphrase is no longer
|
||||
needed by @acronym{GPGME}, the passphrase callback function will be
|
||||
called with @var{desc} being @var{NULL}, and @var{r_hd} being the same
|
||||
as at the first invocation.
|
||||
|
||||
If an error occurs, return the corresponding @code{GpgmeError} value.
|
||||
You can use @code{GPGME_Canceled} to abort the operation. Otherwise,
|
||||
return @code{0}.
|
||||
@end deftp
|
||||
|
||||
@deftypefun void gpgme_set_passphrase_cb (@w{GpgmeCtx @var{ctx}}, @w{GpgmePassphraseCb @var{passfunc}}, @w{void *@var{hook_value}})
|
||||
@ -3113,22 +3118,6 @@ error occurs, @code{NULL} is returned and the error is returned in
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@node Cancelling an Operation
|
||||
@subsection Cancelling an Operation
|
||||
@cindex cancellation
|
||||
@cindex cryptographic operation, cancel
|
||||
|
||||
@deftypefun void gpgme_cancel (@w{GpgmeCtx @var{ctx}})
|
||||
The function @code{gpgme_cancel} tries to cancel the pending
|
||||
operation. A running synchronous operation in the context or the
|
||||
function @code{gpgme_wait} with this context as its @var{ctx} argument
|
||||
might notice the cancellation flag and return. It is currently not
|
||||
guaranteed to work under all circumstances. Its current primary
|
||||
purpose is to prevent asking for a passphrase again in the passphrase
|
||||
callback.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@node Using External Event Loops
|
||||
@subsection Using External Event Loops
|
||||
@cindex event loop, external
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgme.h (GpgmePassphraseCb): Change type to return GpgmeError,
|
||||
and add argument for returning the result string.
|
||||
(gpgme_cancel): Remove prototype.
|
||||
* gpgme.c (gpgme_cancel): Remove function.
|
||||
* context.h (struct gpgme_context_s): Remove member cancel.
|
||||
* passphrase.c (_gpgme_passphrase_command_handler): Call the
|
||||
passphrase callback in the new way.
|
||||
|
||||
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* edit.c (_gpgme_edit_status_handler): Call the progress status
|
||||
|
@ -80,9 +80,6 @@ struct gpgme_context_s
|
||||
|
||||
int use_cms;
|
||||
|
||||
/* Cancel operation requested. */
|
||||
int cancel;
|
||||
|
||||
/* The running engine process. */
|
||||
EngineObject engine;
|
||||
|
||||
|
@ -43,7 +43,7 @@ edit_status_handler (GpgmeCtx ctx, GpgmeStatusCode status, char *args)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
GpgmeError err = _gpgme_progress_status_handler (ctx, status, args);
|
||||
err = _gpgme_progress_status_handler (ctx, status, args);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
@ -102,20 +102,6 @@ _gpgme_release_result (GpgmeCtx ctx)
|
||||
}
|
||||
|
||||
|
||||
/* Cancel the current operation. It is not guaranteed that it will
|
||||
work for all kinds of operations. It is especially useful in a
|
||||
passphrase callback to stop the system from asking another time for
|
||||
the passphrase. */
|
||||
void
|
||||
gpgme_cancel (GpgmeCtx ctx)
|
||||
{
|
||||
if (!ctx)
|
||||
return;
|
||||
|
||||
ctx->cancel = 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gpgme_get_notation:
|
||||
* @c: the context
|
||||
|
@ -334,8 +334,8 @@ typedef struct _gpgme_engine_info *GpgmeEngineInfo;
|
||||
/* Types for callback functions. */
|
||||
|
||||
/* Request a passphrase from the user. */
|
||||
typedef const char *(*GpgmePassphraseCb) (void *hook, const char *desc,
|
||||
void **r_hd);
|
||||
typedef GpgmeError (*GpgmePassphraseCb) (void *hook, const char *desc,
|
||||
void **r_hd, const char **result);
|
||||
|
||||
/* Inform the user about progress made. */
|
||||
typedef void (*GpgmeProgressCb) (void *opaque, const char *what,
|
||||
@ -487,9 +487,6 @@ void gpgme_set_io_cbs (GpgmeCtx ctx, struct GpgmeIOCbs *io_cbs);
|
||||
/* Get the current I/O callback functions. */
|
||||
void gpgme_get_io_cbs (GpgmeCtx ctx, struct GpgmeIOCbs *io_cbs);
|
||||
|
||||
/* Cancel a pending operation in CTX. */
|
||||
void gpgme_cancel (GpgmeCtx ctx);
|
||||
|
||||
/* Process the pending operation and, if HANG is non-zero, wait for
|
||||
the pending operation to finish. */
|
||||
GpgmeCtx gpgme_wait (GpgmeCtx ctx, GpgmeError *status, int hang);
|
||||
|
@ -125,13 +125,11 @@ _gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code,
|
||||
{
|
||||
/* We have been called for cleanup. */
|
||||
if (ctx->passphrase_cb)
|
||||
{
|
||||
/* Fixme: Take the key in account. */
|
||||
ctx->passphrase_cb (ctx->passphrase_cb_value, NULL,
|
||||
&result->last_pw_handle);
|
||||
}
|
||||
err = ctx->passphrase_cb (ctx->passphrase_cb_value, NULL,
|
||||
&result->last_pw_handle, NULL);
|
||||
*result_r = NULL;
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!key || !ctx->passphrase_cb)
|
||||
@ -160,10 +158,10 @@ _gpgme_passphrase_command_handler (void *opaque, GpgmeStatusCode code,
|
||||
bad_passphrase ? "TRY_AGAIN":"ENTER",
|
||||
userid_hint, passphrase_info);
|
||||
|
||||
*result_r = ctx->passphrase_cb (ctx->passphrase_cb_value, buf,
|
||||
&result->last_pw_handle);
|
||||
err = ctx->passphrase_cb (ctx->passphrase_cb_value, buf,
|
||||
&result->last_pw_handle, result_r);
|
||||
free (buf);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
*result_r = NULL;
|
||||
|
@ -306,8 +306,6 @@ gpgme_wait (GpgmeCtx ctx, GpgmeError *status, int hang)
|
||||
assert (ictx);
|
||||
|
||||
err = item->handler (item->handler_value, fdt.fds[i].fd);
|
||||
if (!err && ictx->cancel)
|
||||
err = GPGME_Canceled;
|
||||
if (err)
|
||||
{
|
||||
/* An error occured. Close all fds in this context,
|
||||
|
@ -110,8 +110,6 @@ _gpgme_wait_on_condition (GpgmeCtx ctx, volatile int *cond)
|
||||
item = (struct wait_item_s *) ctx->fdt.fds[i].opaque;
|
||||
|
||||
err = item->handler (item->handler_value, ctx->fdt.fds[i].fd);
|
||||
if (!err && ctx->cancel)
|
||||
err = GPGME_Canceled;
|
||||
if (err)
|
||||
{
|
||||
/* An error occured. Close all fds in this context,
|
||||
|
@ -1,3 +1,13 @@
|
||||
2003-02-06 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpg/t-decrypt.c (passphrase_cb): Fix to new prototype.
|
||||
* gpg/t-decrypt-verify.c (passphrase_cb): Likewise.
|
||||
* gpg/t-edit.c (passphrase_cb): Likewise.
|
||||
* gpg/t-encrypt-sign.c (passphrase_cb): Likewise.
|
||||
* gpg/t-encrypt-sym.c (passphrase_cb): Likewise.
|
||||
* gpg/t-sign.c (passphrase_cb): Likewise.
|
||||
* gpg/t-signers.c (passphrase_cb): Likewise.
|
||||
|
||||
2003-01-30 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* t-engine-info.c: Use file_name instead path throughout.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* t-decrypt-verify.c - regression test
|
||||
Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
Copyright (C) 2001, 2002 g10 Code GmbH
|
||||
Copyright (C) 2001, 2002, 2003 g10 Code GmbH
|
||||
|
||||
This file is part of GPGME.
|
||||
|
||||
@ -58,24 +58,22 @@ print_data (GpgmeData dh)
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb (void *opaque, const char *desc, void **r_hd)
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
|
||||
if (!desc)
|
||||
{
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return NULL;
|
||||
}
|
||||
return 0;
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass);
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
mk_fname (const char *fname)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* t-encrypt.c - regression test
|
||||
/* t-decrypt.c - regression test
|
||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
* Copyright (C) 2001, 2003 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
@ -41,21 +41,6 @@ struct passphrase_cb_info_s {
|
||||
exit (1); } \
|
||||
} while(0)
|
||||
|
||||
static void
|
||||
print_op_info (GpgmeCtx ctx)
|
||||
{
|
||||
char *str = gpgme_get_op_info (ctx, 0);
|
||||
|
||||
if (!str)
|
||||
puts ("<!-- no operation info available -->");
|
||||
else
|
||||
{
|
||||
puts (str);
|
||||
free (str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_data (GpgmeData dh)
|
||||
{
|
||||
@ -72,23 +57,19 @@ print_data (GpgmeData dh)
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb ( void *opaque, const char *desc, void **r_hd )
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
if (!desc)
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return 0;
|
||||
|
||||
if ( !desc ) {
|
||||
/* cleanup by looking at *r_hd */
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass );
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* t-edit.c - regression test
|
||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
* Copyright (C) 2001, 2002 g10 Code GmbH
|
||||
* Copyright (C) 2001, 2002, 2003 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
@ -57,22 +57,19 @@ flush_data (GpgmeData dh)
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb (void *opaque, const char *desc, void **r_hd)
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
|
||||
if (!desc)
|
||||
{
|
||||
/* cleanup by looking at *r_hd */
|
||||
return NULL;
|
||||
}
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return 0;
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass );
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,23 +62,19 @@ print_data (GpgmeData dh)
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb ( void *opaque, const char *desc, void **r_hd )
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
if (!desc)
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return 0;
|
||||
|
||||
if ( !desc ) {
|
||||
/* cleanup by looking at *r_hd */
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass );
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* t-encrypt.c - regression test
|
||||
/* t-encrypt-sym.c - regression test
|
||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
* Copyright (C) 2001, 2003 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
@ -47,24 +47,19 @@ print_data (GpgmeData dh)
|
||||
fail_if_err (GPGME_File_Error);
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb ( void *opaque, const char *desc, void **r_hd )
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
if (!desc)
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return 0;
|
||||
|
||||
if ( !desc ) {
|
||||
/* cleanup by looking at *r_hd */
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass );
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* t-sign.c - regression test
|
||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
* Copyright (C) 2001, 2003 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
@ -63,23 +63,19 @@ print_data (GpgmeData dh)
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb ( void *opaque, const char *desc, void **r_hd )
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
if (!desc)
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return 0;
|
||||
|
||||
if ( !desc ) {
|
||||
/* cleanup by looking at *r_hd */
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass );
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* t-signers.c - Regression tests for the Gpgme multiple signers interface.
|
||||
* Copyright (C) 2000 Werner Koch (dd9jn)
|
||||
* Copyright (C) 2001 g10 Code GmbH
|
||||
* Copyright (C) 2001, 2003 g10 Code GmbH
|
||||
*
|
||||
* This file is part of GPGME.
|
||||
*
|
||||
@ -62,25 +62,22 @@ print_data (GpgmeData dh)
|
||||
fail_if_err (GPGME_File_Error);
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
passphrase_cb (void *opaque, const char *desc, void **r_hd)
|
||||
static GpgmeError
|
||||
passphrase_cb (void *opaque, const char *desc,
|
||||
void **r_hd, const char **result)
|
||||
{
|
||||
const char *pass;
|
||||
|
||||
if (!desc)
|
||||
{
|
||||
/* cleanup by looking at *r_hd */
|
||||
return NULL;
|
||||
}
|
||||
/* Cleanup by looking at *r_hd. */
|
||||
return 0;
|
||||
|
||||
pass = "abc";
|
||||
*result = "abc";
|
||||
fprintf (stderr, "%% requesting passphrase for `%s': ", desc);
|
||||
fprintf (stderr, "sending `%s'\n", pass);
|
||||
fprintf (stderr, "sending `%s'\n", *result);
|
||||
|
||||
return pass;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user