summaryrefslogtreecommitdiffstats
path: root/sm
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-06-07 10:59:46 +0200
committerWerner Koch <wk@gnupg.org>2016-06-07 10:59:46 +0200
commit22a7ef01aa2c0eb77bcc40174d09104acc35cab1 (patch)
tree3782b20549fcc48d2598128676227d9a16f785b6 /sm
parentpo: Update Japanese translation. (diff)
downloadgnupg2-22a7ef01aa2c0eb77bcc40174d09104acc35cab1.tar.xz
gnupg2-22a7ef01aa2c0eb77bcc40174d09104acc35cab1.zip
Replace use of opt.homedir by accessor functions.
* common/homedir.c (the_gnupg_homedir): New var. (gnupg_set_homedir): New. (gnupg_homedir): New. * g10/options.h (struct opt): Remove 'homedir' and replace all users by the new accessor functions. * g13/g13-common.h (struct opt): Ditto. * scd/scdaemon.h (struct opt): Ditto. * sm/gpgsm.h (struct opt): Ditto. * dirmngr/dirmngr.h (struct opt): Ditto. * agent/preset-passphrase.c (opt_homedir): Ditto. * agent/protect-tool.c (opt_homedir): Ditto. -- This will make detection of a non-default homedir easier. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'sm')
-rw-r--r--sm/call-agent.c2
-rw-r--r--sm/call-dirmngr.c2
-rw-r--r--sm/gpgsm.c17
-rw-r--r--sm/gpgsm.h1
-rw-r--r--sm/keydb.c2
-rw-r--r--sm/server.c4
6 files changed, 13 insertions, 15 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c
index 8c1c7276c..09ae3594e 100644
--- a/sm/call-agent.c
+++ b/sm/call-agent.c
@@ -133,7 +133,7 @@ start_agent (ctrl_t ctrl)
{
rc = start_new_gpg_agent (&agent_ctx,
GPG_ERR_SOURCE_DEFAULT,
- opt.homedir,
+ gnupg_homedir (),
opt.agent_program,
opt.lc_ctype, opt.lc_messages,
opt.session_env,
diff --git a/sm/call-dirmngr.c b/sm/call-dirmngr.c
index 881c484d5..a3b9ca86e 100644
--- a/sm/call-dirmngr.c
+++ b/sm/call-dirmngr.c
@@ -248,7 +248,7 @@ start_dirmngr_ext (ctrl_t ctrl, assuan_context_t *ctx_r)
to take care of the implicit option sending caching. */
err = start_new_dirmngr (&ctx, GPG_ERR_SOURCE_DEFAULT,
- opt.homedir, opt.dirmngr_program,
+ gnupg_homedir (), opt.dirmngr_program,
opt.autostart, opt.verbose, DBG_IPC,
gpgsm_status2, ctrl);
if (!opt.autostart && gpg_err_code (err) == GPG_ERR_NO_DIRMNGR)
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index fc6d1c75a..e6fd70360 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -581,7 +581,7 @@ my_strusage( int level )
break;
case 31: p = "\nHome: "; break;
- case 32: p = opt.homedir; break;
+ case 32: p = gnupg_homedir (); break;
case 33: p = _("\nSupported algorithms:\n"); break;
case 34:
if (!ciphers)
@@ -964,8 +964,6 @@ main ( int argc, char **argv)
remember to update the Gpgconflist entry as well. */
opt.def_cipher_algoid = DEFAULT_CIPHER_ALGO;
- opt.homedir = default_homedir ();
-
/* First check whether we have a config file on the commandline */
orig_argc = argc;
@@ -989,7 +987,7 @@ main ( int argc, char **argv)
opt.no_homedir_creation = 1;
}
else if (pargs.r_opt == oHomedir)
- opt.homedir = pargs.r.ret_str;
+ gnupg_set_homedir (pargs.r.ret_str);
else if (pargs.r_opt == aCallProtectTool)
break; /* This break makes sure that --version and --help are
passed to the protect-tool. */
@@ -1024,9 +1022,10 @@ main ( int argc, char **argv)
/* Set the default option file */
if (default_config )
- configname = make_filename (opt.homedir, GPGSM_NAME EXTSEP_S "conf", NULL);
+ configname = make_filename (gnupg_homedir (),
+ GPGSM_NAME EXTSEP_S "conf", NULL);
/* Set the default policy file */
- opt.policy_file = make_filename (opt.homedir, "policies.txt", NULL);
+ opt.policy_file = make_filename (gnupg_homedir (), "policies.txt", NULL);
argc = orig_argc;
argv = orig_argv;
@@ -1304,7 +1303,7 @@ main ( int argc, char **argv)
}
break;
case oNoOptions: opt.no_homedir_creation = 1; break; /* no-options */
- case oHomedir: opt.homedir = pargs.r.ret_str; break;
+ case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
case oDisplay:
@@ -1468,7 +1467,7 @@ main ( int argc, char **argv)
configname = NULL;
if (!opt.config_filename)
- opt.config_filename = make_filename (opt.homedir,
+ opt.config_filename = make_filename (gnupg_homedir (),
GPGSM_NAME EXTSEP_S "conf",
NULL);
@@ -1605,7 +1604,7 @@ main ( int argc, char **argv)
/* Set the random seed file. */
if (use_random_seed)
{
- char *p = make_filename (opt.homedir, "random_seed", NULL);
+ char *p = make_filename (gnupg_homedir (), "random_seed", NULL);
gcry_control (GCRYCTL_SET_RANDOM_SEED_FILE, p);
xfree(p);
}
diff --git a/sm/gpgsm.h b/sm/gpgsm.h
index 5aad4b152..9751df4bb 100644
--- a/sm/gpgsm.h
+++ b/sm/gpgsm.h
@@ -61,7 +61,6 @@ struct
int dry_run; /* don't change any persistent data */
int no_homedir_creation;
- const char *homedir; /* Configuration directory name */
const char *config_filename; /* Name of the used config file. */
const char *agent_program;
diff --git a/sm/keydb.c b/sm/keydb.c
index 495eb497f..8a1efd454 100644
--- a/sm/keydb.c
+++ b/sm/keydb.c
@@ -287,7 +287,7 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created)
if (strchr(resname, DIRSEP_C) )
filename = make_filename (resname, NULL);
else
- filename = make_filename (opt.homedir, resname, NULL);
+ filename = make_filename (gnupg_homedir (), resname, NULL);
}
else
filename = xstrdup (resname);
diff --git a/sm/server.c b/sm/server.c
index a43ff3472..8b4a29c87 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -1308,7 +1308,7 @@ gpgsm_server (certlist_t default_recplist)
}
if (opt.verbose || opt.debug)
{
- char *tmp = NULL;
+ char *tmp;
/* Fixme: Use the really used socket name. */
if (asprintf (&tmp,
@@ -1316,7 +1316,7 @@ gpgsm_server (certlist_t default_recplist)
"Config: %s\n"
"DirmngrInfo: %s\n"
"%s",
- opt.homedir,
+ gnupg_homedir (),
opt.config_filename,
(dirmngr_user_socket_name ()
? dirmngr_user_socket_name ()