a89bdde
A hack: if we're looking at creating a ccache directory directly below
a89bdde
the /run/user/0 directory, and /run/user/0 doesn't exist, try to create
a89bdde
it, too.
a89bdde
a89bdde
--- krb5/src/lib/krb5/ccache/cc_dir.c
a89bdde
+++ krb5/src/lib/krb5/ccache/cc_dir.c
a89bdde
@@ -61,6 +61,8 @@
a89bdde
 
a89bdde
 #include <dirent.h>
a89bdde
 
a89bdde
+#define ROOT_SPECIAL_DCC_PARENT "/run/user/0"
a89bdde
+
a89bdde
 extern const krb5_cc_ops krb5_dcc_ops;
a89bdde
 extern const krb5_cc_ops krb5_fcc_ops;
a89bdde
 
a89bdde
@@ -239,6 +241,18 @@
a89bdde
 
a89bdde
     if (stat(dirname, &st) < 0) {
a89bdde
         if (errno == ENOENT) {
a89bdde
+            if (strncmp(dirname, ROOT_SPECIAL_DCC_PARENT "/",
a89bdde
+                        sizeof(ROOT_SPECIAL_DCC_PARENT)) == 0 &&
a89bdde
+                stat(ROOT_SPECIAL_DCC_PARENT, &st) < 0 &&
a89bdde
+                errno == ENOENT) {
a89bdde
+#ifdef USE_SELINUX
a89bdde
+                selabel = krb5int_push_fscreatecon_for(ROOT_SPECIAL_DCC_PARENT);
a89bdde
+#endif
a89bdde
+                status = mkdir(ROOT_SPECIAL_DCC_PARENT, S_IRWXU);
a89bdde
+#ifdef USE_SELINUX
a89bdde
+                krb5int_pop_fscreatecon(selabel);
a89bdde
+#endif
a89bdde
+            }
a89bdde
 #ifdef USE_SELINUX
a89bdde
             selabel = krb5int_push_fscreatecon_for(dirname);
a89bdde
 #endif