Add gpgme_io_write and gpgme_io_read.
Minor cleanups.
This commit is contained in:
parent
621ffc14ae
commit
caf36ce1ce
6
NEWS
6
NEWS
@ -8,6 +8,10 @@ Noteworthy changes in version 1.1.9
|
|||||||
selftest failed (for example, if -mms-bitfields was not used on
|
selftest failed (for example, if -mms-bitfields was not used on
|
||||||
MingW32 targets).
|
MingW32 targets).
|
||||||
|
|
||||||
|
* New functions gpgme_io_read and gpgme_io_write for use with
|
||||||
|
gpgme_passphrase_cb_t and gpgme_edit_cb_t functions.
|
||||||
|
|
||||||
|
|
||||||
* Interface changes relative to the 1.1.7 release:
|
* Interface changes relative to the 1.1.7 release:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
GPGME_KEYLIST_MODE_EPHEMERAL NEW.
|
GPGME_KEYLIST_MODE_EPHEMERAL NEW.
|
||||||
@ -22,6 +26,8 @@ Noteworthy changes in version 1.1.9
|
|||||||
GPGME_ENCRYPT_NO_ENCRYPT_TO NEW.
|
GPGME_ENCRYPT_NO_ENCRYPT_TO NEW.
|
||||||
gpgme_check_version CHANGED: Is now a macro.
|
gpgme_check_version CHANGED: Is now a macro.
|
||||||
gpgme_new EXTENDED: More failure codes.
|
gpgme_new EXTENDED: More failure codes.
|
||||||
|
gpgme_io_read NEW.
|
||||||
|
gpgme_io_write NEW.
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
2009-06-09 Werner Koch <wk@g10code.com>
|
2009-06-09 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* version.c (gpgme_check_version_internal): Make result const.
|
||||||
|
|
||||||
|
* gpgme.c: Include priv-io.h.
|
||||||
|
(gpgme_io_read, gpgme_io_write): New.
|
||||||
|
* libgpgme.vers (GPGME_1.1): Add them.
|
||||||
|
* gpgme.def: Ditto.
|
||||||
|
|
||||||
* Makefile.am (main_sources): Remove gpgme.h.
|
* Makefile.am (main_sources): Remove gpgme.h.
|
||||||
(include_HEADERS): Rename to nodist_include_HEADERS so that a
|
(include_HEADERS): Rename to nodist_include_HEADERS so that a
|
||||||
VPATH build won't use the distributed one.
|
VPATH build won't use the distributed one.
|
||||||
|
28
src/gpgme.c
28
src/gpgme.c
@ -34,6 +34,7 @@
|
|||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
#include "wait.h"
|
#include "wait.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "priv-io.h"
|
||||||
|
|
||||||
|
|
||||||
/* The default locale. */
|
/* The default locale. */
|
||||||
@ -428,6 +429,33 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This function provides access to the internal read function; it is
|
||||||
|
normally not used. */
|
||||||
|
ssize_t
|
||||||
|
gpgme_io_read (int fd, void *buffer, size_t count)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = _gpgme_io_read (fd, buffer, count);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This function provides access to the internal write function. It
|
||||||
|
is to be used by user callbacks to return data to gpgme. See
|
||||||
|
gpgme_passphrase_cb_t and gpgme_edit_cb_t. */
|
||||||
|
ssize_t
|
||||||
|
gpgme_io_write (int fd, const void *buffer, size_t count)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = _gpgme_io_write (fd, buffer, count);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function returns the callback function for I/O. */
|
/* This function returns the callback function for I/O. */
|
||||||
void
|
void
|
||||||
gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
|
gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
|
||||||
|
@ -174,5 +174,9 @@ EXPORTS
|
|||||||
|
|
||||||
gpgme_check_version_internal @135
|
gpgme_check_version_internal @135
|
||||||
|
|
||||||
|
gpgme_io_read @136
|
||||||
|
gpgme_io_write @137
|
||||||
|
|
||||||
|
|
||||||
; END
|
; END
|
||||||
|
|
||||||
|
@ -961,6 +961,11 @@ void gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
|
|||||||
/* Get the current I/O callback functions. */
|
/* Get the current I/O callback functions. */
|
||||||
void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
|
void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
|
||||||
|
|
||||||
|
/* Wrappers around the internal I/O functions for use with
|
||||||
|
gpgme_passphrase_cb_t and gpgme_edit_cb_t. */
|
||||||
|
ssize_t gpgme_io_read (int fd, void *buffer, size_t count);
|
||||||
|
ssize_t gpgme_io_write (int fd, const void *buffer, size_t count);
|
||||||
|
|
||||||
/* Process the pending operation and, if HANG is non-zero, wait for
|
/* Process the pending operation and, if HANG is non-zero, wait for
|
||||||
the pending operation to finish. */
|
the pending operation to finish. */
|
||||||
gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
|
gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);
|
||||||
|
@ -53,6 +53,10 @@ GPGME_1.1 {
|
|||||||
gpgme_op_assuan_transact_start;
|
gpgme_op_assuan_transact_start;
|
||||||
|
|
||||||
gpgme_check_version_internal;
|
gpgme_check_version_internal;
|
||||||
|
|
||||||
|
gpgme_io_read;
|
||||||
|
gpgme_io_write;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ const char *
|
|||||||
gpgme_check_version_internal (const char *req_version,
|
gpgme_check_version_internal (const char *req_version,
|
||||||
size_t offset_sig_validity)
|
size_t offset_sig_validity)
|
||||||
{
|
{
|
||||||
char *result;
|
const char *result;
|
||||||
|
|
||||||
TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
|
TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
|
||||||
"req_version=%s, offset_sig_validity=%i",
|
"req_version=%s, offset_sig_validity=%i",
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2009-06-09 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpg/Makefile.am (./pubring.gpg): Ignore errors in case of
|
||||||
|
already imported keys. Add --no-permission-warning and remove
|
||||||
|
obsolete --allow-secret-key-import.
|
||||||
|
* gpg/mkdemodirs.in (GPG): Add --no-permission-warning.
|
||||||
|
|
||||||
|
* gpg/t-edit.c (edit_fnc): Use gpgme_io_write.
|
||||||
|
|
||||||
2009-04-19 Moritz <moritz@gnu.org>
|
2009-04-19 Moritz <moritz@gnu.org>
|
||||||
|
|
||||||
* gpg/Makefile.am (EXTRA_DIST): Replaced mkdemodirs with mkdemodirs.in.
|
* gpg/Makefile.am (EXTRA_DIST): Replaced mkdemodirs with mkdemodirs.in.
|
||||||
|
@ -63,8 +63,9 @@ clean-local:
|
|||||||
all-local: ./pubring.gpg ./gpg.conf ./gpg-agent.conf
|
all-local: ./pubring.gpg ./gpg.conf ./gpg-agent.conf
|
||||||
|
|
||||||
./pubring.gpg: $(srcdir)/pubdemo.asc ./Alpha/Secret.gpg
|
./pubring.gpg: $(srcdir)/pubdemo.asc ./Alpha/Secret.gpg
|
||||||
$(GPG) --homedir . --import $(srcdir)/pubdemo.asc
|
-$(GPG) --homedir . --no-permission-warning \
|
||||||
$(GPG) --homedir . --allow-secret-key-import \
|
--import $(srcdir)/pubdemo.asc
|
||||||
|
-$(GPG) --homedir . --no-permission-warning \
|
||||||
--import Alpha/Secret.gpg Zulu/Secret.gpg
|
--import Alpha/Secret.gpg Zulu/Secret.gpg
|
||||||
|
|
||||||
./Alpha/Secret.gpg: mkdemodirs secdemo.asc
|
./Alpha/Secret.gpg: mkdemodirs secdemo.asc
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
GPG="@GPG@ --batch --quiet --no-secmem-warning"
|
GPG="@GPG@ --batch --quiet --no-secmem-warning --no-permission-warning"
|
||||||
NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India
|
NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India
|
||||||
Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo
|
Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo
|
||||||
Sierra Tango Uniform Victor Whisky XRay Yankee Zulu'
|
Sierra Tango Uniform Victor Whisky XRay Yankee Zulu'
|
||||||
@ -45,7 +45,7 @@ for name in $NAMES; do
|
|||||||
[ -d $name ] && rm -r $name
|
[ -d $name ] && rm -r $name
|
||||||
mkdir $name
|
mkdir $name
|
||||||
$GPGDEMO --export-secret-key -o - $name > $name/Secret.gpg
|
$GPGDEMO --export-secret-key -o - $name > $name/Secret.gpg
|
||||||
$GPG --homedir $name --allow-secret-key-import --import $name/Secret.gpg
|
$GPG --homedir $name --import $name/Secret.gpg
|
||||||
$GPGDEMO --export -o - $name > $name/Public.gpg
|
$GPGDEMO --export -o - $name > $name/Public.gpg
|
||||||
$GPG --homedir $name --import $name/Public.gpg
|
$GPG --homedir $name --import $name/Public.gpg
|
||||||
[ -f $name/pubring.gpg~ ] && rm $name/pubring.gpg~
|
[ -f $name/pubring.gpg~ ] && rm $name/pubring.gpg~
|
||||||
|
@ -103,8 +103,8 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
write (fd, result, strlen (result));
|
gpgme_io_write (fd, result, strlen (result));
|
||||||
write (fd, "\n", 1);
|
gpgme_io_write (fd, "\n", 1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user