summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarcus Brinkmann <mb@g10code.com>2009-09-23 02:01:25 +0200
committerMarcus Brinkmann <mb@g10code.com>2009-09-23 02:01:25 +0200
commit3974488cd1fbe8471ec06b6ed057e56a446616b8 (patch)
treedf568235475e7575f891f072cb68190c85e4f3c0 /common
parentStart a new development branch. (diff)
downloadgnupg2-3974488cd1fbe8471ec06b6ed057e56a446616b8.tar.xz
gnupg2-3974488cd1fbe8471ec06b6ed057e56a446616b8.zip
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.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog5
-rw-r--r--common/asshelp.c19
2 files changed, 19 insertions, 5 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index 08f30d606..34894effd 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-23 Marcus Brinkmann <marcus@g10code.de>
+
+ * asshelp.c (start_new_gpg_agent): Allocate assuan context before
+ starting server.
+
2009-09-03 Werner Koch <wk@g10code.com>
Update from libestream:
diff --git a/common/asshelp.c b/common/asshelp.c
index b373baf98..47b86ee1c 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -183,6 +183,13 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
*r_ctx = NULL;
+ rc = assuan_new (&ctx);
+ if (rc)
+ {
+ log_error ("error allocating assuan context: %s\n", gpg_strerror (rc));
+ return rc;
+ }
+
restart:
infostr = force_pipe_server? NULL : getenv ("GPG_AGENT_INFO");
if (!infostr || !*infostr)
@@ -192,7 +199,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
/* First check whether we can connect at the standard
socket. */
sockname = make_filename (homedir, "S.gpg-agent", NULL);
- rc = assuan_socket_connect (&ctx, sockname, 0);
+ rc = assuan_socket_connect (ctx, sockname, 0);
if (rc)
{
@@ -210,6 +217,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
log_error ("error flushing pending output: %s\n",
strerror (errno));
xfree (sockname);
+ assuan_release (ctx);
return tmperr;
}
@@ -239,7 +247,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
/* Give the agent some time to prepare itself. */
gnupg_sleep (3);
/* Now try again to connect the agent. */
- rc = assuan_socket_connect (&ctx, sockname, 0);
+ rc = assuan_socket_connect (ctx, sockname, 0);
}
}
#else /*!HAVE_W32_SYSTEM*/
@@ -265,7 +273,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
no_close_list[i] = -1;
/* Connect to the agent and perform initial handshaking. */
- rc = assuan_pipe_connect (&ctx, agent_program, argv,
+ rc = assuan_pipe_connect (ctx, agent_program, argv,
no_close_list);
}
#endif /*!HAVE_W32_SYSTEM*/
@@ -299,7 +307,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
goto restart;
}
- rc = assuan_socket_connect (&ctx, infostr, pid);
+ rc = assuan_socket_connect (ctx, infostr, pid);
xfree (infostr);
if (gpg_err_code (rc) == GPG_ERR_ASS_CONNECT_FAILED)
{
@@ -312,6 +320,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
if (rc)
{
log_error ("can't connect to the agent: %s\n", gpg_strerror (rc));
+ assuan_release (ctx);
return gpg_error (GPG_ERR_NO_AGENT);
}
@@ -326,7 +335,7 @@ start_new_gpg_agent (assuan_context_t *r_ctx,
session_env);
if (rc)
{
- assuan_disconnect (ctx);
+ assuan_release (ctx);
return rc;
}