aboutsummaryrefslogtreecommitdiffstats
path: root/scd (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* scd: Fix a race condition for new_reader_slot.NIIBE Yutaka2016-12-295-47/+74
| | | | | | | | | | | | | | | | | | | * 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]>
* scd: APP centric approach for device management.NIIBE Yutaka2016-12-284-766/+403
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/app.c (lock_app): Rename from lock_reader and use internal field of APP. (unlock_app): Likewise. (app_dump_state): Use APP. (application_notify_card_reset): Remove. (check_conflict): Change API for APP, instead of SLOT. (check_application_conflict): Likewise. (release_application_internal): New. (app_reset): New. (app_new_register): New. (select_application): Change API for APP, instead of SLOT. (deallocate_app, release_application): Modify for manage link. (report_change): New. (scd_update_reader_status_file): Moved from command.c and use APP list, instead of VREADER. (initialize_module_command): Moved from command.c. * scd/command.c (TEST_CARD_REMOVAL): Remove. (IS_LOCKED): Simplify. (vreader_table): Remove. (vreader_slot, update_card_removed): Remove. (do_reset): Call app_reset. (get_current_reader): Remove. (open_card): Add SCAN arg. (cmd_serialno): No retry, since retry is done in lower layer in apdu.c. No do_reset, since it is done in lower layer. Add clearing card_removed flag. (cmd_disconnect): Call apdu_disconnect. (send_client_notifications): Modify for APP. (update_reader_status_file): Remove. -- APP is the abstraction of the card application. For management of cards, it is better to focus on the APP instead of the physical reader. This change makes support of multiple card/token easier. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Simplify monitoring card removal.NIIBE Yutaka2016-12-283-117/+30
| | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (struct reader_table_s): Remove any_status, last_status, status, and change_counter field. (new_reader_slot, dump_reader_status, ct_activate_card, open_ct_reader) (connect_pcsc_card, open_pcsc_reader_direct, open_pcsc_reader_wrapped) (open_ccid_reader, apdu_reset): Follow the change. (ct_dump_reader_status): Remove. (apdu_get_status_internal, apdu_get_status): Remove CHANGED arg. (apdu_connect): Follow the change. * scd/command.c (struct vreader_s): Remove reset_failed, any, and changed field. (cmd_getinfo, update_reader_status_file): Follow the change. -- In the past, scdaemon monitors card insertion (as well as removal), so the code has been complicated, and there has been duplication in two layers. Now, it only monitors card removal, it's now simplified. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Improve internal CCID driver.NIIBE Yutaka2016-12-271-89/+87
| | | | | | | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Fix return value. Support device with multiple CCID interfaces. Fix the case with READERNO. Support partial string match of "reader-port" like PC/SC driver. -- I don't know any device with multiple CCID interfaces, though. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Clean up internal API for APP.NIIBE Yutaka2016-12-223-38/+34
| | | | | | | | | | | | | | | | | | * scd/app-common.h (app_readcert, app_readkey, app_setattr, app_sign, app_auth, app_decipher, app_get_challenge, app_check_pin): Add CTRL as the second argument. * scd/app.c: Supply CTRL to lock_reader calls. * scd/command.c (cmd_readcert, cmd_readkey, cmd_pksign, cmd_auth, cmd_pkdecrypt, cmd_setattr, cmd_random, cmd_checkpin): Follow the change. -- APP is an abstraction of the "card application". Most methods of APP should have CTRL argument to report back progress to the session. This change fixes FIXMEs for missing CTRL. Signed-off-by: NIIBE Yutaka <[email protected]>
* Remove unused debug flags and add "dns" and "network".Werner Koch2016-12-192-6/+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]>
* gpg: New option --default-new-key-algo.Werner Koch2016-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/openpgp-oid.c (openpgp_is_curve_supported): Add optional arg R_ALGO and change all callers. * common/util.h (GPG_ERR_UNKNOWN_FLAG): New error code. * g10/options.h (struct opt): Add field DEF_NEW_KEY_ALGO. * g10/gpg.c (oDefaultNewKeyAlgo): New enum. (opts): New option "--default-new-key-algo". (main): Set the option. * g10/keygen.c: Remove DEFAULT_STD_ FUTURE_STD_ constants and replace them by ... (DEFAULT_STD_KEY_PARAM, FUTURE_STD_KEY_PARAM): new string constants. (get_keysize_range): Remove arg R_DEF and return that value instead. Change all callers. (gen_rsa): Use get_keysize_range instead of the removed DEFAULT_STD_KEYSIZE. (parse_key_parameter_part): New function. (parse_key_parameter_string): New function. (quick_generate_keypair): Refactor using parse_key_parameter_string. (generate_keypair): Ditto. (parse_algo_usage_expire): Ditto. -- This new option is intended to be used in the forthcoming --set-profile command of gpgconf. It allows to provide a gpg configuration with custom defaults for a new key using the simple commands which use the default algorithm set. Signed-off-by: Werner Koch <[email protected]>
* scd: Support OpenPGP card V3 for RSA.NIIBE Yutaka2016-11-251-23/+38
| | | | | | | | | | | | | | | | | | | | | | * scd/app-openpgp.c (struct app_local_s): Remove max_cmd_data and max_rsp_data fields as Extended Capabilities bits are different. (get_cached_data) Use extcap.max_certlen_3. (get_one_do): Don't use exmode=1. (determine_rsa_response): New. (get_public_key, do_genkey): Call determine_rsa_response. (do_sign): Use keyattr[0].rsa.n_bits / 8, instead of max_rsp_data. (do_auth): Use keyattr[2].rsa.n_bits / 8, instead of max_rsp_data. (do_decipher): Likewise with Use keyattr[1].rsa.n_bits / 8. (show_caps): Remove max_cmd_data and max_rsp_data. (app_select_openpgp): Likewise. -- OpenPGP card V3 had introduced incompatible change in Extended Capabilities bits. We can work around by this change by not using those bits. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix receive buffer size.NIIBE Yutaka2016-11-221-2/+3
| | | | | | | | | | | | | * scd/apdu.c (send_le): Fix the size, adding two for status bytes to Le. -- This is long standing bug. So far, Le was not exact value. Since forthcoming change will introduce exact value of expected length of response data, this change is needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Don't limit to ST-2xxx for PC/SC.NIIBE Yutaka2016-11-171-1/+5
| | | | | | | | | | | * scd/apdu.c (pcsc_vendor_specific_init): Only check vender ID. -- Some other products by Cherry works with pinpad, although it only works for smaller keys (RSA 1024). TPDU support is good for larger keys. Signed-off-by: NIIBE Yutaka <[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]>
* scd: Fix status info encoding.NIIBE Yutaka2016-11-141-1/+2
| | | | | | | | | * scd/command.c (send_status_info): Do percent plus encoding correctly. -- Reported-by: David Härdeman <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-0521-21/+21
| | | | --
* scd: Fix length error for READKEY.NIIBE Yutaka2016-11-041-0/+2
| | | | | | | * scd/app-openpgp.c (do_readkey): Decrement the length. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Add --advanced option for READKEY.NIIBE Yutaka2016-11-045-61/+99
| | | | | | | | | | | | | * scd/command.c (cmd_readkey) : Support ADVANCED arg. * scd/app.c (app_readcert): Add ADVANCED arg. * scd/app-openpgp.c (do_readkey): Implement ADVANCED arg. * scd/app-nks.c (do_readkey): Error return with GPG_ERR_NOT_SUPPORTED. -- "SCD READKEY --advanced OPENPGP.3" returns key in advanced format. With this suport, poldi-ctrl will be no longer needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* Spelling: correct spelling of "passphrase".Daniel Kahn Gillmor2016-11-021-1/+1
| | | | | | | | | | | There were several different variant spellings of "passphrase". This should fix them all for all English text. I did notice that po/it.po contains multiple instances of "passhprase", which also looks suspect to me, but i do not know Italian, so i did not try to correct it. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Fix typos.Justus Winter2016-10-271-1/+1
| | | | | -- Signed-off-by: Justus Winter <[email protected]>
* scd: Add 0x41 prefix for x-coordinate only result.NIIBE Yutaka2016-10-271-12/+21
| | | | | | | | | | | * scd/app-openpgp.c (do_decipher): When it's x-coordinate only, add the prefix 0x41. -- Card should return fixed size bytes, either in format of (04 || X || Y) or (X, x-coordinate only). Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Use canonical curve name of libgcrypt.NIIBE Yutaka2016-10-241-31/+58
| | | | | | | | | | | | | | | | | | * scd/app-openpgp.c (send_key_attr): Use curve instead of OID. (ecdh_params): New. (ecc_read_pubkey): Use ecdh_params. Use curve name. (ecc_writekey): Likewise. (ecc_curve): Rename from ecc_oid. (parse_algorithm_attribute): Use ecc_curve. * g10/call-agent.c (learn_status_cb): Use openpgp_is_curve_supported to intern the curve name string. * g10/card-util.c (card_status): Conver curve name to alias for print. -- Now, sdcaemon answer for KEY-ATTR is in the canonical curve name instead of the alias. Since it is used of key generation for card encryption key with backup, it should be canonical name. Signed-off-by: NIIBE Yutaka <[email protected]>
* g10,scd: Fix ECC keygen.NIIBE Yutaka2016-10-211-11/+12
| | | | | | | | | | | | * g10/keygen.c (generate_keypair): For card key generation, fill parameters by KEY-ATTR. * scd/app-openpgp.c (ecc_read_pubkey): OID should be freed at last, after its reference by OIDBUF is finished. (ecc_writekey): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix segfault changing key attr.NIIBE Yutaka2016-10-211-1/+1
| | | | | | | | * asc/app-openpgp.c (change_keyattr_from_string): Release after allocated. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix use cases of snprintf.NIIBE Yutaka2016-10-212-3/+2
| | | | | | | | | | | * 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]>
* scd: GENKEY updates the public key in APP.NIIBE Yutaka2016-10-201-228/+257
| | | | | | | | | | | | | | * scd/app-openpgp.c (rsa_read_pubkey, ecc_read_pubkey): New. (read_public_key): New. (get_public_key, do_genkey): Use read_public_key. -- With this change, since GENKEY updates the public key (pk[keyno].key) in APP, READKEY will be possible after the command even for the old card (version <= 0x0100). Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Support ECC key generation.NIIBE Yutaka2016-10-181-61/+137
| | | | | | | | | | | | | | | | * scd/app-openpgp.c (get_public_key): Fix a message. (change_keyattr_from_string, ecc_writekey): Call mpi_release sooner. (do_genkey): Add ECC support. -- In OpenPGP card specification 3.0, ECC is introduced. So far, do_genkey only supported RSA. Since KDF spec. is needed to calculate the fingerprint, it is hard coded in app-openpgp.c. But it's defined by OpenPGP ECC (RFC-6637), and card does nothing with KDF in fact. Co-authored-by: Arnaud Fontaine <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: minor cleanup to merge other works.NIIBE Yutaka2016-10-183-39/+32
| | | | | | | | | * scd/iso7816.c (do_generate_keypair): Use const char * for DATA. (iso7816_generate_keypair, iso7816_read_public_key): Likewise. * scd/app-openpgp.c (get_public_key): Follow the change. (do_genkey): Ditto. Use ERR instead of RC. Use u32 for CREATED_AT. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix keytocard for ECC.NIIBE Yutaka2016-10-171-0/+2
| | | | | | | | | | * scd/app-openpgp.c (build_ecc_privkey_template): Size can be greater than 128 when it comes with public key for curve of larger field. -- Reported-by: Arnaud Fontaine <[email protected]> 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]>
* scd: Add support of ECC pubkey attribute.NIIBE Yutaka2016-09-161-16/+45
| | | | | | | | | | | | | | | | | | * scd/app-openpgp.c (ECC_FLAG_PUBKEY): New. (send_key_attr, get_public_key, ecc_writekey, do_auth, do_decipher) (parse_algorithm_attribute): Check ECC_FLAG_DJB_TWEAK. (build_ecc_privkey_template): Add ECC_Q and ECC_Q_LEN. Support offering public key when ECC_FLAG_PUBKEY sets. (ecc_writekey): Supply ECC_Q and ECC_Q_LEN. (parse_algorithm_attribute): Parse pubkey-required byte. -- OpenPGPcard protocol specification version 3.2 supports algorithm attributes for ECC key which specifies public key data is required for "keytocard" command. This change supports the feature. 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]>
* scd: Fix an action after card removal.NIIBE Yutaka2016-09-031-5/+5
| | | | | | | | | | | | | | | | | * scd/command.c (update_card_removed): Call apdu_close_reader here. -- This is update of the commit 8fe81055762d9c9e6f03fb7853a985c94ef73ac3 It is better apdu_close_reader is called in update_card_removed. The commit 1598a4476466822e7e9c757ac471089d3db4b545 introduced a regression, it doesn't close the reader after removal of the card, while the code before the commit call apdu_close_reader in do_reset. So, this fix. GnuPG-bug-id: 2449 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Release the card reader after card removal.NIIBE Yutaka2016-09-021-1/+4
| | | | | | | | | * scd/command.c (update_reader_status_file): Call apdu_close_reader. -- GnuPG-bug-id: 2651 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Clean up unused shutdown method.NIIBE Yutaka2016-09-023-121/+0
| | | | | | | | | | * scd/apdu.c (shutdown_ccid_reader, apdu_shutdown_reader): Remove. (reset_ccid_reader): Don't set shutdown_reader. * scd/ccid-driver.c (ccid_shutdown_reader): Remove. -- Signed-off-by: NIIBE Yutaka <[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]>
* More cleanup of "allow to".Daniel Kahn Gillmor2016-08-033-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | * README, agent/command.c, agent/keyformat.txt, common/i18n.c, common/iobuf.c, common/keyserver.h, dirmngr/cdblib.c, dirmngr/ldap-wrapper.c, doc/DETAILS, doc/TRANSLATE, doc/announce-2.1.txt, doc/gpg.texi, doc/gpgsm.texi, doc/scdaemon.texi, doc/tools.texi, doc/whats-new-in-2.1.txt, g10/export.c, g10/getkey.c, g10/import.c, g10/keyedit.c, m4/ksba.m4, m4/libgcrypt.m4, m4/ntbtls.m4, po/ca.po, po/cs.po, po/da.po, po/de.po, po/el.po, po/eo.po, po/es.po, po/et.po, po/fi.po, po/fr.po, po/gl.po, po/hu.po, po/id.po, po/it.po, po/ja.po, po/nb.po, po/pl.po, po/pt.po, po/ro.po, po/ru.po, po/sk.po, po/sv.po, po/tr.po, po/uk.po, po/zh_CN.po, po/zh_TW.po, scd/app-p15.c, scd/ccid-driver.c, scd/command.c, sm/gpgsm.c, sm/sign.c, tools/gpgconf-comp.c, tools/gpgtar.h: replace "Allow to" with clearer text. In standard English, the normal construction is "${XXX} allows ${YYY} to" -- that is, the subject (${XXX}) of the sentence is allowing the object (${YYY}) to do something. When the object is missing, the phrasing sounds awkward, even if the object is implied by context. There's almost always a better construction that isn't as awkward. These changes should make the language a bit clearer. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* scd: Fix card removal/reset on multiple contexts.NIIBE Yutaka2016-07-202-41/+47
| | | | | | | | | | | | | | | * scd/app.c (application_notify_card_reset): Add message for debug. *scd/command.c (update_card_removed): Call release_application and set SLOT -1 here. (struct server_local_s): Remove app_ctx_marked_for_release. (do_reset): Don't mark release but call release_application here. (open_card): Remove app_ctx_marked_for_release handling. (update_reader_status_file): Don't set SLOT here, so that it can be released the APP by application_notify_card_reset in update_card_removed. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix race conditions for release_application.NIIBE Yutaka2016-07-191-4/+6
| | | | | | | | | | | * scd/command.c (do_reset, cmd_restart): Reset app_ctx before calling release_application. -- Thanks to Ben Warren for the report. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Reset nonnull_nad to zero for VENDOR_GEMPC.Niibe Yutaka2016-06-191-1/+1
| | | | | | | | | | | | | | * (parse_ccid_descriptor): nonnull_nad = 0 for all GEMPC device. -- We can't use the driver for 08E6:3438, while it works well under PC/SC service. I found that the library of ccid always uses the node address = ZERO for all transactions. So, we extend the same handling for not only GEMPC_CT30, but also for all its devices. Debian-bug-id: 814584 Signed-off-by: NIIBE Yutaka <[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-073-12/+9
| | | | | | | | | | | | | | | | | | | * 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]>
* scd: More fix of error return path.NIIBE Yutaka2016-05-021-2/+2
| | | | | | | | | | * scd/command.c (open_card): Return GPG_ERR_ENODEV on the failure of apdu_connect. -- GnuPG-bug-id: 2306 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix error return path.NIIBE Yutaka2016-04-281-3/+4
| | | | | | | | | | * scd/ccid-driver.c (bulk_in): Remove EAGAIN handling. Handle LIBUSB_ERROR_NO_DEVICE to return CCID_DRIVER_ERR_NO_READER. -- GnuPG-bug-id: 2306 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix memory leaks.NIIBE Yutaka2016-04-271-1/+10
| | | | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Return on LIBUSB_ERROR_NO_MEM. Free CONFIG before return except on error. (scan_or_find_devices): Free device list. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Bug fix for a device with multiple interfaces.NIIBE Yutaka2016-03-071-2/+3
| | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Use IFC_NO when accessing interface information. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Consolidate Assuan server argument handling.Justus Winter2016-03-021-47/+1
| | | | | | | | | | | | | | | * common/Makefile.am (common_sources): Add new files. * common/server-help.c: New file. * common/server-help.h: Likewise. * agent/command.c: Drop argument handling primitives in favor of using the consolidated ones. * dirmngr/server.c: Likewise. * g10/server.c: Likewise. * g13/server.c: Likewise. * scd/command.c: Likewise. * sm/server.c: Likewise. Signed-off-by: Justus Winter <[email protected]>