aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr
diff options
context:
space:
mode:
Diffstat (limited to 'dirmngr')
-rw-r--r--dirmngr/dirmngr.c25
-rw-r--r--dirmngr/dirmngr.h3
-rw-r--r--dirmngr/server.c23
3 files changed, 20 insertions, 31 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index f249d683f..bc71a4072 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -795,9 +795,7 @@ main (int argc, char **argv)
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )
csh_style = 1;
- opt.homedir = default_homedir ();
-
- /* Now with NPth running we can set the logging callback. Our
+ /* Now with NPth running we can set the logging callback. Our
windows implementation does not yet feature the NPth TLS
functions. */
#ifndef HAVE_W32_SYSTEM
@@ -835,7 +833,7 @@ main (int argc, char **argv)
default_config = 0; /* --no-options */
else if (pargs.r_opt == oHomedir)
{
- opt.homedir = pargs.r.ret_str;
+ gnupg_set_homedir (pargs.r.ret_str);
homedir_seen = 1;
}
else if (pargs.r_opt == aDaemon)
@@ -862,9 +860,9 @@ main (int argc, char **argv)
if (opt.system_daemon && !homedir_seen)
{
#ifdef HAVE_W32CE_SYSTEM
- opt.homedir = DIRSEP_S "gnupg";
+ gnupg_set_homedir (DIRSEP_S "gnupg");
#else
- opt.homedir = gnupg_sysconfdir ();
+ gnupg_set_homedir (gnupg_sysconfdir ());
#endif
opt.homedir_cache = gnupg_cachedir ();
socket_name = dirmngr_sys_socket_name ();
@@ -875,7 +873,7 @@ main (int argc, char **argv)
socket_name = dirmngr_sys_socket_name ();
if (default_config)
- configname = make_filename (opt.homedir, DIRMNGR_NAME".conf", NULL );
+ configname = make_filename (gnupg_homedir (), DIRMNGR_NAME".conf", NULL );
argc = orig_argc;
argv = orig_argv;
@@ -989,7 +987,7 @@ main (int argc, char **argv)
greeting = 0;
if (!opt.homedir_cache)
- opt.homedir_cache = opt.homedir;
+ opt.homedir_cache = xstrdup (gnupg_homedir ());
if (greeting)
{
@@ -1019,7 +1017,8 @@ main (int argc, char **argv)
log_info (_("Note: '%s' is not considered an option\n"), argv[i]);
}
- if (!access ("/etc/"DIRMNGR_NAME, F_OK) && !strncmp (opt.homedir, "/etc/", 5))
+ if (!access ("/etc/"DIRMNGR_NAME, F_OK)
+ && !strncmp (gnupg_homedir (), "/etc/", 5))
log_info
("NOTE: DirMngr is now a proper part of %s. The configuration and"
" other directory names changed. Please check that no other version"
@@ -1043,7 +1042,7 @@ main (int argc, char **argv)
#if USE_LDAP
if (!ldapfile)
{
- ldapfile = make_filename (opt.homedir,
+ ldapfile = make_filename (gnupg_homedir (),
opt.system_daemon?
"ldapservers.conf":"dirmngr_ldapservers.conf",
NULL);
@@ -1396,7 +1395,7 @@ main (int argc, char **argv)
/* First the configuration file. This is not an option, but it
is vital information for GPG Conf. */
if (!opt.config_filename)
- opt.config_filename = make_filename (opt.homedir,
+ opt.config_filename = make_filename (gnupg_homedir (),
"dirmngr.conf", NULL );
filename = percent_escape (opt.config_filename, NULL);
@@ -1416,7 +1415,7 @@ main (int argc, char **argv)
and having both of them is thus problematic. --no-detach is
also only usable on the command line. --batch is unused. */
- filename = make_filename (opt.homedir,
+ filename = make_filename (gnupg_homedir (),
opt.system_daemon?
"ldapservers.conf":"dirmngr_ldapservers.conf",
NULL);
@@ -1658,7 +1657,7 @@ parse_ocsp_signer (const char *string)
{
if (string[0] == '.' && string[1] == '/' )
string += 2;
- fname = make_filename (opt.homedir, string, NULL);
+ fname = make_filename (gnupg_homedir (), string, NULL);
}
fp = es_fopen (fname, "r");
diff --git a/dirmngr/dirmngr.h b/dirmngr/dirmngr.h
index 60788842b..8d90ae439 100644
--- a/dirmngr/dirmngr.h
+++ b/dirmngr/dirmngr.h
@@ -79,8 +79,7 @@ struct
int quiet; /* be as quiet as possible */
int dry_run; /* don't change any persistent data */
int batch; /* batch mode */
- const char *homedir; /* Configuration directory name */
- const char *homedir_cache; /* Ditto for cache files (/var/cache/dirmngr). */
+ const char *homedir_cache; /* Dir for cache files (/var/cache/dirmngr). */
char *config_filename; /* Name of a config file, which will be
reread on a HUP if it is not NULL. */
diff --git a/dirmngr/server.c b/dirmngr/server.c
index bca0d8ef2..6eb6f1bef 100644
--- a/dirmngr/server.c
+++ b/dirmngr/server.c
@@ -2440,22 +2440,13 @@ start_command_handler (assuan_fd_t fd)
if (!hello_line)
{
- size_t n;
- const char *cfgname;
-
- cfgname = opt.config_filename? opt.config_filename : "[none]";
-
- n = (30 + strlen (opt.homedir) + strlen (cfgname)
- + strlen (hello) + 1);
- hello_line = xmalloc (n+1);
- snprintf (hello_line, n,
- "Home: %s\n"
- "Config: %s\n"
- "%s",
- opt.homedir,
- cfgname,
- hello);
- hello_line[n] = 0;
+ hello_line = xtryasprintf
+ ("Home: %s\n"
+ "Config: %s\n"
+ "%s",
+ gnupg_homedir (),
+ opt.config_filename? opt.config_filename : "[none]",
+ hello);
}
ctrl->server_local->assuan_ctx = ctx;