mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
Add OPTION:cache-ttl-opt-preset to gpg-agent.
This option may be used to change the default ttl values use with the --preset option of GENKEY and PASSWD.
This commit is contained in:
parent
dd491d290a
commit
4caa768f1d
@ -1,3 +1,11 @@
|
||||
2011-04-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* agent.h (server_control_s): Add field cache_ttl_opt_preset.
|
||||
* gpg-agent.c (agent_init_default_ctrl): Init this field.
|
||||
* genkey.c (agent_genkey): Use this new variable.
|
||||
* command.c (cmd_passwd): Ditto.
|
||||
(option_handler): Add new option cache-ttl-opt-preset.
|
||||
|
||||
2011-04-20 Marcus Brinkmann <mb@g10code.com>
|
||||
|
||||
* command.c (cmd_import_key): Release key from failed import
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* agent.h - Global definitions for the agent
|
||||
* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2001, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -164,6 +164,10 @@ struct server_control_s
|
||||
/* The current pinentry mode. */
|
||||
pinentry_mode_t pinentry_mode;
|
||||
|
||||
/* The TTL used for the --preset option of certain commands. */
|
||||
int cache_ttl_opt_preset;
|
||||
|
||||
/* Information on the currently used digest (for signing commands). */
|
||||
struct {
|
||||
int algo;
|
||||
unsigned char value[MAX_DIGEST_LEN];
|
||||
@ -220,7 +224,8 @@ cache_mode_t;
|
||||
/* The TTL is seconds used for adding a new nonce mode cache item. */
|
||||
#define CACHE_TTL_NONCE 120
|
||||
|
||||
/* The TTL in seconds used by the --preset option of some commands. */
|
||||
/* The TTL in seconds used by the --preset option of some commands.
|
||||
This is the default value changeable by an OPTION command. */
|
||||
#define CACHE_TTL_OPT_PRESET 900
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* command.c - gpg-agent command handler
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005,
|
||||
* 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010,
|
||||
* 2011 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
@ -1535,7 +1535,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
|
||||
char hexgrip[40+1];
|
||||
bin2hex(grip, 20, hexgrip);
|
||||
err = agent_put_cache (hexgrip, CACHE_MODE_ANY, newpass,
|
||||
CACHE_TTL_OPT_PRESET);
|
||||
ctrl->cache_ttl_opt_preset);
|
||||
}
|
||||
xfree (newpass);
|
||||
}
|
||||
@ -2470,6 +2470,10 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
|
||||
else
|
||||
err = gpg_error (GPG_ERR_INV_VALUE);
|
||||
}
|
||||
else if (!strcmp (key, "cache-ttl-opt-preset"))
|
||||
{
|
||||
ctrl->cache_ttl_opt_preset = *value? atoi (value) : 0;
|
||||
}
|
||||
else
|
||||
err = gpg_error (GPG_ERR_UNKNOWN_OPTION);
|
||||
|
||||
|
@ -432,7 +432,7 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
|
||||
if (cache_nonce
|
||||
&& !no_protection
|
||||
&& !agent_put_cache (cache_nonce, CACHE_MODE_NONCE,
|
||||
passphrase, CACHE_TTL_OPT_PRESET))
|
||||
passphrase, ctrl->cache_ttl_opt_preset))
|
||||
agent_write_status (ctrl, "CACHE_NONCE", cache_nonce, NULL);
|
||||
if (preset && !no_protection)
|
||||
{
|
||||
@ -442,7 +442,7 @@ agent_genkey (ctrl_t ctrl, const char *cache_nonce,
|
||||
{
|
||||
bin2hex(grip, 20, hexgrip);
|
||||
rc = agent_put_cache (hexgrip, CACHE_MODE_ANY, passphrase,
|
||||
CACHE_TTL_OPT_PRESET);
|
||||
ctrl->cache_ttl_opt_preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1315,6 +1315,7 @@ agent_init_default_ctrl (ctrl_t ctrl)
|
||||
ctrl->lc_messages = default_lc_messages? xtrystrdup (default_lc_messages)
|
||||
/**/ : NULL;
|
||||
|
||||
ctrl->cache_ttl_opt_preset = CACHE_TTL_OPT_PRESET;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1348,6 +1348,12 @@ following values are defined:
|
||||
Use the @xref{option --allow-loopback-pinentry}.
|
||||
|
||||
@end table
|
||||
|
||||
@item cache-ttl-opt-preset
|
||||
This option sets the cache TTL for new entries created by GENKEY and
|
||||
PASSWD commands when using the @option{--preset} option. It it is not
|
||||
used a default value is used.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user