aboutsummaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
Diffstat (limited to 'g10')
-rw-r--r--g10/call-agent.c14
-rw-r--r--g10/call-dirmngr.c14
-rw-r--r--g10/gpg.c5
-rw-r--r--g10/options.h1
4 files changed, 30 insertions, 4 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c
index 74d8cec28..f5c943d70 100644
--- a/g10/call-agent.c
+++ b/g10/call-agent.c
@@ -285,9 +285,19 @@ start_agent (ctrl_t ctrl, int for_card)
opt.agent_program,
opt.lc_ctype, opt.lc_messages,
opt.session_env,
- 1, opt.verbose, DBG_ASSUAN,
+ opt.autostart, opt.verbose, DBG_ASSUAN,
NULL, NULL);
- if (!rc)
+ if (!opt.autostart && gpg_err_code (rc) == GPG_ERR_NO_AGENT)
+ {
+ static int shown;
+
+ if (!shown)
+ {
+ shown = 1;
+ log_info (_("no gpg-agent running in this session\n"));
+ }
+ }
+ else if (!rc)
{
/* Tell the agent that we support Pinentry notifications.
No error checking so that it will work also with older
diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c
index 7150853e3..b802f81ef 100644
--- a/g10/call-dirmngr.c
+++ b/g10/call-dirmngr.c
@@ -130,9 +130,19 @@ create_context (ctrl_t ctrl, assuan_context_t *r_ctx)
GPG_ERR_SOURCE_DEFAULT,
opt.homedir,
opt.dirmngr_program,
- 1, opt.verbose, DBG_ASSUAN,
+ opt.autostart, opt.verbose, DBG_ASSUAN,
NULL /*gpg_status2*/, ctrl);
- if (!err)
+ if (!opt.autostart && gpg_err_code (err) == GPG_ERR_NO_DIRMNGR)
+ {
+ static int shown;
+
+ if (!shown)
+ {
+ shown = 1;
+ log_info (_("no dirmngr running in this session\n"));
+ }
+ }
+ else if (!err)
{
keyserver_spec_t ksi;
diff --git a/g10/gpg.c b/g10/gpg.c
index a2225a028..6e6407a97 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -379,6 +379,7 @@ enum cmd_and_opt_values
oNoAllowMultipleMessages,
oAllowWeakDigestAlgos,
oFakedSystemTime,
+ oNoAutostart,
oNoop
};
@@ -786,6 +787,7 @@ static ARGPARSE_OPTS opts[] = {
/* New options. Fixme: Should go more to the top. */
ARGPARSE_s_s (oAutoKeyLocate, "auto-key-locate", "@"),
ARGPARSE_s_n (oNoAutoKeyLocate, "no-auto-key-locate", "@"),
+ ARGPARSE_s_n (oNoAutostart, "no-autostart", "@"),
/* Dummy options with warnings. */
ARGPARSE_s_n (oUseAgent, "use-agent", "@"),
@@ -2080,6 +2082,7 @@ main (int argc, char **argv)
dotlock_create (NULL, 0); /* Register lock file cleanup. */
+ opt.autostart = 1;
opt.session_env = session_env_new ();
if (!opt.session_env)
log_fatal ("error allocating session environment block: %s\n",
@@ -3131,6 +3134,8 @@ main (int argc, char **argv)
}
break;
+ case oNoAutostart: opt.autostart = 0; break;
+
case oNoop: break;
default:
diff --git a/g10/options.h b/g10/options.h
index 6a94ff43a..7ec81af36 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -53,6 +53,7 @@ struct
estream_t outfp; /* Hack, sometimes used in place of outfile. */
off_t max_output;
int dry_run;
+ int autostart;
int list_only;
int textmode;
int expert;