1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

* g10.c, options.h: New option --gpg-agent-info

* passphrase.c (agent_open): Let it override the environment info.
* seckey-cert.c (check_secret_key): Always try 3 times when the
agent is enabled.
* options.skel: Describe --use-agent.
This commit is contained in:
Werner Koch 2002-01-26 16:34:00 +00:00
parent 441eb085c9
commit 806a4fa16e
6 changed files with 50 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2002-01-26 Werner Koch <wk@gnupg.org>
* g10.c, options.h: New option --gpg-agent-info
* passphrase.c (agent_open): Let it override the environment info.
* seckey-cert.c (check_secret_key): Always try 3 times when the
agent is enabled.
* options.skel: Describe --use-agent.
2002-01-24 David Shaw <dshaw@jabberwocky.com>
* pubkey-enc.c (is_algo_in_prefs, get_it): Only check preferences

View File

@ -247,6 +247,7 @@ enum cmd_and_opt_values { aNull = 0,
oAutoKeyRetrieve,
oNoAutoKeyRetrieve,
oUseAgent,
oGpgAgentInfo,
oMergeOnly,
oTryAllSecrets,
oTrustedKey,
@ -358,6 +359,7 @@ static ARGPARSE_OPTS opts[] = {
{ oDryRun, "dry-run", 0, N_("do not make any changes") },
/*{ oInteractive, "interactive", 0, N_("prompt before overwriting") }, */
{ oUseAgent, "use-agent",0, N_("use the gpg-agent")},
{ oGpgAgentInfo, "gpg-agent-info",2, "@"},
{ oBatch, "batch", 0, N_("batch mode: never ask")},
{ oAnswerYes, "yes", 0, N_("assume yes on most questions")},
{ oAnswerNo, "no", 0, N_("assume no on most questions")},
@ -952,6 +954,7 @@ main( int argc, char **argv )
not_implemented("use-agent");
#endif /* __riscos__ */
break;
case oGpgAgentInfo: opt.gpg_agent_info = pargs.r.ret_str; break;
case oAnswerYes: opt.answer_yes = 1; break;
case oAnswerNo: opt.answer_no = 1; break;
case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;

View File

@ -133,6 +133,7 @@ struct {
const char *override_session_key;
int show_session_key;
int use_agent;
const char *gpg_agent_info;
int merge_only;
int try_all_secrets;
int no_expensive_trust_checks;

View File

@ -180,3 +180,27 @@ lock-once
#
# Use your MIME handler to view photos:
# photo-viewer "metamail -q -d -b -c image/jpeg -s 'KeyID 0x%k' -f GnuPG"
# Passphrase agent
#
# We support the old experimental passphrase agent protocol as well
# as the new Assuan based one (currently available in the "newpg" package
# at ftp.gnupg.org/gcrypt/alpha/aegypten/). To make use of the agent, you have
# to run an agent as daemon and use the option
#
# use-agent
#
# which tries to use the agent but will fallback to the regular mode
# if there is a problem connecting to the agent. The normal way to
# locate the agent is by looking at the environment variable
# GPG_AGENT_INFO which should have been set during gpg-agent startup.
# In certain situations the use of this variable is not possible, thus
# the option
#
# --gpg-agent-info=<path>:<pid>:1
#
# may be used to override it.
#

View File

@ -368,6 +368,10 @@ agent_open (int *ret_prot)
size_t len;
int prot;
if (opt.gpg_agent_info)
infostr = m_strdup (opt.gpg_agent_info);
else
{
infostr = getenv ( "GPG_AGENT_INFO" );
if ( !infostr ) {
log_error (_("gpg-agent is not available in this session\n"));
@ -375,6 +379,8 @@ agent_open (int *ret_prot)
return -1;
}
infostr = m_strdup ( infostr );
}
if ( !(p = strchr ( infostr, ':')) || p == infostr
|| (p-infostr)+1 >= sizeof client_addr.sun_path ) {
log_error( _("malformed GPG_AGENT_INFO environment variable\n"));

View File

@ -178,7 +178,7 @@ check_secret_key( PKT_secret_key *sk, int n )
int i;
if( n < 1 )
n = opt.batch? 1 : 3; /* use the default value */
n = (opt.batch && !opt.use_agent)? 1 : 3; /* use the default value */
for(i=0; i < n && rc == G10ERR_BAD_PASS; i++ ) {
const char *tryagain = NULL;