diff options
author | Werner Koch <[email protected]> | 2001-11-26 17:54:49 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2001-11-26 17:54:49 +0000 |
commit | d9aecd9eb76888ca6c78c6765df5ff701e41549a (patch) | |
tree | d77fbdcd86ac081745ce57e00867565c63f407e1 /sm | |
parent | * keydb.c (keydb_add_resource): Create keybox (diff) | |
download | gnupg-d9aecd9eb76888ca6c78c6765df5ff701e41549a.tar.gz gnupg-d9aecd9eb76888ca6c78c6765df5ff701e41549a.zip |
* gpgsm.c: New option --agent-program
* call-agent.c (start_agent): Allow to override the default path
to the agent.
Diffstat (limited to 'sm')
-rw-r--r-- | sm/ChangeLog | 4 | ||||
-rw-r--r-- | sm/call-agent.c | 16 | ||||
-rw-r--r-- | sm/gpgsm.c | 5 | ||||
-rw-r--r-- | sm/gpgsm.h | 1 |
4 files changed, 21 insertions, 5 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog index 878002c5d..f0d7c2fe2 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,5 +1,9 @@ 2001-11-26 Werner Koch <[email protected]> + * gpgsm.c: New option --agent-program + * call-agent.c (start_agent): Allow to override the default path + to the agent. + * keydb.c (keydb_add_resource): Create keybox * keylist.c (gpgsm_list_keys): Fixed non-server keylisting. diff --git a/sm/call-agent.c b/sm/call-agent.c index 16cc46fb7..714021787 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -335,8 +335,9 @@ start_agent (void) if (!pid) { /* child */ int i, n; - char errbuf[100]; + char errbuf[512]; int log_fd = log_get_fd (); + const char *pgmname; /* close all files which will not be duped but keep stderr and log_stream for now */ @@ -371,10 +372,17 @@ start_agent (void) } /* and start it */ - execl ("../agent/gpg-agent", "gpg-agent", "--server", NULL); + if (!opt.agent_program || !*opt.agent_program) + opt.agent_program = "../agent/gpg-agent"; + if ( !(pgmname = strrchr (opt.agent_program, '/'))) + pgmname = opt.agent_program; + else + pgmname++; + execl (opt.agent_program, pgmname, "--server", NULL); /* oops - tell the parent about it */ - snprintf (errbuf, DIM(errbuf)-1, "ERR %d execl failed: %.50s\n", - ASSUAN_Problem_Starting_Server, strerror (errno)); + snprintf (errbuf, DIM(errbuf)-1, "ERR %d can't exec `%s': %.50s\n", + ASSUAN_Problem_Starting_Server, opt.agent_program, + strerror (errno)); errbuf[DIM(errbuf)-1] = 0; writen (1, errbuf, strlen (errbuf)); _exit (4); diff --git a/sm/gpgsm.c b/sm/gpgsm.c index c7ee41980..0b6b7c237 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -77,7 +77,7 @@ enum cmd_and_opt_values { aServer, oEnableSpecialFilenames, - + oAgentProgram, oTextmode, oFingerprint, @@ -279,6 +279,8 @@ static ARGPARSE_OPTS opts[] = { { oNoGreeting, "no-greeting", 0, "@" }, { oNoOptions, "no-options", 0, "@" }, /* shortcut for --options /dev/null */ { oHomedir, "homedir", 2, "@" }, /* defaults to "~/.gnupg" */ + { oAgentProgram, "agent-program", 2 , "@" }, + { oNoBatch, "no-batch", 0, "@" }, { oWithColons, "with-colons", 0, "@"}, { oWithKeyData,"with-key-data", 0, "@"}, @@ -707,6 +709,7 @@ main ( int argc, char **argv) break; case oNoOptions: break; /* no-options */ case oHomedir: opt.homedir = pargs.r.ret_str; break; + case oAgentProgram: opt.agent_program = pargs.r.ret_str; break; case oNoDefKeyring: default_keyring = 0; break; case oNoGreeting: nogreeting = 1; break; diff --git a/sm/gpgsm.h b/sm/gpgsm.h index a6eaf26ee..00ae32e00 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -38,6 +38,7 @@ struct { int dry_run; /* don't change any persistent data */ const char *homedir; /* configuration directory name */ + const char *agent_program; char *outfile; /* name of output file */ int with_key_data;/* include raw key in the column delimted output */ |