]> granicus.if.org Git - p11-kit/commitdiff
conf: Ignore user configuration if the program is running as root
authorDaiki Ueno <dueno@redhat.com>
Fri, 17 May 2019 11:49:34 +0000 (13:49 +0200)
committerDaiki Ueno <ueno@gnu.org>
Sat, 18 May 2019 04:50:47 +0000 (06:50 +0200)
Suggested by Bastien Nocera:
https://bugzilla.redhat.com/show_bug.cgi?id=1688583

p11-kit/conf.c

index 3ec1c3621debedd588495267313e6c57d07c3001..861231e8c182b1f49b1114352111adbbed1b78b3 100644 (file)
@@ -232,8 +232,10 @@ _p11_conf_load_globals (const char *system_conf, const char *user_conf,
                if (getauxval (AT_SECURE)) {
                        p11_debug ("skipping user config in setuid or setgid program");
                        mode = CONF_USER_NONE;
+               } else if (getuid () == 0) {
+                       p11_debug ("skipping user config in program running as root");
+                       mode = CONF_USER_NONE;
                } else if (secure_getenv ("P11_KIT_NO_USER_CONFIG")) {
-                       /* This one should be used in RPM %post and equivalent */
                        p11_debug ("skipping user config due to P11_NO_USER_CONFIG");
                        mode = CONF_USER_NONE;
                }