Blame SOURCES/krb5-1.11-run_user_0.patch

db6389
From f19ee759c49fac6477ef77eb4a0be41118add1f5 Mon Sep 17 00:00:00 2001
db6389
From: Robbie Harwood <rharwood@redhat.com>
db6389
Date: Tue, 23 Aug 2016 16:49:57 -0400
db6389
Subject: [PATCH] krb5-1.11-run_user_0.patch
db6389
db6389
A hack: if we're looking at creating a ccache directory directly below
db6389
the /run/user/0 directory, and /run/user/0 doesn't exist, try to create
db6389
it, too.
db6389
---
db6389
 src/lib/krb5/ccache/cc_dir.c | 14 ++++++++++++++
db6389
 1 file changed, 14 insertions(+)
db6389
db6389
diff --git a/src/lib/krb5/ccache/cc_dir.c b/src/lib/krb5/ccache/cc_dir.c
db6389
index 73f0fe62d..4850c0d07 100644
db6389
--- a/src/lib/krb5/ccache/cc_dir.c
db6389
+++ b/src/lib/krb5/ccache/cc_dir.c
db6389
@@ -61,6 +61,8 @@
db6389
 
db6389
 #include <dirent.h>
db6389
 
db6389
+#define ROOT_SPECIAL_DCC_PARENT "/run/user/0"
db6389
+
db6389
 extern const krb5_cc_ops krb5_dcc_ops;
db6389
 extern const krb5_cc_ops krb5_fcc_ops;
db6389
 
db6389
@@ -237,6 +239,18 @@ verify_dir(krb5_context context, const char *dirname)
db6389
 
db6389
     if (stat(dirname, &st) < 0) {
db6389
         if (errno == ENOENT) {
db6389
+            if (strncmp(dirname, ROOT_SPECIAL_DCC_PARENT "/",
db6389
+                        sizeof(ROOT_SPECIAL_DCC_PARENT)) == 0 &&
db6389
+                stat(ROOT_SPECIAL_DCC_PARENT, &st) < 0 &&
db6389
+                errno == ENOENT) {
db6389
+#ifdef USE_SELINUX
db6389
+                selabel = krb5int_push_fscreatecon_for(ROOT_SPECIAL_DCC_PARENT);
db6389
+#endif
db6389
+                status = mkdir(ROOT_SPECIAL_DCC_PARENT, S_IRWXU);
db6389
+#ifdef USE_SELINUX
db6389
+                krb5int_pop_fscreatecon(selabel);
db6389
+#endif
db6389
+            }
db6389
 #ifdef USE_SELINUX
db6389
             selabel = krb5int_push_fscreatecon_for(dirname);
db6389
 #endif