summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2022-09-14 11:58:35 +0200
committerWerner Koch <wk@gnupg.org>2022-09-14 12:05:21 +0200
commit50d12860ef21e8480474fd94a0b4465d0339086d (patch)
treeee546cc1b1b5eac3875a590f6c4df4bea4db38d8 /common
parentcommon: Fix for GPG_ERR_SOURCE_DEFAULT check. (diff)
downloadgnupg2-50d12860ef21e8480474fd94a0b4465d0339086d.tar.xz
gnupg2-50d12860ef21e8480474fd94a0b4465d0339086d.zip
tests: Restrict the use of gpgconf.ctl to make check.
* common/homedir.c (unix_rootdir): Add ".enable" statement to gpgconf.ctl * tests/gpgconf.ctl.in: Use this statement. * tests/cms/Makefile.am (OLD_TESTS_ENVIRONMENT): Enable .enable. (TESTS_ENVIRONMENT): Ditto. * tests/gpgme/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/migrations/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/pkits/Makefile.am (TESTS_ENVIRONMENT): Ditto. * tests/tpm2dtests/Makefile.am (TESTS_ENVIRONMENT): Ditto. -- Without that it was required to delete the gpgconf.ctl to run manual tests. What a hack.
Diffstat (limited to 'common')
-rw-r--r--common/homedir.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/common/homedir.c b/common/homedir.c
index dd4963c32..67bbde8f1 100644
--- a/common/homedir.c
+++ b/common/homedir.c
@@ -473,6 +473,7 @@ unix_rootdir (int want_sysconfdir)
char *rootdir;
char *sysconfdir;
const char *name;
+ int ignoreall = 0;
for (;;)
{
@@ -590,6 +591,16 @@ unix_rootdir (int want_sysconfdir)
name = "sysconfdir";
p = line + 12;
}
+ else if (!strncmp (line, ".enable=", 8))
+ {
+ name = ".enable";
+ p = line + 8;
+ }
+ else if (!strncmp (line, ".enable =", 9))
+ {
+ name = ".enable";
+ p = line + 9;
+ }
else
continue;
trim_spaces (p);
@@ -600,6 +611,17 @@ unix_rootdir (int want_sysconfdir)
log_info ("error getting %s from gpgconf.ctl: %s\n",
name, gpg_strerror (err));
}
+ else if (!strcmp (name, ".enable"))
+ {
+ if (atoi (p)
+ || !ascii_strcasecmp (p, "yes")
+ || !ascii_strcasecmp (p, "true")
+ || !ascii_strcasecmp (p, "fact"))
+ ; /* Yes, this file shall be used. */
+ else
+ ignoreall = 1; /* No, this file shall be ignored. */
+ xfree (p);
+ }
else if (!strcmp (name, "sysconfdir"))
{
xfree (sysconfdir);
@@ -627,7 +649,13 @@ unix_rootdir (int want_sysconfdir)
xfree (buffer);
xfree (line);
- if (!rootdir || !*rootdir || *rootdir != '/')
+ if (ignoreall)
+ {
+ xfree (rootdir);
+ xfree (sysconfdir);
+ sdir = dir = NULL;
+ }
+ else if (!rootdir || !*rootdir || *rootdir != '/')
{
log_info ("invalid rootdir '%s' specified in gpgconf.ctl\n", rootdir);
xfree (rootdir);