aboutsummaryrefslogtreecommitdiffstats
path: root/agent (follow)
Commit message (Collapse)AuthorAgeFilesLines
* agent: Minor cleanup.NIIBE Yutaka2017-04-172-3/+0
| | | | | | | * agent/command-ssh.c (ssh_key_to_protected_buffer): Not touch ERR. * agent/command.c (cmd_genkey, cmd_import_key): Clean up. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Clean up error initialize/return.NIIBE Yutaka2017-04-144-6/+2
| | | | | | | | | | * agent/call-pinentry.c (start_pinentry): Return RC. * agent/command-ssh.c (ssh_handler_request_identities): Don't set ERR. * agent/findkey.c (try_unprotect_cb): Return ERR. (unprotect): Don't set RC. * agent/gpg-agent.c (handle_connections): Don't set fd. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Simplify stream_read_cstring.NIIBE Yutaka2017-04-121-7/+1
| | | | | | | * agent/command-ssh.c (stream_read_cstring): Just call stream_read_string. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Use "ll" length specifier when time_t is larger.NIIBE Yutaka2017-04-101-1/+7
| | | | | | | | | | | * agent/command.c (cmd_keytocard): Use KEYTOCARD_TIMESTAMP_FORMAT. -- On a big-endian 32-bit platform which uses 64-bit time_t, it might go wrong. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Serialize access to passphrase cache.NIIBE Yutaka2017-04-061-36/+37
| | | | | | | | | | | | | | * agent/cache.c (encryption_lock): Remove. (cache_lock): New. Now, we have coarse grain lock to serialize entire cache access. (initialize_module_cache): Use CACHE_LOCK. (init_encryption, new_data): Remove ENCRYPTION_LOCK. (agent_flush_cache, agent_put_cache, agent_get_cache): Lock the cache. -- GnuPG-bug-id: 3027 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Minor fix for get_client_pid.NIIBE Yutaka2017-04-041-4/+6
| | | | | | * agent/command-ssh.c (get_client_pid): Use 0 to initialize. Signed-off-by: NIIBE Yutaka <[email protected]>
* gpgconf: Add --enable-extended-key-format for the agent.Werner Koch2017-04-031-0/+2
| | | | | | | * tools/gpgconf-conf.c: Add option. * agent/gpg-agent.c (main) <aGPGConfList>: Add option. Signed-off-by: Werner Koch <[email protected]>
* agent: Use OCB for key protection with --enable-extended-key-format.Werner Koch2017-04-021-6/+1
| | | | | | | | * agent/protect.c (PROT_DEFAULT_TO_OCB): Remove macro. (agent_protect): Make the default protection mode depend on the extend key format option. Signed-off-by: Werner Koch <[email protected]>
* agent: New option --enable-extended-key-format.Werner Koch2017-03-243-11/+43
| | | | | | | | | | * agent/gpg-agent.c (oEnableExtendedKeyFormat): New const. (opts): New option --enable-extended-key-format. (parse_rereadable_options): Set option * agent/findkey.c (write_extended_private_key): Add arg 'update'. (agent_write_private_key): Implement new option. Signed-off-by: Werner Koch <[email protected]>
* agent: New option --stub-only for DELETE_KEYWerner Koch2017-03-243-16/+30
| | | | | | | | * agent/findkey.c (agent_delete_key): Add arg 'only_stubs'. * agent/command.c (cmd_delete_key): Add option --stub-only. -- This option can be used to savely remove stub keys.
* agent,g10: Remove redundant SERIALNO request.NIIBE Yutaka2017-03-161-10/+11
| | | | | | | | | | * agent/learncard.c (agent_handle_learn): Don't call agent_card_serialno. Get the serialno in status response. * g10/call-agent.c (agent_scd_learn): Don't request "SCD SERIALNO". (agent_scd_serialno): New. (card_cardlist_cb, agent_scd_cardlist): New. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Resolve conflict of util.h.NIIBE Yutaka2017-03-0716-31/+31
| | | | | | | | | | | | | | | | | * agent/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * agent/call-pinentry.c, agent/call-scd.c: Follow the change. * agent/command-ssh.c, agent/command.c, agent/cvt-openpgp.c: Ditto. * agent/divert-scd.c, agent/findkey.c, agent/genkey.c: Ditto. * agent/gpg-agent.c, agent/pksign.c, agent/preset-passphrase.c: Ditto. * agent/protect-tool.c, agent/protect.c, agent/trustlist.c: Ditto. * agent/w32main.c: Ditto. -- For openpty function, we need to include util.h on some OS. We also have util.h in common/, so this change is needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Add include files.NIIBE Yutaka2017-03-071-0/+4
| | | | | | * agent/command-ssh.c: Add sys/socket.h and sys/un.h. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Fix get_client_pid for portability.NIIBE Yutaka2017-03-071-11/+32
| | | | | | | | | | | | | | | | | | | * configure.ac: Simply check getpeerucred and ucred.h, and structure members. * agent/command-ssh.c: Include ucred.h. (get_client_pid) [HAVE_STRUCT_SOCKPEERCRED_PID]: Use sockpeercred structure for OpenBSD. [LOCAL_PEERPID]: Use LOCAL_PEERPID for macOS. [LOCAL_PEEREID]: Use LOCAL_PEEREID for NetBSD. [HAVE_GETPEERUCRED]: Use getpeerucred for OpenSolaris. -- This change also addresses following bug. GnuPG-bug-id: 2981. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: For SSH, robustly handling scdaemon's errors.NIIBE Yutaka2017-03-061-10/+9
| | | | | | | | | | | | * agent/command-ssh.c (card_key_list): Return 0 when agent_card_serialno returns an error. (ssh_handler_request_identities): Handle errors for card listing and proceed to other cases. -- GnuPG-bug-id: 2980 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Improve error message for the KEYTOCARD command.Werner Koch2017-03-021-12/+27
| | | | | | | | * agent/command.c (cmd_keytocard): Always use leave_cmd. Simplify timestamp checking and do an early test with an appropriate error message. Signed-off-by: Werner Koch <[email protected]>
* scd,agent: Improve the OpenPGP PIN prompt texts.Werner Koch2017-02-221-7/+66
| | | | | | | | | | | | | * scd/app-openpgp.c (get_prompt_info): Change texts. * agent/call-pinentry.c (struct entry_features): New. (getinfo_features_cb): New. (start_pinentry): Set new fucntion as status callback. (build_cmd_setdesc): New. Replace all snprintf for SETDESC by this one. -- Suggested-by: Andre Heinecke Signed-off-by: Werner Koch <[email protected]>
* scd: Improve the prompts for OpenPGP cards.Werner Koch2017-02-221-15/+38
| | | | | | | | | | | | | | | | * scd/app-openpgp.c (get_disp_name): New. (get_disp_serialno): New. (get_prompt_info): New. (build_enter_admin_pin_prompt): Rework the prompt texts. Factor some code out to ... (get_remaining_tries): New. (verify_a_chv): Print a remaining counter also for the standard PIN. Rework the prompt texts. * agent/divert-scd.c (ask_for_card): Pretty format an OpenPGP serial no. Signed-off-by: Werner Koch <[email protected]>
* agent: Prepend the description to a PIN prompt.Werner Koch2017-02-224-19/+96
| | | | | | | | | | | | | | | | | | | | | | | | * agent/divert-scd.c (has_percent0A_suffix): New. (getpin_cb): Prepend DESC_TEXT to the prompt. * agent/findkey.c (modify_description): Rename to ... (agent_modify_description): this. MAke global. Add kludge to remove empty parentheses from the end. (agent_key_from_file, agent_delete_key): Adjust for above change. * agent/pksign.c (agent_pksign_do): Modify DESC_TEXT also when diverting to a card. -- Now that we have support for multiple tokens, it is important to show information on which key has been requested. Without that it may happen that the PIN for a wrong card is accidentally entered. The texts are a bit ugly, because they talk about "passphrase" but later about entering a PIN. A quick hack would be to s/passphrase/PIN/ in the description but that is complicated due to i18n. Another solution might be never to talk about PINs in the description but always about "passphrase: and only use "PIN" or "passphrase" on the left of the entry field.
* agent: Prepare to pass an additional parameter to the getpin callback.Werner Koch2017-02-225-46/+85
| | | | | | | | | | | | | | | | | | | | | | | | | * agent/call-scd.c (writekey_parm_s, inq_needpin_s): Merge into ... (inq_needpin_parm_s): new struct. Add new field 'getpin_cb_desc'. Change users to set all fields. (inq_needpin): Pass GETPIN_CB_DESC to the GETPIN_CB. (agent_card_pksign): Add arg 'desc_text' and change arg 'getpin_cb' to take an additional arg 'desc_text'. (agent_card_pkdecrypt): Ditto. (agent_card_writekey): Change arg 'getpin_cb' to take an additional arg 'desc_text'. (agent_card_scd): Ditto. * agent/divert-scd.c (getpin_cb): Add new arg 'desc_text'. (divert_pksign): Add new arg 'desc_text' and pass is to agent_card_pksign. (divert_pkdecrypt): Add new arg 'desc_text' and pass is to agent_card_pkdecrypt. * agent/pkdecrypt.c (agent_pkdecrypt): Pass DESC_TEXT to divert_pkdecrypt. * agent/pksign.c (agent_pksign_do): Pass DESC_TEXT to divert_pksign. -- Signed-off-by: Werner Koch <[email protected]>
* Fix spelling.Daniel Kahn Gillmor2017-02-211-3/+3
| | | | | | | | | -- Clean up several other misspellings noticed while reviewing Yuri's de-duplication patch. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Clean up word replication.Yuri Chornoivan2017-02-2110-16/+16
| | | | | | | | | -- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* agent: No cards is not an error.NIIBE Yutaka2017-02-171-0/+6
| | | | | | * agent/command-ssh.c (card_key_list): Care the case of no cards. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Send back all public keys for available cards.NIIBE Yutaka2017-02-173-8/+135
| | | | | | | | | * agent/call-scd.c (card_cardlist_cb, agent_card_cardlist): New. * agent/command-ssh.c (card_key_list): New. (ssh_handler_request_identities): Call card_key_list and loop for the list to send public keys for all available cards. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Tell pinentry the hostname the agent is running on.Werner Koch2017-02-031-1/+11
| | | | | | | * agent/call-pinentry.c [!W32]: Incluse utsname.h (start_pinentry): Pass nodename to OPTION/owner. Signed-off-by: Werner Koch <[email protected]>
* agent: Tell the Pinentry the client's pid.Werner Koch2017-02-034-1/+63
| | | | | | | | | | | * configure.ac: Check for SO_PEERCRED et al. * agent/agent.h (server_control_s): Add field 'client_pid'. * agent/command.c (start_command_handler): Set CLIENT_PID. * agent/command-ssh.c (get_client_pid): New. (start_command_handler_ssh): Set CLIENT_PID. * agent/call-pinentry.c (start_pinentry): Tell Pinentry the client-pid. Signed-off-by: Werner Koch <[email protected]>
* gpg: More diagnostics for a launched pinentry.Werner Koch2017-02-031-1/+5
| | | | | | | | | | | | | | | | | | | * agent/call-pinentry.c (start_pinentry): Call getinfo/ttyinfo. * g10/server.c (gpg_proxy_pinentry_notify): Simplify the output so that we do not change the code when adding new fields to PINENTRY_LAUNCHED. -- This patch changes the --verbose output of gpg to show for example gpg: pinentry launched (5228 gtk2 1.0.1-beta10 \ /dev/pts/4 xterm localhost:10.0) the used tty, its type, and the value of DISPLAY in addiion to the pid, flavor, and version. Signed-off-by: Werner Koch <[email protected]>
* Fix explanation of commit e175152ef7515921635bf1e00383e812668d13fc.Werner Koch2017-02-011-3/+5
| | | | --
* Explain commit e175152ef7515921635bf1e00383e812668d13fc.Werner Koch2017-01-301-1/+9
| | | | --
* agent: Fix double free.Justus Winter2017-01-251-2/+15
| | | | | | | | | | | | | | | | | * agent/cache.c (agent_store_cache_hit): Make sure the update is atomic. -- Previously, the function freed the last key, and duplicated the new key after doing that. There is a chance, however, that calling the allocator surrenders control to a different thread, causing a double free if a different thread also calls this function. To make sure the update is atomic under the non-preemptive thread model, we must make sure not to surrender control to a different thread. Therefore, we avoid calling the allocator during the update. Signed-off-by: Justus Winter <[email protected]>
* Update copyright notices for 2017.Werner Koch2017-01-232-3/+3
| | | | | | | | -- Also some http:// -> https:// fixes. Signed-off-by: Werner Koch <[email protected]>
* agent: Reduce sleep time in the progress callback.Werner Koch2017-01-181-2/+10
| | | | | | | | | | * agent/gpg-agent.c (agent_libgcrypt_progress_cb): Reduce sleep time from 100ms to 1ms or use gpgrt_yield when build against a recent libgpg-error. -- Debian-bug-id: 851298 Signed-off-by: Werner Koch <[email protected]>
* agent: Ask specific SERIALNO for pksign/pkdecrypt.NIIBE Yutaka2017-01-165-7/+19
| | | | | | | | | * agent/call-scd.c (agent_card_serialno): Add DEMAND argument. * agent/command-ssh.c (card_key_available): Follow the change. * agent/learncard.c (agent_handle_learn): Likewise. * agent/divert-scd.c (ask_for_card): Use DEMAND argument. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent,w32: Fix annoying output to DebugView.Werner Koch2017-01-061-2/+6
| | | | | | | | | * agent/gpg-agent.c (startup_fd_list): Do not define for W32. (main) [W32]: Do not call get_all_open_fds. -- GnuPG-bug-id: 2267 Signed-off-by: Werner Koch <[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]>
* agent: Respect --enable-large-secmemDaniel Kahn Gillmor2016-12-061-1/+1
| | | | | | | | | | | | * agent/gpg-agent.c (main): Initialize secmem to the configured buffer size. -- This patch is a step toward addressing GnuPG-bug-id: 2857 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* agent,dirmngr: Tiny restructuring.Werner Koch2016-11-291-1/+6
| | | | | | | | | | * agent/gpg-agent.c (handle_connections): Add a comment. * dirmngr/dirmngr.c (main): Move assuan_sock_close of the listening socket to ... (handle_connections): here. Add a comment why we keep the listening socket open during a shutdown. Signed-off-by: Werner Koch <[email protected]>
* agent,dirmngr: Handle corner case in shutdown mode.Werner Koch2016-11-291-0/+6
| | | | | | | | | | | | | * agent/gpg-agent.c (handle_connections): Keep on selecting on the inotify fd even when a shutdown is pending. * dirmngr/dirmngr.c (handle_connections): Ditto. Also simplifyy the use of the HAVE_INOTIFY_INIT cpp conditional. -- Without that patch we won't notice a removed socket when a shutdown is pending. This is somewhat related to bug report 2849. Signed-off-by: Werner Koch <[email protected]>
* agent,w32: Initialize nPth in server mode.Werner Koch2016-11-291-0/+5
| | | | | | | | | * agent/gpg-agent.c (main) [W32]: Call initialize_modules in server mode. -- Fixes-commit: 9a707a223a3d45ccf245dee7989ca144e4e6bb49 Signed-off-by: Werner Koch <[email protected]>
* agent: Fix npth + daemon mode problem.NIIBE Yutaka2016-11-211-2/+0
| | | | | | | | | | | | | * agent/gpg-agent.c (main): Remove duplicated initialization in daemon mode. -- The commit f57dc2b1e6f28d164f882373535dbcb0d632ca17 fixes a part of problem (for missing initialization of supervised mode). It was actually put in wrong place. Fixes-commit: 9f92b62a51d2d60f038fdbe01602865c5933fa95 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Improve concurrency when Libgcrypt 1.8 is used.Werner Koch2016-11-121-9/+15
| | | | | | | | | | | | * agent/gpg-agent.c (thread_init_once): Tell Libgcrypt to reinit the system call clamp. (agent_libgcrypt_progress_cb): Do not sleep if Libgcrypt is recent enough. -- This patch prepares for a feature comming with Libgcrypt 1.8. Signed-off-by: Werner Koch <[email protected]>
* agent: Kludge to mitigate blocking calls in Libgcrypt.Werner Koch2016-11-111-3/+14
| | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (agent_libgcrypt_progress_cb): Sleep for 100ms on "need_entropy". -- During key generation Libgrypt will read from /dev/random which may block. Libgcrypt is not nPth aware and thus the entire process will block. Fortunately there is also a select with a short timeout to run the progress callback. We detect this in gpg-agent and introduce a short delay to give other threads (i.e. connections) an opportunity to run. This alone is not sufficient, an updated Libgpg-error is also required to make the lock functions nPth aware. Signed-off-by: Werner Koch <[email protected]>
* agent: Clean up comments.Daniel Kahn Gillmor2016-11-111-2/+2
| | | | | | * agent/agent.h: Clean up comments. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-0524-24/+24
| | | | --
* agent: Extend the PINENTRY_LAUNCHED inquiry and status.Werner Koch2016-11-033-5/+30
| | | | | | | | | * agent/call-pinentry.c (start_pinentry): Get flavor and version and pass it to agent_inq_pinentry_launched. * agent/command.c (agent_inq_pinentry_launched): Add arg EXTRA. * g10/server.c (gpg_proxy_pinentry_notify): Print a new diagnostic. Signed-off-by: Werner Koch <[email protected]>
* Spelling: correct spelling of "passphrase".Daniel Kahn Gillmor2016-11-022-3/+3
| | | | | | | | | | | 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]>
* agent,common: move get_socket_name() into common.Daniel Kahn Gillmor2016-10-271-48/+2
| | | | | | | | | | * agent/gpg-agent.c (get_socket_name): move to ... * common/sysutils.c (gnupg_get_socket_name): ... here. -- This allows us to use the same functionality in dirmngr as well. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* agent: Avoid double error message.Werner Koch2016-10-261-4/+3
| | | | | | | | | | | * agent/gpg-agent.c (map_supervised_sockets): Shorten error message. Remove unneeded diagnostic. -- get_socket_name already prints error messages and thus there is not need to print another one. Signed-off-by: Werner Koch <[email protected]>
* agent: --supervised mode improvements.Daniel Kahn Gillmor2016-10-261-0/+7
| | | | | | | | * agent/gpg-agent.c (map_supervised_socket): if the agent is running in --supervised mode and is not actually given LISTEN_FDNAMES directives, require at least fd 3 to be open for listening. -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>