aboutsummaryrefslogtreecommitdiffstats
path: root/scd/scdaemon.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* scd: Fix scd_kick_the_loop.NIIBE Yutaka2017-03-031-31/+56
| | | | | | | | | | | | | | | | * scd/scdaemon.c (notify_fd): Remove. (the_event) [W32]: New. (main_thread_pid) [!W32]: New. (handle_signal): Handle SIGCONT. (scd_kick_the_loop): Use signal on UNIX and event on Windows. (handle_connections): Likewise. -- Code with CreateEvent is copied from gpg-agent.c. Code for signal is copied from dkg's gpg-agent-idling in Debian. GnuPG-bug-id: 2982 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Minor fixes to silence compiler warnings.NIIBE Yutaka2017-02-161-3/+5
| | | | | | | | * scd/app.c (app_reset): Initialize ERR. * scd/scdaemon.c (scd_kick_the_loop, handle_connections): Catch the return value. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix regression tracking the connection count.NIIBE Yutaka2017-01-311-0/+13
| | | | | | | | | | | | | | | | * scd/scdaemon.c (get_active_connection_count): New. (start_connection_thread): Bump ACTIVE_CONNECTIONS up and down. * scd/command.c (cmd_getinfo): Add subcommand "connections". -- Apply gpg-agent change to scdaemon. See the commit in 2016-08-06: 40d16029ed8b334c371fa7f24ac762d47302826e Then, add kicking the loop, so that main loop can notice the change of the connection. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Remove --debug-disable-ticker option.NIIBE Yutaka2017-01-311-34/+11
| | | | | | | | | | | | | * scd/scdaemon.c (ticker_disabled): Remove. (handle_tick, need_tick): Remove. (handle_connections): Don't check ticker_disabled. -- Now, removal of device/card is only done by the function scd_update_reader_status_file, it should be called if needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix SERIALNO for multiple devices.NIIBE Yutaka2017-01-311-55/+31
| | | | | | | | | | | | | | * scd/app.c (select_application): Fix the logic if periodical check is needed. If it is needed for newly found device(s), kick the loop. (scd_update_reader_status_file): Return value if select(2) should be called with timeout. * scd/ccid-driver.c (ccid_require_get_status): Don't return 0 for token with no interrupt transfer for now. * scd/command.c (open_card_with_request): Fix scan by SERIALNO. * scd/scdaemon.c (update_usb): Remove. (handle_connections): Evaluate need_tick after handle_tick. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: More changes on watching removal of card/reader.NIIBE Yutaka2017-01-271-84/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/app-common.h (struct app_ctx_s): Rename field to periodical_check_needed. * scd/scdaemon.c (update_usb): Rename from update_fdset_for_usb. Don't use libusb_get_pollfds any more. (scd_kick_the_loop): New. (need_tick): Follow the rename. (handle_connections): No libusb event handling here. * scd/app.c (app_new_register): Follow the change of rename. (select_application, scd_update_reader_status_file): Likewise. * scd/ccid-driver.c (ccid_usb_thread_is_alive): New. (intr_cb): Call scd_kick_the_loop. (ccid_usb_thread): New. Thread to invoke INTERRUPT callback. (ccid_open_usb_reader): Add thread invocation. (ccid_require_get_status): Remove LIBUSB_WORKS_EXPECTED_FOR_INTERRUPT_ENDP. (do_close_reader): Carefully handle handle->transfer. (get_escaped_usb_string): Insert npth_unprotect/npth_protect. (do_close_reader, bulk_out, bulk_in, abort_cmd, ccid_slot_status) (ccid_transceive, ccid_transceive_secure): Likewise. -- It found that libusb_get_pollfds is not supported on Windows. Besides, it's a bit difficult to use for the select loop. Thus, we use the thread named ccid_usb_thread, instead. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Improve watching USB device removal.NIIBE Yutaka2017-01-271-5/+7
| | | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c(struct reader_table_s): Add require_get_status. (apdu_connect): Change return value meaning. Call apdu_reset here. * scd/app.c (app_new_register): Add require_get_status. (select_application): Use the return value of apdu_connect. (scd_update_reader_status_file): Call update_fdset_for_usb with checking all_have_intr_endp. (app_list_start, app_list_finish): Remove. * scd/ccid-driver.c (struct ccid_driver_s): Add transfer. (intr_cb): Don't call libusb_transfer in this callback. (ccid_require_get_status): New. (do_close_reader): Call libusb_transfer here. * scd/scdaemon.c (update_fdset_for_usb): Remove the first argument. -- With Gnuk Token, it works fine as expected. With Gemalto reader, intr_cb is not called when card is removed. So, the macro LIBUSB_WORKS_EXPECTED_FOR_INTERRUPT_ENDP is not defined yet. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Wake up the select when new USB scan.NIIBE Yutaka2017-01-271-6/+45
| | | | | | | | | | | | | | | * scd/scdaemon.c (update_fdset_for_usb): Wake up the select(2). (handle_connections): Use a kind of "self-pipe" technique. -- Use pipe to wake up select(2). If UNIX-only, signal could be used. For portability, "self-pipe" is better, here. Setup for non-blocking for pipe fds are not needed, because speed of USB device insertion is limited by human physical interaction; No one can do hundreds of device insertion/removal-s per second. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Only submit apdu_get_status when needed.NIIBE Yutaka2017-01-261-36/+121
| | | | | | | | | | | | | | | * scd/apdu.c (apdu_dev_list_finish): Return Boolean value if all device support INTERRUPT transfer. * scd/ccid-driver.c (ccid_dev_scan_finish): Likewise. * scd/app.c (app_new_register): Fix initial value of card_status. (select_application): Call update_fdset_for_usb. (scd_update_reader_status_file): Ditto. * scd/scdaemon.c (update_fdset_for_usb, need_tick): New. (handle_connections): Call handle_tick when select returns. Let select watch USB file descriptors, too. Call libusb_handle_events_timeout_completed for INTERRUPT transfer. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix a race condition for new_reader_slot.NIIBE Yutaka2016-12-291-1/+6
| | | | | | | | | | | | | | | | | | | * scd/apdu.c (reader_table_lock, apdu_init): New. (new_reader_slot): Serialize by reader_table_lock. * scd/app.c (lock_app, unlock_app, app_new_register): Fix error code usage. (initialize_module_command): Call apdu_init. * scd/scdaemon.c (main): Handle error for initialize_module_command. -- This is a long standing bug. There are two different things; The serialization of allocating a new SLOT, and the serialization of using the SLOT. The latter was implemented in new_reader_slot by lock_slot. However, the former was not done. Thus, there was a possible race where a same SLOT is allocated to multiple threads. Signed-off-by: NIIBE Yutaka <[email protected]>
* Remove unused debug flags and add "dns" and "network".Werner Koch2016-12-191-4/+2
| | | | | | | | | | | | | | | | | | * g10/options.h (DBG_CARD_IO_VALUE, DBG_CARD_IO): Remove. * g10/gpg.c (debug_flags): Remove "cardio". * agent/agent.h (DBG_COMMAND_VALUE, DBG_COMMAND): Remove. * agent/gpg-agent.c (debug_flags): Remove "command". * scd/scdaemon.h (DBG_COMMAND_VALUE, DBG_COMMAND): Remove. * scd/scdaemon.c (debug_flags): Remove "command". * dirmngr/dirmngr.h (DBG_DNS_VALUE, DBG_DNS): New. (DBG_NETWORK_VALUE, DNG_NETWORK): New. * dirmngr/dirmngr.c (debug_flags): Add "dns" and "network". -- Note that "dns" and "network" are not yet used but will soon be added to dirmngr. Signed-off-by: Werner Koch <[email protected]>
* scd,dirmngr: Keep the standard fds when daemonizing.Werner Koch2016-11-161-2/+12
| | | | | | | | | | | | | * dirmngr/dirmngr.c (main): Before calling setsid do not close the standard fds but connect them to /dev/null. * scd/scdaemon.c (main): Ditto. Noet that the old test for a log stream was even reverted. -- Note that this was fixed for gpg-agent 10 years ago on 2006-11-09. Signed-off-by: Werner Koch <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* Fix use cases of snprintf.NIIBE Yutaka2016-10-211-2/+1
| | | | | | | | | | | * agent/call-pinentry.c, agent/call-scd.c, agent/command.c, build-aux/speedo/w32/g4wihelp.c, common/get-passphrase.c, dirmngr/dirmngr.c, g10/call-agent.c, g10/cpr.c, g10/keygen.c, g10/openfile.c, g10/passphrase.c, scd/app-openpgp.c, scd/scdaemon.c, sm/call-agent.c, sm/call-dirmngr.c, sm/certreqgen.c: Fix assuming C99. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* agent, dirmngr, scd: Fix init_common_subsystems.NIIBE Yutaka2016-10-071-0/+2
| | | | | | | | | | | * common/init.c (_init_common_subsystems): Don't call gpgrt_set_syscall_clamp in this function. * agent/gpg-agent.c, dirmngr/dirmngr.c, scd/scdaemon.c: Call gpgrt_set_syscall_clamp after npth_init. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* agent, dirmngr, scd: npth_init must be after fork.NIIBE Yutaka2016-10-041-2/+4
| | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (thread_init_once, initialize_modules): New. (main): Make sure no daemonizing-fork call after npth_init, and no npth calls before npth_init, with care of npth calls by assuan hooks. * dirmngr/dirmngr.c (thread_init): New. (main): Make sure npth_init must not be called before daemonizing fork. * scd/scdaemon.c (main): Likewise. -- It is simply the best for nPth not to allow the daemonizing fork after npth_init, because semantics and implementations of forked child process in a threaded application is a difficult corner case. GnuPG-bug-id: 1779 Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Add an assuan logging monitor.Werner Koch2016-09-051-1/+1
| | | | | | | | | * common/asshelp.c (my_log_monitor): New var. (my_libassuan_log_handler): Run that monitor. (setup_libassuan_logging): Add arg to set a log monitor and change all callers. Signed-off-by: Werner Koch <[email protected]>
* Call log_set_prefix() with human-readable labels.Daniel Kahn Gillmor2016-08-121-2/+2
| | | | | | | | | | | | | | | | | | * agent/preset-passphrase.c, agent/protect-tool.c, dirmngr/dirmngr.c * dirmngr/t-http.c, g10/gpg.c, g10/gpgv.c, g13/g13-syshelp.c * g13/g13.c, kbx/kbxutil.c, scd/scdaemon.c, sm/gpgsm.c * tests/gpgscm/main.c, tools/gpg-check-pattern.c * tools/gpg-connect-agent.c, tools/gpgconf.c, tools/gpgtar.c * tools/symcryptrun.c: Invoke log_set_prefix() with human-readable labels. -- Some invocations of log_set_prefix() were done with raw numeric values instead of values that humans can understand. Use symbolic representations instead of numeric for better readability. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Cleanup initialization of libgcrypt.Ben Kibbey2016-08-091-8/+0
| | | | | | | | | | | | * common/init.c (init_common_subsystems): Initialize libgcrypt. * dirmngr/Makefile.am (dirmngr_ldap): Link with libgcrypt. -- Most other modules already call gcry_check_version() after init_common_subsystems() so may as well move initialization of libgcrypt to here. Also fixes a warning in the system log from gpgconf --homedir. Signed-off-by: Ben Kibbey <[email protected]>
* scd: Make option --homedir work.Werner Koch2016-06-171-0/+1
| | | | | | | | | | * scd/scdaemon.c (opts): Add --homedir. -- Without that entry the homedir setting won't work. GnuPG-bug-id: 2386 Signed-off-by: Werner Koch <[email protected]>
* Explicitly restrict socket permissions.Werner Koch2016-06-081-0/+4
| | | | | | | | | | * agent/gpg-agent.c (create_server_socket): Call chmod before listen. * scd/scdaemon.c (create_server_socket): Ditto. * dirmngr/dirmngr.c (main): Ditto. -- This is just in case of a improperly set umask. Note that a connect requires a write permissions.
* w32: Fix recent build regression.Werner Koch2016-06-081-1/+0
| | | | | | | | | | | * common/homedir.c (_gnupg_socketdir_internal) [W32]: Add definition for NAME. * g10/gpg.c (main) [W32]: Fix use og gnupg_homedir. * agent/gpg-agent.c (remove_socket): Remove unused var P. * scd/scdaemon.c (cleanup): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Do not try to remove the enclosing directory of sockets.Werner Koch2016-06-081-7/+0
| | | | | | | | | | | | | | * agent/gpg-agent.c (remove_socket): Do not remove the enclosing directory. * scd/scdaemon.c (cleanup): Ditto. -- The socket directory is now below /run or at ~/.gnupg. Thus we should not try to remove the directory of the socket. The auto-removal was introduced at a time we used a temporary directory for the sockets. Signed-off-by: Werner Koch <[email protected]>
* common: New function gnupg_socketdir.Werner Koch2016-06-071-1/+1
| | | | | | | | | | | | | | | * common/homedir.c (gnupg_socketdir): New. * agent/gpg-agent.c (create_socket_name): Use new function instead of gnupg_homedir. (check_own_socket): Ditto. (check_for_running_agent): Ditto. * agent/preset-passphrase.c (main): Ditto. * common/asshelp.c (start_new_gpg_agent): Ditto. * scd/scdaemon.c (create_socket_name): Ditto. * tools/gpgconf.c (main): Ditto. * tools/symcryptrun.c (main): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Replace use of opt.homedir by accessor functions.Werner Koch2016-06-071-8/+6
| | | | | | | | | | | | | | | | | | | * common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch <[email protected]>
* build: Require at least Libassuan 2.4.1.Werner Koch2015-12-021-11/+0
| | | | | | | | | | | | | | | * configure.ac (NEED_LIBASSUAN_VERSION): Set to 2.4.1. * agent/gpg-agent.c (create_server_socket): Remove check for libassuan >= 2.3.0 and >= 2.1.4. (main): Remove check for libassuan >= 2.1.4. * scd/scdaemon.c (create_server_socket): Remove check for libassuan >= 2.1.4. * dirmngr/dirmngr.c (set_tor_mode): Remove check for libassuan >= 2.3.0. * dirmngr/http.c (http_raw_connect, send_request): Remove checks for libassuan >= 2.3.0. Signed-off-by: Werner Koch <[email protected]>
* Allow use of debug flag names for all tools.Werner Koch2015-06-231-13/+26
| | | | | | | | | | * g13/g13.c: Make use of debug_parse_flag. * scd/scdaemon.c: Ditto. * sm/gpgsm.c: Ditto * agent/gpg-agent.c: Ditto. But do not terminate on "help" * dirmngr/dirmngr.c: Ditto. Signed-off-by: Werner Koch <[email protected]>
* common: Remove two JNLIB_ macros (jnlib merge).Werner Koch2015-04-241-2/+1
| | | | | | | | | | * configure.ac: Merge seperate jnlib checks. (HAVE_JNLIB_LOGGING): Remove. * common/logging.c, common/simple-pwquery.c (JNLIB_NEED_AFLOCAL): Rename to GNUPG_COMMON_NEED_AFLOCAL. Change all tests. -- Signed-off-by: Werner Koch <[email protected]>
* Rename DBG_ASSUAN to DBG_IPC and add separate DBG_EXTPROG.Werner Koch2015-04-061-4/+4
| | | | * g10/options.h (DBG_EXTPROG_VALUE): Separate from DBG_IPC_VALUE.
* Add a hook to be called right after main.Werner Koch2015-01-281-0/+1
| | | | | | * common/init.c (early_system_init): New stub function. Signed-off-by: Werner Koch <[email protected]>
* gpg: Add sub-command "factory-reset" to --card-edit.Werner Koch2014-12-151-2/+3
| | | | | | | | | | | | | | | | | | * common/util.h (GPG_ERR_OBJ_TERM_STATE): New. * scd/iso7816.c (map_sw): Add this error code. * scd/app-openpgp.c (do_getattr): Return the life cycle indicator. * scd/app.c (select_application): Allow a return value of GPG_ERR_OBJ_TERM_STATE. * scd/scdaemon.c (set_debug): Print the DBG_READER value. * g10/call-agent.c (start_agent): Print a status line for the termination state. (agent_scd_learn): Make arg "info" optional. (agent_scd_apdu): New. * g10/card-util.c (send_apdu): New. (factory_reset): New. (card_edit): Add command factory-reset. Signed-off-by: Werner Koch <[email protected]>
* scd: Implement socket redirection.Werner Koch2014-12-011-25/+67
| | | | | | | | | | | | * scd/scdaemon.c (ENAMETOOLONG): New. (redir_socket_name): New. (cleanup): Take care of a redirected socket. (main): Pass redir_socket_name to create_server_socket. (create_socket_name): Remove superfluous length check. (create_server_socket): Add arg r_redir_name and implement redirection. Replace assert for older Assuan by an error message. Signed-off-by: Werner Koch <[email protected]>
* Remove use of gnulib (part 1)Werner Koch2014-11-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gl/: Remove entire tree. * configure.ac: Remove gnulib tests and the gl/ Makefile. (setenv): Add to AC_CHECK_FUNCS. * autogen.rc (extra_aclocal_flags): Set to empty. * Makefile.am (ACLOCAL_AMFLAGS): Remove -I gl/m4 (SUBDIRS): Remove gl/. * agent/Makefile.am (common_libs): Remove ../gl/gnulib.a * common/Makefile.am (t_common_ldadd): Ditto. * dirmngr/Makefile.am (dirmngr_LDADD): Ditto. (dirmngr_ldap_LDADD, dirmngr_client_LDADD): Ditto. * g10/Makefile.am (needed_libs): Ditto. * g13/Makefile.am (g13_LDADD): Ditto. * kbx/Makefile.am (kbxutil_LDADD): Ditto. ($(PROGRAMS)): Ditto. * scd/Makefile.am (scdaemon_LDADD): Ditto. * sm/Makefile.am (common_libs): Ditto. * tools/Makefile.am (common_libs, commonpth_libs): Ditto. * agent/gpg-agent.c: Remove "mkdtemp.h" * g10/exec.c: Ditto. * scd/scdaemon.c: Ditto. * tools/symcryptrun.c: Ditto. * common/sysutils.c: Remove "setenv.h" * common/t-timestuff.c: Use putenv if setenv is not available. -- gnulib has always been a cause of trouble in GnuPG because we used only a very few functions and the complex include machinery of gnulib is quite complex and the cause for many build problems for example on OS X. This is not gnulib's fault but due to our limited use of gnulib and that we only rarely update the gnulib code to avoid regressions. In part two we will address the functions mkdtemp setenv unsetenv strpbrk which may bot be implemented on all platforms. They are not required on a libc based system. Signed-off-by: Werner Koch <[email protected]>
* Change a couple of files to use abbreviated copyright notes.Werner Koch2014-11-041-2/+2
| | | | | | | | | -- Also fixed some of my own copyright notices due to the termination of my assignment. The one displayed by --version is kept at FSF because we had contributors in 2014 with FSF assignments and it gives the FSF some visibility.
* Use a unique capitalization for "Note:".Werner Koch2014-10-101-2/+2
| | | | --
* Remove support for the GPG_AGENT_INFO envvar.Werner Koch2014-10-031-64/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (opt): Remove field use_standard_socket. * agent/command.c (cmd_killagent): Always allow killing. * agent/gpg-agent.c (main): Turn --{no,}use-standard-socket and --write-env-file into dummy options. Always return true for --use-standard-socket-p. Do not print the GPG_AGENT_INFO envvar setting or set that envvar. (create_socket_name): Simplify by removing non standard socket support. (check_for_running_agent): Ditto. * common/asshelp.c (start_new_gpg_agent): Remove GPG_AGENT_INFO use. * common/simple-pwquery.c (agent_open): Ditto. * configure.ac (GPG_AGENT_INFO_NAME): Remove. * g10/server.c (gpg_server): Do not print the AgentInfo comment. * g13/server.c (g13_server): Ditto. * sm/server.c (gpgsm_server): Ditto. * tools/gpgconf.c (main): Simplify by removing non standard socket support. -- The indented fix to allow using a different socket than the one in the gnupg home directory is to change Libassuan to check whether the socket files exists as a regualr file with a special keyword to redirect to another socket file name.
* Switch to the libgpg-error provided estream.Werner Koch2014-08-261-2/+2
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14. (GPGRT_ENABLE_ES_MACROS): Define. (estream_INIT): Remove. * m4/estream.m4: Remove. * common/estream-printf.c, common/estream-printf.h: Remove. * common/estream.c, common/estream.h: Remove. * common/init.c (_init_common_subsystems): Call gpgrt initialization.
* Make more use of *_NAME macros.Werner Koch2014-05-081-7/+10
| | | | | | | | | * configure.ac (GPG_DISP_NAME, GPGSM_DISP_NAME): New. (GPG_AGENT_DISP_NAME, SCDAEMON_DISP_NAME): New. (DIRMNGR_DISP_NAME, G13_DISP_NAME): New. (GPGCONF_DISP_NAME): New. (SCDAEMON_SOCK_NAME): New. * common/argparse.c (show_help): Map description string.
* w32: Silence warnings about unused vars.Werner Koch2014-03-071-4/+9
| | | | | | | | | | | | * agent/gpg-agent.c (main) [W32]: Mark unused vars. * sm/gpgsm.c (run_protect_tool) [W32]: Ditto. * g10/trustdb.c (check_regexp) [DISABLE_REGEX]: Ditto. * scd/scdaemon.c (main) [W32]: Ditto. (handle_connections) [W32]: Ditto. (handle_signal) [W32]: Do not build the function at all. * scd/apdu.c (pcsc_send_apdu_direct): Ditto. (connect_pcsc_card): s/long/pcsc_dword_t/. (open_pcsc_reader_direct): Remove var listlen.
* Ignore obsolete option --disable-keypad.Werner Koch2014-03-071-0/+3
| | | | | | | | | | | | | | | * scd/scdaemon.c (opts): Ignore --disable-keypad. -- The renaming of --disable-keypad to --disable-pinpad might mess up configuration files managed with a GUI. The GUI does not not anymore know about the old option and would allow the user to switch "disable-pinpad" on. However, a "disable-keypad" might still linger in the conf file with gpgconf not knowing about it. Thus the conf file would always be rejected and manual intervention would be required. Ignoring the old option nicely solves the problem. (cherry picked from commit e24e92d7e244edd578c0c1f0fba6e0070cb5f104)
* Make use of the *_NAME etc macros.Werner Koch2013-11-181-3/+3
| | | | | | | | | Replace hardwired strings at many places with new macros from config.h and use the new strusage macro replacement feature. * common/asshelp.c (lock_spawning) [W32]: Change the names of the spawn sentinels. * agent/command.c (cmd_import_key): Use asprintf to create the prompt.
* scd: Rename 'keypad' to 'pinpad'.NIIBE Yutaka2013-02-081-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NEWS: Mention scd changes. * agent/divert-scd.c (getpin_cb): Change message. * agent/call-scd.c (inq_needpin): Change the protocol to POPUPPINPADPROMPT and DISMISSPINPADPROMPT. * scd/command.c (pin_cb): Likewise. * scd/apdu.c (struct reader_table_s): Rename member functions. (check_pcsc_pinpad, pcsc_pinpad_verify, pcsc_pinpad_modify, check_ccid_pinpad, ccid_pinpad_operation, apdu_check_pinpad apdu_pinpad_verify, apdu_pinpad_modify): Rename. * scd/apdu.h (SW_HOST_NO_PINPAD, apdu_check_pinpad) (apdu_pinpad_verify, apdu_pinpad_modify): Rename. * scd/iso7816.h (iso7816_check_pinpad): Rename. * scd/iso7816.c (map_sw): Use SW_HOST_NO_PINPAD. (iso7816_check_pinpad): Rename. (iso7816_verify_kp, iso7816_change_reference_data_kp): Follow the change. * scd/ccid-driver.h (CCID_DRIVER_ERR_NO_PINPAD): Rename. * scd/ccid-driver.c (ccid_transceive_secure): Use it. * scd/app-dinsig.c (verify_pin): Follow the change. * scd/app-nks.c (verify_pin): Follow the change. * scd/app-openpgp.c (check_pinpad_request): Rename. (parse_login_data, verify_a_chv, verify_chv3, do_change_pin): Follow the change. * scd/scdaemon.c (oDisablePinpad, oEnablePinpadVarlen): Rename. * scd/scdaemon.h (opt): Rename to disable_pinpad, enable_pinpad_varlen. * tools/gpgconf-comp.c (gc_options_scdaemon): Rename to disable-pinpad.
* SCD: API cleanup for keypad handling.NIIBE Yutaka2013-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | * scd/iso7816.h (struct pininfo_s): Rename from iso7816_pininfo_s. Change meaning of MODE. (pininfo_t): Rename from iso7816_pininfo_t. * scd/sc-copykeys.c: Include "iso7816.h". * scd/scdaemon.c, scd/command.c: Likewise. * scd/ccid-driver.c: Include "scdaemon.h" and "iso7816.h". (ccid_transceive_secure): Follow the change of PININFO_T. * scd/app.c: Include "apdu.h" after "iso7816.h". * scd/iso7816.c (iso7816_check_keypad, iso7816_verify_kp) (iso7816_change_reference_data_kp): Follow the change of API. * scd/apdu.c (struct reader_table_s): Change API of CHECK_KEYPAD, KEYPAD_VERIFY, KEYPAD_MODIFY to have arg of PININFO_T. (check_pcsc_keypad, check_ccid_keypad): Likewise. (apdu_check_keypad, apdu_keypad_verify, apdu_keypad_modify): Likewise. (pcsc_keypad_verify, pcsc_keypad_modify, ct_send_apdu) (pcsc_send_apdu_direct, pcsc_send_apdu_wrapped, pcsc_send_apdu) (send_apdu_ccid, ccid_keypad_operation, my_rapdu_send_apdu, send_apdu) (send_le): Follow the change of API. * scd/apdu.h (apdu_check_keypad, apdu_keypad_verify) (apdu_keypad_modify): Change the API. * scd/app-dinsig.c, scd/app-nks.c, scd/app-openpgp.c: Follow the change.
* SCD: Add option enable-keypad-varlen and support for GEMPC_PINPAD.NIIBE Yutaka2013-02-051-0/+5
| | | | | | | | | | | | * scd/scdaemon.h (opt): Add enable_keypad_varlen. * scd/scdaemon.c (cmd_and_opt_values): Add oEnableKeypadVarlen. (opts, main): Add oEnableKeypadVarlen. * scd/ccid-driver.c (GEMPC_PINPAD): New. (ccid_transceive_secure): Add enable_varlen handling. Enable GEMPC_PINPAD. -- Note that GEMPC_PINPAD doesn't support variable length keypad input. The feature of fixed length keypad input will be added soon.
* Change all quotes in strings and comments to the new GNU standard.Werner Koch2012-06-051-12/+12
| | | | | | | | | | | | | | | | | | | The asymmetric quotes used by GNU in the past (`...') don't render nicely on modern systems. We now use two \x27 characters ('...'). The proper solution would be to use the correct Unicode symmetric quotes here. However this has the disadvantage that the system requires Unicode support. We don't want that today. If Unicode is available a generated po file can be used to output proper quotes. A simple sed script like the one used for en@quote is sufficient to change them. The changes have been done by applying sed -i "s/\`\([^'\`]*\)'/'\1'/g" to most files and fixing obvious problems by hand. The msgid strings in the po files were fixed with a similar command.
* Print warning for arguments not considered an option.Werner Koch2012-03-271-0/+9
| | | | | | | | | | | | | | | | | | GnuPG requires that options are given before other arguments. This can sometimes be confusing. We now print a warning if we found an argument looking alike a long option without being preceded by the stop option. This is bug#1343. * common/argparse.h (ARGPARSE_FLAG_STOP_SEEN): New. * common/argparse.c (arg_parse): Set new flag. * g10/gpg.c (main): Print the warning. * agent/gpg-agent.c (main): Ditto. * dirmngr/dirmngr.c (main): Ditto. * g13/g13.c (main): Ditto. * scd/scdaemon.c (main): Ditto. * sm/gpgsm.c (main): Ditto. * tools/gpg-connect-agent.c (main): Ditto. * tools/gpgconf.c (main): Ditto.
* common: Add a global variable to for the default error source.Werner Koch2012-02-061-0/+2
| | | | | | | | | | | | | | For the shared code parts it is cumbersome to pass an error sourse variable to each function. Its value is always a constant for a given binary and thus a global variable makes things a lot easier than the former macro stuff. * common/init.c (default_errsource): New global var. (init_common_subsystems): Rename to _init_common_subsystems. Set DEFAULT_ERRSOURCE. * common/init.h: Assert value of GPG_ERR_SOURCE_DEFAULT. (init_common_subsystems): New macro. * common/util.h (default_errsource): Add declaration. * kbx/keybox-defs.h: Add some GPG_ERR_SOURCE_DEFAULT trickery.
* Port Windows code to NPTH.Marcus Brinkmann2012-01-251-5/+5
| | | | | | | | | | * agent/gpg-agent.c (get_agent_ssh_socket_name): Use INVALID_HANDLE_VALUE instead of 0. (handle_signal) [!HAVE_W32_SYSTEM]: Don't define. (handle_connections): Port Windows code to NPTH. * dirmngr/dirmngr.c (handle_connections): Port Windows code to NPTH. * g13/g13.c (handle_connections): Port Windows code to NPTH. * scd/scdaemon.c (handle_connections): Port Windows code to NPTH.
* Port to npth.Marcus Brinkmann2012-01-251-136/+88
| | | | | | | | | | | | | | | | | | | | | * configure.ac: Don't check for PTH but for NPTH. (AH_BOTTOM): Remove PTH_SYSCALL_SOFT. (have_pth): Rename to ... (have_npth): ... this. (USE_GNU_NPTH): Rename to ... (USE_GNU_PTH): ... this. * m4/npth.m4: New file. * agent/Makefile.am, agent/cache.c, agent/call-pinentry.c, agent/call-scd.c, agent/findkey.c, agent/gpg-agent.c, agent/trustlist.c, common/Makefile.am, common/estream.c, common/exechelp-posix.c, common/exechelp-w32.c, common/exechelp-w32ce.c, common/http.c, common/init.c, common/sysutils.c, dirmngr/Makefile.am, dirmngr/crlfetch.c, dirmngr/dirmngr.c, dirmngr/dirmngr_ldap.c, dirmngr/ldap-wrapper-ce.c, dirmngr/ldap-wrapper.c, dirmngr/ldap.c, g13/Makefile.am, g13/call-gpg.c, g13/g13.c, g13/runner.c, scd/Makefile.am, scd/apdu.c, scd/app.c, scd/ccid-driver.c, scd/command.c, scd/scdaemon.c, tools/Makefile.am: Port to npth.
* Fix compiler warnings.Marcus Brinkmann2012-01-031-0/+2
| | | | | | | * common/dotlock.c (use_hardlinks_p, dotlock_take_unix): Check return value of link(). * g13/g13.c: Make sure err is initialized. * scd/scdaemon.c (main) [!USE_GCRY_THREAD_CBS]: Do not define ERR.