mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
2009-09-23 Marcus Brinkmann <marcus@g10code.de>
* configure.ac (NEED_LIBASSUAN_API, NEED_LIBASSUAN_VERSION): Update to new API (2, 1.1.0). agent/ 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * gpg-agent.c (parse_rereadable_options): Don't set global assuan log file (there ain't one anymore). (main): Update to new API. (check_own_socket_pid_cb): Return gpg_error_t instead of int. (check_own_socket_thread, check_for_running_agent): Create assuan context before connecting to server. * command.c: Include "scdaemon.h" before <assuan.h> because of GPG_ERR_SOURCE_DEFAULT check. (write_and_clear_outbuf): Use gpg_error_t instead of assuan_error_t. (cmd_geteventcounter, cmd_istrusted, cmd_listtrusted) (cmd_marktrusted, cmd_havekey, cmd_sigkey, cmd_setkeydesc) (cmd_sethash, cmd_pksign, cmd_pkdecrypt, cmd_genkey, cmd_readkey) (cmd_keyinfo, cmd_get_passphrase, cmd_clear_passphrase) (cmd_get_confirmation, cmd_learn, cmd_passwd) (cmd_preset_passphrase, cmd_scd, cmd_getval, cmd_putval) (cmd_updatestartuptty, cmd_killagent, cmd_reloadagent) (cmd_getinfo, option_handler): Return gpg_error_t instead of int. (post_cmd_notify): Change type of ERR to gpg_error_t from int. (io_monitor): Add hook argument. Use symbols for constants. (register_commands): Change return type of HANDLER to gpg_error_t. (start_command_handler): Allocate assuan context before starting server. * call-pinentry.c: Include "scdaemon.h" before <assuan.h> because of GPG_ERR_SOURCE_DEFAULT check. (unlock_pinentry): Call assuan_release instead of assuan_disconnect. (getinfo_pid_cb, getpin_cb): Return gpg_error_t instead of int. (start_pinentry): Allocate assuan context before connecting to server. * call-scd.c (membuf_data_cb, learn_status_cb, get_serialno_cb) (membuf_data_cb, inq_needpin, card_getattr_cb, pass_status_thru) (pass_data_thru): Change return type to gpg_error_t. (start_scd): Allocate assuan context before connecting to server. common/ 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * asshelp.c (start_new_gpg_agent): Allocate assuan context before starting server. g10/ 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * call-agent.c: Include "scdaemon.h" before <assuan.h> because of GPG_ERR_SOURCE_DEFAULT check. (learn_status_cb, dummy_data_cb, get_serialno_cb, default_inq_cb) (learn_status_cb, inq_writecert_parms, inq_writekey_parms) (scd_genkey_cb, membuf_data_cb): Return gpg_error_t instead of int. * gpg.c: Include "scdaemon.h" before <assuan.h> because of GPG_ERR_SOURCE_DEFAULT check. (main): Update to new Assuan API. * server.c: Include "scdaemon.h" before <assuan.h> because of GPG_ERR_SOURCE_DEFAULT check. (option_handler, cmd_recipient, cmd_signer, cmd_encrypt) (cmd_decrypt, cmd_verify, cmd_sign, cmd_import, cmd_export) (cmd_delkeys, cmd_message, do_listkeys, cmd_listkeys) (cmd_listsecretkeys, cmd_genkey, cmd_getinfo): Return gpg_error_t instead of int. (register_commands): Allocate assuan context before starting server. (gpg_server): Allocate assuan_context before starting server. scd/ 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * command.c: Include "scdaemon.h" before <assuan.h> because of GPG_ERR_SOURCE_DEFAULT check. (option_handler, open_card, cmd_serialno, cmd_lean, cmd_readcert) (cmd_readkey, cmd_setdata, cmd_pksign, cmd_pkauth, cmd_pkdecrypt) (cmd_getattr, cmd_setattr, cmd_writecert, cmd_writekey) (cmd_genkey, cmd_random, cmd_passwd, cmd_checkpin, cmd_lock) (cmd_unlock, cmd_getinfo, cmd_restart, cmd_disconnect, cmd_apdu) (cmd_killscd): Return gpg_error_t instead of int. (scd_command_handler): Allocate assuan context before starting server. * scdaemon.c (main): Update to new Assuan API. sm/ 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * gpgsm.c (main): Update to new assuan API. * server.c: Include "gpgsm.h" before <assuan.h> due to check for GPG_ERR_SOURCE_DEFAULT and assuan.h now including gpg-error.h. (option_handler, cmd_recipient, cmd_signer, cmd_encrypt) (cmd_decrypt, cmd_verify, cmd_sign, cmd_import, cmd_export) (cmd_delkeys, cmd_message, cmd_listkeys, cmd_dumpkeys) (cmd_listsecretkeys, cmd_dumpsecretkeys, cmd_genkey) (cmd_getauditlog, cmd_getinfo): Return gpg_error_t instead of int. (register_commands): Same for member HANDLER in table. (gpgsm_server): Allocate assuan context before starting server. * sm/call-dirmngr.c: * call-dirmngr.c (prepare_dirmngr): Check for CTX and error before setting LDAPSERVER. (start_dirmngr_ext): Allocate assuan context before starting server. (inq_certificate, isvalid_status_cb, lookup_cb, lookup_status_cb) (run_command_cb, run_command_inq_cb, run_command_status_cb): Return gpg_error_t instead of int. tools/ 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * gpg-connect-agent.c (getinfo_pid_cb, read_and_print_response) (main): Update to new Assuan API. Conflicts: ChangeLog agent/ChangeLog agent/command.c common/ChangeLog g10/ChangeLog scd/ChangeLog sm/ChangeLog sm/gpgsm.c tools/ChangeLog Somehow this slipped through. Really commit this time. 2009-09-23 Marcus Brinkmann <marcus@g10code.de> * gpg-connect-agent.c (getinfo_pid_cb, read_and_print_response) (main): Update to new Assuan API. 2009-10-16 Marcus Brinkmann <marcus@g10code.com> * configure.ac: Check for libassuan instead of libassuan-pth. common/ 2009-10-16 Marcus Brinkmann <marcus@g10code.com> * Makefile.am (libcommon_a_CFLAGS): Use LIBASSUAN_CFLAGS instead of LIBASSUAN_PTH_CFLAGS. scd/ 2009-10-16 Marcus Brinkmann <marcus@g10code.com> * AM_CFLAGS, scdaemon_LDADD: Use libassuan instead of libassuan-pth. * scdaemon.c: Invoke ASSUAN_SYSTEM_PTH_IMPL. (main): Call assuan_set_system_hooks and assuan_sock_init. g13/ 2009-10-16 Marcus Brinkmann <marcus@g10code.com> * AM_CFLAGS, g13_LDADD: Use libassuan instead of libassuan-pth. * g13.c: Invoke ASSUAN_SYSTEM_PTH_IMPL. (main): Call assuan_set_system_hooks. agent/ 2009-10-16 Marcus Brinkmann <marcus@g10code.com> * gpg_agent_CFLAGS, gpg_agent_LDADD: Use libassuan instead of libassuan-pth. * gpg-agent.c: Invoke ASSUAN_SYSTEM_PTH_IMPL. (main): Call assuan_set_system_hooks and assuan_sock_init. Fix invocation of assuan_socket_connect. Conflicts: ChangeLog agent/ChangeLog common/ChangeLog configure.ac g13/ChangeLog g13/Makefile.am g13/g13.c scd/ChangeLog agent/ 2009-11-02 Marcus Brinkmann <marcus@g10code.de> * command.c (reset_notify): Take LINE arg and return error. (register_commands): Use assuan_handler_t type. common/ 2009-11-02 Marcus Brinkmann <marcus@g10code.de> * get-passphrase.c (default_inq_cb, membuf_data_cb): Change return type to gpg_error_t. g10/ 2009-11-02 Marcus Brinkmann <marcus@g10code.de> * server.c (reset_notify, input_notify, output_notify): Update to new assuan interface. (register_commands): Use assuan_handler_t. scd/ 2009-11-02 Marcus Brinkmann <marcus@g10code.de> * command.c (reset_notify): Take LINE arg and return error. (register_commands): Use assuan_handler_t type. sm/ 2009-11-02 Marcus Brinkmann <marcus@g10code.de> * server.c (reset_notify, input_notify, output_notify): Update to new assuan interface. (register_commands): Use assuan_handler_t. * call-agent.c (membuf_data_cb, default_inq_cb) (inq_ciphertext_cb, scd_serialno_status_cb) (scd_keypairinfo_status_cb, istrusted_status_cb) (learn_status_cb, learn_cb, keyinfo_status_cb): Return gpg_error_t. Conflicts: agent/ChangeLog common/ChangeLog g10/ChangeLog g10/server.c g13/ChangeLog g13/server.c scd/ChangeLog sm/ChangeLog Adjust for assuan_register_command change. Conflicts: agent/ChangeLog g10/ChangeLog g13/ChangeLog g13/server.c scd/ChangeLog sm/ChangeLog Add hack for the HELP command. Conflicts: tools/ChangeLog Add help strings for all commands. Conflicts: agent/ChangeLog agent/command.c Add help strings for all commands. Conflicts: scd/ChangeLog Add help strings for all commands Conflicts: sm/ChangeLog agent/ 2009-11-05 Marcus Brinkmann <marcus@g10code.de> * call-pinentry.c (start_pinentry): Call assuan_pipe_connect, not assuan_pipe_connect_ext. * command.c (start_command_handler): Change assuan_init_socket_server_ext into assuan_init_socket_server. * call-scd.c (start_scd): Update use of assuan_socket_connect and assuan_pipe_connect. * gpg-agent.c (check_own_socket_thread, check_for_running_agent): Update use of assuan_socket_connect. common/ 2009-11-05 Marcus Brinkmann <marcus@g10code.de> * asshelp.c (start_new_gpg_agent): Update use of assuan_socket_connect and assuan_pipe_connect. scd/ 2009-11-05 Marcus Brinkmann <marcus@g10code.de> * command.c (scd_command_handler): Call assuan_init_socket_server, not assuan_init_socket_server_ext. sm/ 2009-11-05 Marcus Brinkmann <marcus@g10code.de> * call-dirmngr.c (start_dirmngr_ext): Update use of assuan_pipe_connect and assuan_socket_connect. tools/ 2009-11-05 Marcus Brinkmann <marcus@g10code.de> * gpg-connect-agent.c (start_agent): Update use of assuan_socket_connect and assuan_pipe_connect. Conflicts: agent/ChangeLog common/ChangeLog g13/ChangeLog g13/call-gpg.c scd/ChangeLog sm/ChangeLog tools/ChangeLog agent/ 2009-11-25 Marcus Brinkmann <marcus@g10code.de> * command.c (start_command_handler): Use assuan_fd_t and assuan_fdopen on fds. scd/ 2009-11-25 Marcus Brinkmann <marcus@g10code.de> * command.c (scd_command_handler): Use assuan_fd_t and assuan_fdopen on fds. sm/ 2009-11-25 Marcus Brinkmann <marcus@g10code.de> * server.c (gpgsm_server): Use assuan_fd_t and assuan_fdopen on fds. g10/ 2009-11-25 Marcus Brinkmann <marcus@g10code.de> * server.c (gpg_server): Use assuan_fd_t and assuan_fdopen on fds. Conflicts: agent/ChangeLog g10/ChangeLog g13/server.c scd/ChangeLog sm/ChangeLog 2009-11-27 Marcus Brinkmann <marcus@g10code.de> * command.c (start_command_handler): Do not call assuan_set_log_stream anymore. * gpg-agent.c (main): But call assuan_set_assuan_log_stream here. Conflicts: agent/ChangeLog agent/command.c 2009-12-08 Marcus Brinkmann <marcus@g10code.de> * asshelp.c (start_new_gpg_agent) [HAVE_W32_SYSTEM]: Add missing argument in assuan_socket_connect invocation. * iobuf.c (iobuf_open_fd_or_name): Fix type of FD in function declaration. Conflicts: common/ChangeLog common/iobuf.c common/ 2009-12-08 Marcus Brinkmann <marcus@g10code.de> * asshelp.c (start_new_gpg_agent): Convert posix FD to assuan FD. agent/ 2009-12-08 Marcus Brinkmann <marcus@g10code.de> * call-pinentry.c (start_pinentry): Convert posix fd to assuan fd. * call-scd.c (start_scd): Likewise. sm/ 2009-12-08 Marcus Brinkmann <marcus@g10code.de> * call-dirmngr.c (start_dirmngr_ext): Convert posix fd to assuan fd. tools/ 2009-12-08 Marcus Brinkmann <marcus@g10code.de> * gpg-connect-agent.c (main): Convert posix fd to assuan fd. Conflicts: agent/ChangeLog common/ChangeLog g13/call-gpg.c sm/ChangeLog tools/ChangeLog
This commit is contained in:
parent
d6a28faafa
commit
203f54a634
28 changed files with 1434 additions and 984 deletions
73
g10/server.c
73
g10/server.c
|
@ -26,9 +26,9 @@
|
|||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <assuan.h>
|
||||
|
||||
#include "gpg.h"
|
||||
#include <assuan.h>
|
||||
#include "util.h"
|
||||
#include "i18n.h"
|
||||
#include "options.h"
|
||||
|
@ -64,7 +64,7 @@ close_message_fd (ctrl_t ctrl)
|
|||
|
||||
/* Called by libassuan for Assuan options. See the Assuan manual for
|
||||
details. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
option_handler (assuan_context_t ctx, const char *key, const char *value)
|
||||
{
|
||||
/* ctrl_t ctrl = assuan_get_pointer (ctx); */
|
||||
|
@ -106,20 +106,23 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
|
|||
|
||||
|
||||
/* Called by libassuan for RESET commands. */
|
||||
static void
|
||||
reset_notify (assuan_context_t ctx)
|
||||
static gpg_error_t
|
||||
reset_notify (assuan_context_t ctx, char *line)
|
||||
{
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
|
||||
(void)line;
|
||||
|
||||
close_message_fd (ctrl);
|
||||
assuan_close_input_fd (ctx);
|
||||
assuan_close_output_fd (ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Called by libassuan for INPUT commands. */
|
||||
static void
|
||||
input_notify (assuan_context_t ctx, const char *line)
|
||||
static gpg_error_t
|
||||
input_notify (assuan_context_t ctx, char *line)
|
||||
{
|
||||
/* ctrl_t ctrl = assuan_get_pointer (ctx); */
|
||||
|
||||
|
@ -135,12 +138,13 @@ input_notify (assuan_context_t ctx, const char *line)
|
|||
{
|
||||
/* FIXME (autodetect encoding) */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Called by libassuan for OUTPUT commands. */
|
||||
static void
|
||||
output_notify (assuan_context_t ctx, const char *line)
|
||||
static gpg_error_t
|
||||
output_notify (assuan_context_t ctx, char *line)
|
||||
{
|
||||
/* ctrl_t ctrl = assuan_get_pointer (ctx); */
|
||||
|
||||
|
@ -152,6 +156,7 @@ output_notify (assuan_context_t ctx, const char *line)
|
|||
{
|
||||
/* FIXME */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,7 +173,7 @@ output_notify (assuan_context_t ctx, const char *line)
|
|||
encrypt at all if not all recipients are valid, the client has to
|
||||
take care of this. All RECIPIENT commands are cumulative until a
|
||||
RESET or an successful ENCRYPT command. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_recipient (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -193,7 +198,7 @@ cmd_recipient (assuan_context_t ctx, char *line)
|
|||
|
||||
Note that this command returns an INV_RECP status which is a bit
|
||||
strange, but they are very similar. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_signer (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -216,7 +221,7 @@ cmd_signer (assuan_context_t ctx, char *line)
|
|||
This command should in general not fail, as all necessary checks
|
||||
have been done while setting the recipients. The input and output
|
||||
pipes are closed. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_encrypt (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -230,7 +235,7 @@ cmd_encrypt (assuan_context_t ctx, char *line)
|
|||
|
||||
This performs the decrypt operation after doing some checks on the
|
||||
internal state (e.g. that only needed data has been set). */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_decrypt (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -249,7 +254,7 @@ cmd_decrypt (assuan_context_t ctx, char *line)
|
|||
If the signature is a detached one, the server will inquire about
|
||||
the signed material and the client must provide it.
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_verify (assuan_context_t ctx, char *line)
|
||||
{
|
||||
int rc;
|
||||
|
@ -296,7 +301,7 @@ cmd_verify (assuan_context_t ctx, char *line)
|
|||
Sign the data set with the INPUT command and write it to the sink
|
||||
set by OUTPUT. With "--detached" specified, a detached signature
|
||||
is created. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_sign (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -310,7 +315,7 @@ cmd_sign (assuan_context_t ctx, char *line)
|
|||
|
||||
Import keys as read from the input-fd, return status message for
|
||||
each imported one. The import checks the validity of the key. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_import (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -330,7 +335,7 @@ cmd_import (assuan_context_t ctx, char *line)
|
|||
Recall that in general the output format is set with the OUTPUT
|
||||
command.
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_export (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -344,7 +349,7 @@ cmd_export (assuan_context_t ctx, char *line)
|
|||
|
||||
Fixme
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_delkeys (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -358,7 +363,7 @@ cmd_delkeys (assuan_context_t ctx, char *line)
|
|||
|
||||
Set the file descriptor to read a message which is used with
|
||||
detached signatures. */
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_message (assuan_context_t ctx, char *line)
|
||||
{
|
||||
int rc;
|
||||
|
@ -381,7 +386,7 @@ cmd_message (assuan_context_t ctx, char *line)
|
|||
|
||||
fixme
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
do_listkeys (assuan_context_t ctx, char *line, int mode)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -392,14 +397,14 @@ do_listkeys (assuan_context_t ctx, char *line, int mode)
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_listkeys (assuan_context_t ctx, char *line)
|
||||
{
|
||||
return do_listkeys (ctx, line, 3);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_listsecretkeys (assuan_context_t ctx, char *line)
|
||||
{
|
||||
return do_listkeys (ctx, line, 2);
|
||||
|
@ -412,7 +417,7 @@ cmd_listsecretkeys (assuan_context_t ctx, char *line)
|
|||
Read the parameters in native format from the input fd and create a
|
||||
new OpenPGP key.
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_genkey (assuan_context_t ctx, char *line)
|
||||
{
|
||||
(void)ctx;
|
||||
|
@ -430,7 +435,7 @@ cmd_genkey (assuan_context_t ctx, char *line)
|
|||
pid - Return the process id of the server.
|
||||
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
cmd_getinfo (assuan_context_t ctx, char *line)
|
||||
{
|
||||
int rc;
|
||||
|
@ -461,7 +466,7 @@ register_commands (assuan_context_t ctx)
|
|||
static struct
|
||||
{
|
||||
const char *name;
|
||||
int (*handler)(assuan_context_t, char *line);
|
||||
assuan_handler_t handler;
|
||||
} table[] = {
|
||||
{ "RECIPIENT", cmd_recipient },
|
||||
{ "SIGNER", cmd_signer },
|
||||
|
@ -485,7 +490,7 @@ register_commands (assuan_context_t ctx)
|
|||
|
||||
for (i=0; table[i].name; i++)
|
||||
{
|
||||
rc = assuan_register_command (ctx, table[i].name, table[i].handler);
|
||||
rc = assuan_register_command (ctx, table[i].name, table[i].handler, NULL);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
@ -502,16 +507,24 @@ gpg_server (ctrl_t ctrl)
|
|||
{
|
||||
int rc;
|
||||
int filedes[2];
|
||||
assuan_context_t ctx;
|
||||
assuan_context_t ctx = NULL;
|
||||
static const char hello[] = ("GNU Privacy Guard's OpenPGP server "
|
||||
VERSION " ready");
|
||||
|
||||
/* We use a pipe based server so that we can work from scripts.
|
||||
assuan_init_pipe_server will automagically detect when we are
|
||||
called with a socketpair and ignore FILEDES in this case. */
|
||||
filedes[0] = 0;
|
||||
filedes[1] = 1;
|
||||
rc = assuan_init_pipe_server (&ctx, filedes);
|
||||
filedes[0] = assuan_fdopen (0);
|
||||
filedes[1] = assuan_fdopen (1);
|
||||
rc = assuan_new (&ctx);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("failed to allocate the assuan context: %s\n",
|
||||
gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
rc = assuan_init_pipe_server (ctx, filedes);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("failed to initialize the server: %s\n", gpg_strerror (rc));
|
||||
|
@ -590,7 +603,7 @@ gpg_server (ctrl_t ctrl)
|
|||
leave:
|
||||
xfree (ctrl->server_local);
|
||||
ctrl->server_local = NULL;
|
||||
assuan_deinit_server (ctx);
|
||||
assuan_release (ctx);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue