1 /* homedir.c - Setup the home directory.
2 * Copyright (C) 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
3 * Copyright (C) 2013, 2016 Werner Koch
5 * This file is part of GnuPG.
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of either
10 * - the GNU Lesser General Public License as published by the Free
11 * Software Foundation; either version 3 of the License, or (at
12 * your option) any later version.
16 * - the GNU General Public License as published by the Free
17 * Software Foundation; either version 2 of the License, or (at
18 * your option) any later version.
20 * or both in parallel, as here.
22 * This file is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, see <https://www.gnu.org/licenses/>.
37 #ifdef HAVE_W32_SYSTEM
38 #include <winsock2.h> /* Due to the stupid mingw64 requirement to
39 include this header before windows.h which
40 is often implicitly included. */
43 #define CSIDL_APPDATA 0x001a
45 #ifndef CSIDL_LOCAL_APPDATA
46 #define CSIDL_LOCAL_APPDATA 0x001c
48 #ifndef CSIDL_COMMON_APPDATA
49 #define CSIDL_COMMON_APPDATA 0x0023
51 #ifndef CSIDL_FLAG_CREATE
52 #define CSIDL_FLAG_CREATE 0x8000
54 #endif /*HAVE_W32_SYSTEM*/
57 #include <sys/stat.h> /* for stat() */
66 /* The GnuPG homedir. This is only accessed by the functions
67 * gnupg_homedir and gnupg_set_homedir. Malloced. */
68 static char *the_gnupg_homedir;
70 /* Flag indicating that home directory is not the default one. */
71 static byte non_default_homedir;
74 #ifdef HAVE_W32_SYSTEM
75 /* A flag used to indicate that a control file for gpgconf has been
76 detected. Under Windows the presence of this file indicates a
77 portable installations and triggers several changes:
79 - The GNUGHOME directory is fixed relative to installation
80 directory. All other means to set the home directory are ignore.
82 - All registry variables will be ignored.
84 This flag is not used on Unix systems.
86 static byte w32_portable_app;
87 #endif /*HAVE_W32_SYSTEM*/
89 #ifdef HAVE_W32_SYSTEM
90 /* This flag is true if this process' binary has been installed under
91 bin and not in the root directory as often used before GnuPG 2.1. */
92 static byte w32_bin_is_bin;
93 #endif /*HAVE_W32_SYSTEM*/
96 #ifdef HAVE_W32_SYSTEM
97 static const char *w32_rootdir (void);
102 #ifdef HAVE_W32_SYSTEM
104 w32_try_mkdir (const char *dir)
106 #ifdef HAVE_W32CE_SYSTEM
107 wchar_t *wdir = utf8_to_wchar (dir);
110 CreateDirectory (wdir, NULL);
114 CreateDirectory (dir, NULL);
120 /* This is a helper function to load a Windows function from either of
122 #ifdef HAVE_W32_SYSTEM
124 w32_shgetfolderpath (HWND a, int b, HANDLE c, DWORD d, LPSTR e)
126 static int initialized;
127 static HRESULT (WINAPI * func)(HWND,int,HANDLE,DWORD,LPSTR);
131 static char *dllnames[] = { "shell32.dll", "shfolder.dll", NULL };
137 for (i=0, handle = NULL; !handle && dllnames[i]; i++)
139 handle = dlopen (dllnames[i], RTLD_LAZY);
142 func = dlsym (handle, "SHGetFolderPathA");
153 return func (a,b,c,d,e);
157 #endif /*HAVE_W32_SYSTEM*/
160 /* Check whether DIR is the default homedir. */
162 is_gnupg_default_homedir (const char *dir)
165 char *a = make_absfilename (dir, NULL);
166 char *b = make_absfilename (GNUPG_DEFAULT_HOMEDIR, NULL);
167 result = !compare_filenames (a, b);
174 /* Get the standard home directory. In general this function should
175 not be used as it does not consider a registry value (under W32) or
176 the GNUPGHOME environment variable. It is better to use
177 default_homedir(). */
179 standard_homedir (void)
181 #ifdef HAVE_W32_SYSTEM
182 static const char *dir;
188 rdir = w32_rootdir ();
189 if (w32_portable_app)
191 dir = xstrconcat (rdir, DIRSEP_S "home", NULL);
197 /* It might be better to use LOCAL_APPDATA because this is
198 defined as "non roaming" and thus more likely to be kept
199 locally. For private keys this is desired. However,
200 given that many users copy private keys anyway forth and
201 back, using a system roaming services might be better
202 than to let them do it manually. A security conscious
203 user will anyway use the registry entry to have better
205 if (w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
208 char *tmp = xmalloc (strlen (path) + 6 +1);
209 strcpy (stpcpy (tmp, path), "\\gnupg");
212 /* Try to create the directory if it does not yet exists. */
213 if (access (dir, F_OK))
217 dir = GNUPG_DEFAULT_HOMEDIR;
221 #else/*!HAVE_W32_SYSTEM*/
222 return GNUPG_DEFAULT_HOMEDIR;
223 #endif /*!HAVE_W32_SYSTEM*/
226 /* Set up the default home directory. The usual --homedir option
227 should be parsed later. */
229 default_homedir (void)
233 #ifdef HAVE_W32_SYSTEM
234 /* For a portable application we only use the standard homedir. */
236 if (w32_portable_app)
237 return standard_homedir ();
238 #endif /*HAVE_W32_SYSTEM*/
240 dir = getenv ("GNUPGHOME");
241 #ifdef HAVE_W32_SYSTEM
244 static const char *saved_dir;
252 tmp = read_w32_registry_string (NULL,
262 /* Strip trailing backslashes. */
263 p = tmp + strlen (tmp) - 1;
264 while (p > tmp && *p == '\\')
271 saved_dir = standard_homedir ();
275 #endif /*HAVE_W32_SYSTEM*/
278 dir = GNUPG_DEFAULT_HOMEDIR;
281 /* Strip trailing slashes if any. */
282 if (dir[strlen (dir)-1] == '/')
287 p = tmp + strlen (tmp) - 1;
288 while (p > tmp && *p == '/')
294 if (!is_gnupg_default_homedir (dir))
295 non_default_homedir = 1;
302 #ifdef HAVE_W32_SYSTEM
303 /* Check whether gpgconf is installed and if so read the gpgconf.ctl
306 check_portable_app (const char *dir)
310 fname = xstrconcat (dir, DIRSEP_S "gpgconf.exe", NULL);
311 if (!access (fname, F_OK))
313 strcpy (fname + strlen (fname) - 3, "ctl");
314 if (!access (fname, F_OK))
316 /* gpgconf.ctl file found. Record this fact. */
317 w32_portable_app = 1;
320 log_get_prefix (&flags);
321 log_set_prefix (NULL, (flags | GPGRT_LOG_NO_REGISTRY));
323 /* FIXME: We should read the file to detect special flags
324 and print a warning if we don't understand them */
331 /* Determine the root directory of the gnupg installation on Windows. */
336 static char dir[MAX_PATH+5];
342 wchar_t wdir [MAX_PATH+5];
344 rc = GetModuleFileNameW (NULL, wdir, MAX_PATH);
345 if (rc && WideCharToMultiByte (CP_UTF8, 0, wdir, -1, dir, MAX_PATH-4,
350 log_debug ("GetModuleFileName failed: %s\n", w32_strerror (-1));
354 p = strrchr (dir, DIRSEP_C);
359 check_portable_app (dir);
361 /* If we are installed below "bin" we strip that and use
362 the top directory instead. */
363 p = strrchr (dir, DIRSEP_C);
364 if (p && !strcmp (p+1, "bin"))
372 log_debug ("bad filename '%s' returned for this process\n", dir);
379 /* Fallback to the hardwired value. */
380 return GNUPG_LIBEXECDIR;
393 /* Make sure that w32_rootdir has been called so that we are
394 able to check the portable application flag. The common dir
395 is the identical to the rootdir. In that case there is also
396 no need to strdup its value. */
397 rdir = w32_rootdir ();
398 if (w32_portable_app)
401 if (w32_shgetfolderpath (NULL, CSIDL_COMMON_APPDATA,
404 char *tmp = xmalloc (strlen (path) + 4 +1);
405 strcpy (stpcpy (tmp, path), "\\GNU");
407 /* No auto create of the directory. Either the installer or
408 the admin has to create these directories. */
412 /* Ooops: Not defined - probably an old Windows version.
413 Use the installation directory instead. */
414 dir = xstrdup (rdir);
420 #endif /*HAVE_W32_SYSTEM*/
423 /* Change the homedir. Some care must be taken to set this early
424 * enough because previous calls to gnupg_homedir may else return a
425 * different string. */
427 gnupg_set_homedir (const char *newdir)
431 if (!newdir || !*newdir)
432 newdir = default_homedir ();
435 /* Remove trailing slashes from NEWSDIR. */
436 if (newdir[strlen (newdir)-1] == '/'
437 #ifdef HAVE_W32_SYSTEM
438 || newdir[strlen (newdir)-1] == '\\'
444 tmp = xstrdup (newdir);
445 p = tmp + strlen (tmp) - 1;
448 #ifdef HAVE_W32_SYSTEM
457 if (!is_gnupg_default_homedir (newdir))
458 non_default_homedir = 1;
460 xfree (the_gnupg_homedir);
461 the_gnupg_homedir = make_absfilename (newdir, NULL);;
466 /* Return the homedir. The returned string is valid until another
467 * gnupg-set-homedir call. This is always an absolute directory name.
468 * The function replaces the former global var opt.homedir. */
472 /* If a homedir has not been set, set it to the default. */
473 if (!the_gnupg_homedir)
474 the_gnupg_homedir = make_absfilename (default_homedir (), NULL);
475 return the_gnupg_homedir;
479 /* Return whether the home dir is the default one. */
481 gnupg_default_homedir_p (void)
483 return !non_default_homedir;
487 /* Return the directory name used by daemons for their current working
490 gnupg_daemon_rootdir (void)
492 #ifdef HAVE_W32_SYSTEM
500 n = GetSystemDirectoryA (path, sizeof path);
501 if (!n || n >= sizeof path)
502 name = xstrdup ("/"); /* Error - use the curret top dir instead. */
504 name = xstrdup (path);
509 #else /*!HAVE_W32_SYSTEM*/
511 #endif /*!HAVE_W32_SYSTEM*/
515 /* Helper for gnupg-socketdir. This is a global function, so that
516 * gpgconf can use it for its --create-socketdir command. If
517 * SKIP_CHECKS is set permission checks etc. are not done. The
518 * function always returns a malloced directory name and stores these
519 * bit flags at R_INFO:
521 * 1 := Internal error, stat failed, out of core, etc.
522 * 2 := No /run/user directory.
523 * 4 := Directory not owned by the user, not a directory
524 * or wrong permissions.
525 * 8 := Same as 4 but for the subdir.
527 * 32 := Non default homedir; checking subdir.
528 * 64 := Subdir does not exist.
529 * 128 := Using homedir as fallback.
532 _gnupg_socketdir_internal (int skip_checks, unsigned *r_info)
534 #if defined(HAVE_W32_SYSTEM) || !defined(HAVE_STAT)
540 name = xstrdup (gnupg_homedir ());
542 #else /* Unix and stat(2) available. */
544 static const char * const bases[] = { "/run", "/var/run", NULL};
547 char prefix[13 + 1 + 20 + 6 + 1];
553 /* First make sure that non_default_homedir can be set. */
556 /* It has been suggested to first check XDG_RUNTIME_DIR envvar.
557 * However, the specs state that the lifetime of the directory MUST
558 * be bound to the user being logged in. Now GnuPG may also be run
559 * as a background process with no (desktop) user logged in. Thus
560 * we better don't do that. */
562 /* Check whether we have a /run/user dir. */
563 for (i=0; bases[i]; i++)
565 snprintf (prefix, sizeof prefix, "%s/user/%u",
566 bases[i], (unsigned int)getuid ());
567 if (!stat (prefix, &sb) && S_ISDIR(sb.st_mode))
572 *r_info |= 2; /* No /run/user directory. */
576 if (sb.st_uid != getuid ())
578 *r_info |= 4; /* Not owned by the user. */
583 if (strlen (prefix) + 7 >= sizeof prefix)
585 *r_info |= 1; /* Ooops: Buffer too short to append "/gnupg". */
588 strcat (prefix, "/gnupg");
590 /* Check whether the gnupg sub directory has proper permissions. */
591 if (stat (prefix, &sb))
595 *r_info |= 1; /* stat failed. */
599 /* Try to create the directory and check again. */
600 if (gnupg_mkdir (prefix, "-rwx"))
602 *r_info |= 16; /* mkdir failed. */
605 if (stat (prefix, &sb))
607 *r_info |= 1; /* stat failed. */
611 /* Check that it is a directory, owned by the user, and only the
612 * user has permissions to use it. */
613 if (!S_ISDIR(sb.st_mode)
614 || sb.st_uid != getuid ()
615 || (sb.st_mode & (S_IRWXG|S_IRWXO)))
617 *r_info |= 4; /* Bad permissions or not a directory. */
622 /* If a non default homedir is used, we check whether an
623 * corresponding sub directory below the socket dir is available
624 * and use that. We hash the non default homedir to keep the new
625 * subdir short enough. */
626 if (non_default_homedir)
631 *r_info |= 32; /* Testing subdir. */
632 s = gnupg_homedir ();
633 gcry_md_hash_buffer (GCRY_MD_SHA1, sha1buf, s, strlen (s));
634 suffix = zb32_encode (sha1buf, 8*15);
637 *r_info |= 1; /* Out of core etc. */
640 name = strconcat (prefix, "/d.", suffix, NULL);
644 *r_info |= 1; /* Out of core etc. */
648 /* Stat that directory and check constraints.
650 * gpgconf --remove-socketdir
651 * can be used to remove that directory. */
652 if (stat (name, &sb))
655 *r_info |= 1; /* stat failed. */
656 else if (!skip_checks)
658 /* Try to create the directory and check again. */
659 if (gnupg_mkdir (name, "-rwx"))
660 *r_info |= 16; /* mkdir failed. */
661 else if (stat (prefix, &sb))
664 *r_info |= 1; /* stat failed. */
666 *r_info |= 64; /* Subdir does not exist. */
669 goto leave; /* Success! */
672 *r_info |= 64; /* Subdir does not exist. */
680 else if (!S_ISDIR(sb.st_mode)
681 || sb.st_uid != getuid ()
682 || (sb.st_mode & (S_IRWXG|S_IRWXO)))
684 *r_info |= 8; /* Bad permissions or subdir is not a directory. */
694 name = xstrdup (prefix);
697 /* If nothing works fall back to the homedir. */
700 *r_info |= 128; /* Fallback. */
701 name = xstrdup (gnupg_homedir ());
711 * Return the name of the socket dir. That is the directory used for
712 * the IPC local sockets. This is an absolute directory name.
715 gnupg_socketdir (void)
722 name = _gnupg_socketdir_internal (0, &dummy);
729 /* Return the name of the sysconfdir. This is a static string. This
730 function is required because under Windows we can't simply compile
733 gnupg_sysconfdir (void)
735 #ifdef HAVE_W32_SYSTEM
741 s1 = w32_commondir ();
742 s2 = DIRSEP_S "etc" DIRSEP_S "gnupg";
743 name = xmalloc (strlen (s1) + strlen (s2) + 1);
744 strcpy (stpcpy (name, s1), s2);
747 #else /*!HAVE_W32_SYSTEM*/
748 return GNUPG_SYSCONFDIR;
749 #endif /*!HAVE_W32_SYSTEM*/
756 #if defined (HAVE_W32CE_SYSTEM)
760 name = xstrconcat (w32_rootdir (), DIRSEP_S "bin", NULL);
762 #elif defined(HAVE_W32_SYSTEM)
765 rdir = w32_rootdir ();
771 name = xstrconcat (rdir, DIRSEP_S "bin", NULL);
776 #else /*!HAVE_W32_SYSTEM*/
778 #endif /*!HAVE_W32_SYSTEM*/
782 /* Return the name of the libexec directory. The name is allocated in
783 a static area on the first use. This function won't fail. */
785 gnupg_libexecdir (void)
787 #ifdef HAVE_W32_SYSTEM
788 return gnupg_bindir ();
789 #else /*!HAVE_W32_SYSTEM*/
790 return GNUPG_LIBEXECDIR;
791 #endif /*!HAVE_W32_SYSTEM*/
797 #ifdef HAVE_W32_SYSTEM
801 name = xstrconcat (w32_rootdir (), DIRSEP_S "lib" DIRSEP_S "gnupg", NULL);
803 #else /*!HAVE_W32_SYSTEM*/
805 #endif /*!HAVE_W32_SYSTEM*/
811 #ifdef HAVE_W32_SYSTEM
815 name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "gnupg", NULL);
817 #else /*!HAVE_W32_SYSTEM*/
818 return GNUPG_DATADIR;
819 #endif /*!HAVE_W32_SYSTEM*/
824 gnupg_localedir (void)
826 #ifdef HAVE_W32_SYSTEM
830 name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "locale",
833 #else /*!HAVE_W32_SYSTEM*/
835 #endif /*!HAVE_W32_SYSTEM*/
839 /* Return the name of the cache directory. The name is allocated in a
840 static area on the first use. Windows only: If the directory does
841 not exist it is created. */
843 gnupg_cachedir (void)
845 #ifdef HAVE_W32_SYSTEM
846 static const char *dir;
852 rdir = w32_rootdir ();
853 if (w32_portable_app)
855 dir = xstrconcat (rdir,
858 DIRSEP_S, "gnupg", NULL);
863 const char *s1[] = { "GNU", "cache", "gnupg", NULL };
868 for (comp = s1; *comp; comp++)
869 s1_len += 1 + strlen (*comp);
871 if (w32_shgetfolderpath (NULL, CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE,
874 char *tmp = xmalloc (strlen (path) + s1_len + 1);
877 p = stpcpy (tmp, path);
878 for (comp = s1; *comp; comp++)
880 p = stpcpy (p, "\\");
881 p = stpcpy (p, *comp);
883 if (access (tmp, F_OK))
891 dir = "c:\\temp\\cache\\gnupg";
892 #ifdef HAVE_W32CE_SYSTEM
894 w32_try_mkdir ("\\temp\\cache");
895 w32_try_mkdir ("\\temp\\cache\\gnupg");
901 #else /*!HAVE_W32_SYSTEM*/
902 return GNUPG_LOCALSTATEDIR "/cache/" PACKAGE_NAME;
903 #endif /*!HAVE_W32_SYSTEM*/
907 /* Return the user socket name used by DirMngr. */
909 dirmngr_socket_name (void)
914 name = make_filename (gnupg_socketdir (), DIRMNGR_SOCK_NAME, NULL);
919 /* Return the default pinentry name. If RESET is true the internal
920 cache is first flushed. */
922 get_default_pinentry_name (int reset)
925 const char *(*rfnc)(void);
928 /* The first entry is what we return in case we found no
930 { gnupg_bindir, DIRSEP_S "pinentry" EXEEXT_S },
931 #ifdef HAVE_W32_SYSTEM
932 /* Try Gpg4win directory (with bin and without.) */
933 { w32_rootdir, "\\..\\Gpg4win\\bin\\pinentry.exe" },
934 { w32_rootdir, "\\..\\Gpg4win\\pinentry.exe" },
935 /* Try old Gpgwin directory. */
936 { w32_rootdir, "\\..\\GNU\\GnuPG\\pinentry.exe" },
937 /* Try a Pinentry from the common GNU dir. */
938 { w32_rootdir, "\\..\\GNU\\bin\\pinentry.exe" },
940 /* Last chance is a pinentry-basic (which comes with the
941 GnuPG 2.1 Windows installer). */
942 { gnupg_bindir, DIRSEP_S "pinentry-basic" EXEEXT_S }
956 for (i=0; i < DIM(names); i++)
960 name2 = xstrconcat (names[i].rfnc (), names[i].name, NULL);
961 if (!access (name2, F_OK))
963 /* Use that pinentry. */
968 if (!i) /* Store the first as fallback return. */
979 /* If set, 'gnupg_module_name' returns modules from that build
981 static char *gnupg_build_directory;
983 /* For sanity checks. */
984 static int gnupg_module_name_called;
987 /* Set NEWDIR as the new build directory. This will make
988 * 'gnupg_module_name' return modules from that build directory. Must
989 * be called before any invocation of 'gnupg_module_name', and must
990 * not be called twice. It can be used by test suites to make sure
991 * the components from the build directory are used instead of
992 * potentially outdated installed ones. */
994 gnupg_set_builddir (const char *newdir)
996 log_assert (! gnupg_module_name_called);
997 log_assert (! gnupg_build_directory);
998 gnupg_build_directory = xtrystrdup (newdir);
1002 /* If no build directory has been configured, try to set it from the
1003 * environment. We only do this in development builds to avoid
1004 * increasing the set of influential environment variables and hence
1005 * the attack surface of production builds. */
1007 gnupg_set_builddir_from_env (void)
1009 #if defined(IS_DEVELOPMENT_VERSION) || defined(ENABLE_GNUPG_BUILDDIR_ENVVAR)
1010 if (gnupg_build_directory)
1013 gnupg_build_directory = getenv ("GNUPG_BUILDDIR");
1018 /* Return the file name of a helper tool. WHICH is one of the
1019 GNUPG_MODULE_NAME_foo constants. */
1021 gnupg_module_name (int which)
1023 gnupg_set_builddir_from_env ();
1024 gnupg_module_name_called = 1;
1026 #define X(a,b,c) do { \
1027 static char *name; \
1029 name = gnupg_build_directory \
1030 ? xstrconcat (gnupg_build_directory, \
1031 DIRSEP_S b DIRSEP_S c EXEEXT_S, NULL) \
1032 : xstrconcat (gnupg_ ## a (), DIRSEP_S c EXEEXT_S, NULL); \
1038 case GNUPG_MODULE_NAME_AGENT:
1039 #ifdef GNUPG_DEFAULT_AGENT
1040 return GNUPG_DEFAULT_AGENT;
1042 X(bindir, "agent", "gpg-agent");
1045 case GNUPG_MODULE_NAME_PINENTRY:
1046 #ifdef GNUPG_DEFAULT_PINENTRY
1047 return GNUPG_DEFAULT_PINENTRY; /* (Set by a configure option) */
1049 return get_default_pinentry_name (0);
1052 case GNUPG_MODULE_NAME_SCDAEMON:
1053 #ifdef GNUPG_DEFAULT_SCDAEMON
1054 return GNUPG_DEFAULT_SCDAEMON;
1056 X(libexecdir, "scd", "scdaemon");
1059 case GNUPG_MODULE_NAME_DIRMNGR:
1060 #ifdef GNUPG_DEFAULT_DIRMNGR
1061 return GNUPG_DEFAULT_DIRMNGR;
1063 X(bindir, "dirmngr", DIRMNGR_NAME);
1066 case GNUPG_MODULE_NAME_PROTECT_TOOL:
1067 #ifdef GNUPG_DEFAULT_PROTECT_TOOL
1068 return GNUPG_DEFAULT_PROTECT_TOOL;
1070 X(libexecdir, "agent", "gpg-protect-tool");
1073 case GNUPG_MODULE_NAME_DIRMNGR_LDAP:
1074 #ifdef GNUPG_DEFAULT_DIRMNGR_LDAP
1075 return GNUPG_DEFAULT_DIRMNGR_LDAP;
1077 X(libexecdir, "dirmngr", "dirmngr_ldap");
1080 case GNUPG_MODULE_NAME_CHECK_PATTERN:
1081 X(libexecdir, "tools", "gpg-check-pattern");
1083 case GNUPG_MODULE_NAME_GPGSM:
1084 X(bindir, "sm", "gpgsm");
1086 case GNUPG_MODULE_NAME_GPG:
1088 if (! gnupg_build_directory)
1089 X(bindir, "g10", GPG_NAME "2");
1092 X(bindir, "g10", GPG_NAME);
1094 case GNUPG_MODULE_NAME_GPGV:
1096 if (! gnupg_build_directory)
1097 X(bindir, "g10", GPG_NAME "v2");
1100 X(bindir, "g10", GPG_NAME "v");
1102 case GNUPG_MODULE_NAME_CONNECT_AGENT:
1103 X(bindir, "tools", "gpg-connect-agent");
1105 case GNUPG_MODULE_NAME_GPGCONF:
1106 X(bindir, "tools", "gpgconf");
1115 /* Flush some of the cached module names. This is for example used by
1116 gpg-agent to allow configuring a different pinentry. */
1118 gnupg_module_name_flush_some (void)
1120 (void)get_default_pinentry_name (1);