Blame SOURCES/krb5-1.11-run_user_0.patch

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