[gdm] worker: set KRB5CCNAME automatically if it's not already



commit 5dd7b48ed3a6f21a8ce22d834dd4daa02d2c5796
Author: Ray Strode <rstrode redhat com>
Date:   Mon Aug 20 17:48:15 2012 -0400

    worker: set KRB5CCNAME automatically if it's not already
    
    Kerberos has some lame defaults that won't change for at
    least 6 months.  For now, override the defaults.
    
    This is necessary for the gnome-online-accounts kerberos
    provider to work optimally.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679253

 daemon/gdm-session-worker.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 6eccbe0..674fa5d 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -1771,6 +1771,7 @@ gdm_session_worker_start_session (GdmSessionWorker  *worker,
 
         if (session_pid == 0) {
                 char **environment;
+                char  *kerberos_cache;
                 char  *home_dir;
                 int    fd;
 
@@ -1785,6 +1786,29 @@ gdm_session_worker_start_session (GdmSessionWorker  *worker,
                         _exit (2);
                 }
 
+
+                kerberos_cache = gdm_session_worker_get_environment_variable (worker, "KRB5CCNAME");
+
+                if (kerberos_cache == NULL) {
+                        char  *kerberos_dir;
+
+                        /* FIXME: this is just until 1.11 when krb5-libs does this by default
+                         */
+                        kerberos_dir = g_strdup_printf ("/run/user/%d/krb5cc_%s",
+                                                        (int) getuid(),
+                                                        g_dbus_connection_get_guid (worker->priv->connection));
+
+                        if (g_mkdir_with_parents (kerberos_dir, S_IRWXU) == 0) {
+                                kerberos_cache = g_strdup_printf ("DIR:%s", kerberos_dir);
+                                gdm_session_worker_set_environment_variable (worker,
+                                                                             "KRB5CCNAME",
+                                                                             kerberos_cache);
+                                g_free (kerberos_cache);
+                                kerberos_cache = NULL;
+                        }
+                        g_free (kerberos_dir);
+                }
+
                 environment = gdm_session_worker_get_environment (worker);
 
                 g_assert (geteuid () == getuid ());



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]