diff options
author | Werner Koch <[email protected]> | 2017-11-06 13:20:03 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2017-11-06 14:03:06 +0000 |
commit | 52d41c8b0f4af6278d18d8935399ddad16a26856 (patch) | |
tree | 01b301ebe37b13766e2cd190e7e8b11400d7fe7e /agent/command.c | |
parent | agent: New option --s2k-count. (diff) | |
download | gnupg-52d41c8b0f4af6278d18d8935399ddad16a26856.tar.gz gnupg-52d41c8b0f4af6278d18d8935399ddad16a26856.zip |
agent: New GETINFO sub-commands "s2k_count_cal" and "s2k_time".
* agent/command.c (cmd_getinfo): New sub-commands.
* agent/protect.c (get_standard_s2k_count): Factor some code out to ...
(get_calibrated_s2k_count): new.
(get_standard_s2k_time): New.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/command.c')
-rw-r--r-- | agent/command.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/agent/command.c b/agent/command.c index 3b249b1bd..7c7e8a4bc 100644 --- a/agent/command.c +++ b/agent/command.c @@ -2843,20 +2843,22 @@ static const char hlp_getinfo[] = "Multipurpose function to return a variety of information.\n" "Supported values for WHAT are:\n" "\n" - " version - Return the version of the program.\n" - " pid - Return the process id of the server.\n" - " socket_name - Return the name of the socket.\n" + " version - Return the version of the program.\n" + " pid - Return the process id of the server.\n" + " socket_name - Return the name of the socket.\n" " ssh_socket_name - Return the name of the ssh socket.\n" - " scd_running - Return OK if the SCdaemon is already running.\n" - " s2k_count - Return the calibrated S2K count.\n" + " scd_running - Return OK if the SCdaemon is already running.\n" + " s2k_time - Return the time in milliseconds required for S2K.\n" + " s2k_count - Return the standard S2K count.\n" + " s2k_count_cal - Return the calibrated S2K count.\n" " std_env_names - List the names of the standard environment.\n" " std_session_env - List the standard session environment.\n" " std_startup_env - List the standard startup environment.\n" - " cmd_has_option\n" - " - Returns OK if the command CMD implements the option OPT.\n" - " connections - Return number of active connections.\n" - " jent_active - Returns OK if Libgcrypt's JENT is active.\n" - " restricted - Returns OK if the connection is in restricted mode.\n"; + " connections - Return number of active connections.\n" + " jent_active - Returns OK if Libgcrypt's JENT is active.\n" + " restricted - Returns OK if the connection is in restricted mode.\n" + " cmd_has_option CMD OPT\n" + " - Returns OK if command CMD has option OPT.\n"; static gpg_error_t cmd_getinfo (assuan_context_t ctx, char *line) { @@ -3014,6 +3016,20 @@ cmd_getinfo (assuan_context_t ctx, char *line) rc = gpg_error (GPG_ERR_FALSE); #endif } + else if (!strcmp (line, "s2k_count_cal")) + { + char numbuf[50]; + + snprintf (numbuf, sizeof numbuf, "%lu", get_calibrated_s2k_count ()); + rc = assuan_send_data (ctx, numbuf, strlen (numbuf)); + } + else if (!strcmp (line, "s2k_time")) + { + char numbuf[50]; + + snprintf (numbuf, sizeof numbuf, "%lu", get_standard_s2k_time ()); + rc = assuan_send_data (ctx, numbuf, strlen (numbuf)); + } else rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT"); return rc; |