components/gnome/gdm/patches/0009-xauth-directory.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Mon, 31 Oct 2016 18:25:15 -0700
changeset 7201 bcc18175756d
permissions -rw-r--r--
23245293 Move gdm to Userland and update to 3.18.2 PSARC/2016/448 GNOME Display Manager (GDM) v3.18 23245463 Move desktop-startup 0.38.0 to Userland 16882229 Desktop packages should remove restart_fmri=svc:/system/rbac:default 21020801 Add "RO" to res1 field of auth_attr.d files in gdm 21020166 html help files in gdm for RBAC profiles and authorizations must go 22134482 svc:/application/graphical-login/gdm goes into maintenance when gdm coredumps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7201
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     1
From 2ee31816ec447ad8aca5ed20e1793f248204d0ed Mon Sep 17 00:00:00 2001
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     2
From: Alan Coopersmith <[email protected]>
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     3
Date: Tue, 29 Dec 2015 17:22:36 -0800
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     4
Subject: [PATCH 09/19] xauth-directory
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     5
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     6
Bug 15620655/SUNBT6923733 gdm create user writable directories under /var/run
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     7
Original date:2010-02-19 owner:yippi type:feature bugster:6923733
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     8
---
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     9
 daemon/gdm-display-access-file.c | 128 ++++++++++++++++++++++++++++++++++-----
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    10
 daemon/gdm-display-access-file.h |   1 +
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    11
 daemon/main.c                    |   3 +
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    12
 data/Makefile.am                 |  12 ++--
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    13
 4 files changed, 124 insertions(+), 20 deletions(-)
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    14
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    15
diff --git a/daemon/gdm-display-access-file.c b/daemon/gdm-display-access-file.c
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    16
index 02ec0a0..90e4eed 100644
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    17
--- a/daemon/gdm-display-access-file.c
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    18
+++ b/daemon/gdm-display-access-file.c
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    19
@@ -41,6 +41,8 @@
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    20
 #include "gdm-display-access-file.h"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    21
 #include "gdm-common.h"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    22
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    23
+static const char *xauth_dir_name = NULL;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    24
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    25
 struct _GdmDisplayAccessFilePrivate
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    26
 {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    27
         char *username;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    28
@@ -221,13 +223,24 @@ _get_uid_and_gid_for_user (const char *username,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    29
         return TRUE;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    30
 }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    31
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    32
+void
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    33
+gdm_display_access_file_cleanup_xauth (void)
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    34
+{
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    35
+        /* Clean up any xauth_dir_name when shutting down */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    36
+        if (strcmp (GDM_XAUTH_DIR, "/tmp") == 0 && xauth_dir_name != NULL) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    37
+                g_remove (xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    38
+                g_debug ("GdmDisplayAccessFile: Unlinking xauth directory %s", xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    39
+                xauth_dir_name = NULL;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    40
+        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    41
+}
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    42
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    43
 static void
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    44
-clean_up_stale_auth_subdirs (void)
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    45
+clean_up_stale_auth_subdirs (const char * xauth_dir_name)
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    46
 {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    47
         GDir *dir;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    48
         const char *filename;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    49
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    50
-        dir = g_dir_open (GDM_XAUTH_DIR, 0, NULL);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    51
+        dir = g_dir_open (xauth_dir_name, 0, NULL);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    52
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    53
         if (dir == NULL) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    54
                 return;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    55
@@ -236,7 +249,7 @@ clean_up_stale_auth_subdirs (void)
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    56
         while ((filename = g_dir_read_name (dir)) != NULL) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    57
                 char *path;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    58
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    59
-                path = g_build_filename (GDM_XAUTH_DIR, filename, NULL);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    60
+                path = g_build_filename (xauth_dir_name, filename, NULL);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    61
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    62
                 /* Will only succeed if the directory is empty
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    63
                  */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    64
@@ -251,10 +264,13 @@ _create_xauth_file_for_user (const char  *username,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    65
                              char       **filename,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    66
                              GError     **error)
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    67
 {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    68
+        struct stat statbuf;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    69
+        gboolean dir_exists;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    70
         char   *template;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    71
         const char *dir_name;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    72
         char   *auth_filename;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    73
         int     fd;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    74
+        int     xauth_dir_fp = -1;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    75
         FILE   *fp;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    76
         uid_t   uid;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    77
         gid_t   gid;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    78
@@ -268,10 +284,37 @@ _create_xauth_file_for_user (const char  *username,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    79
         fp = NULL;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    80
         fd = -1;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    81
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    82
+        dir_exists = TRUE;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    83
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    84
+        if (xauth_dir_name == NULL) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    85
+                if (strcmp (GDM_XAUTH_DIR, "/tmp") == 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    86
+                        dir_exists = FALSE;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    87
+                        template = g_strdup_printf ("/tmp/gdm-auth-cookies-XXXXXX");
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    88
+                        xauth_dir_name = gdm_make_temp_dir (template);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    89
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    90
+                        g_debug ("GdmDisplayAccessFile: Creating xauth directory %s", xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    91
+                        g_chmod (xauth_dir_name, 0711);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    92
+                        _get_uid_and_gid_for_user (GDM_USERNAME, &uid, &gid);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    93
+                        if (chown (xauth_dir_name, 0, gid) != 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    94
+                                g_warning ("Unable to change owner of '%s'",
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    95
+                                           xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    96
+                        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    97
+                } else {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    98
+                        xauth_dir_name = GDM_XAUTH_DIR;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    99
+                }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   100
+        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   101
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   102
+        /*
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   103
+         * Note: if GDM_XAUTH_DIR is "/tmp", we never fall into the next if-case, since
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   104
+         * gdm_make_temp_dir calls mkdtemp() which creates the directory.
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   105
+         */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   106
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   107
         /* Create directory if not exist, then set permission 0711 and ownership root:gdm */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   108
-        if (g_file_test (GDM_XAUTH_DIR, G_FILE_TEST_IS_DIR) == FALSE) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   109
-                g_remove (GDM_XAUTH_DIR);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   110
-                if (g_mkdir (GDM_XAUTH_DIR, 0711) != 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   111
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   112
+        if (g_file_test (xauth_dir_name, G_FILE_TEST_IS_DIR) == FALSE) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   113
+                dir_exists = FALSE;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   114
+                g_remove (xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   115
+                if (g_mkdir (xauth_dir_name, 0711) != 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   116
                         g_set_error (error,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   117
                                      G_FILE_ERROR,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   118
                                      g_file_error_from_errno (errno),
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   119
@@ -279,18 +322,70 @@ _create_xauth_file_for_user (const char  *username,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   120
                         goto out;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   121
                 }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   122
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   123
-                g_chmod (GDM_XAUTH_DIR, 0711);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   124
+                g_chmod (xauth_dir_name, 0711);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   125
                 _get_uid_and_gid_for_user (GDM_USERNAME, &uid, &gid);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   126
-                if (chown (GDM_XAUTH_DIR, 0, gid) != 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   127
+                if (chown (xauth_dir_name, 0, gid) != 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   128
                         g_warning ("Unable to change owner of '%s'",
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   129
-                                   GDM_XAUTH_DIR);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   130
+                                   xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   131
+                }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   132
+        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   133
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   134
+        /* Do sanity testing on the Xauth directory */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   135
+        if ((xauth_dir_fp = open (xauth_dir_name, O_RDONLY | O_NOFOLLOW)) == -1) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   136
+                /* If it is a symlink, open fails with O_NOFOLLOW. */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   137
+                g_set_error (error,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   138
+                     GDM_DISPLAY_ACCESS_FILE_ERROR,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   139
+                     GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   140
+                     _("GDM authorization directory %s cannot be opened."),
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   141
+                     xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   142
+                goto out;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   143
+        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   144
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   145
+        if (fstat (xauth_dir_fp, &statbuf) == 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   146
+                if (! S_ISDIR (statbuf.st_mode)) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   147
+                        g_set_error (error,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   148
+                             GDM_DISPLAY_ACCESS_FILE_ERROR,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   149
+                             GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   150
+                             _("GDM authorization directory %s is not a directory."),
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   151
+                             xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   152
+                        goto out;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   153
+                }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   154
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   155
+                if (statbuf.st_uid != 0) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   156
+                        g_set_error (error,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   157
+                             GDM_DISPLAY_ACCESS_FILE_ERROR,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   158
+                             GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   159
+                             _("GDM authorization directory %s: uid is not root"),
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   160
+                             xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   161
+                        goto out;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   162
+                }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   163
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   164
+                _get_uid_and_gid_for_user (GDM_USERNAME, &uid, &gid);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   165
+                if (statbuf.st_gid != gid) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   166
+                        g_set_error (error,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   167
+                             GDM_DISPLAY_ACCESS_FILE_ERROR,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   168
+                             GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   169
+                             _("GDM authorization directory %s: gid is not the GDM user"),
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   170
+                             xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   171
+                        goto out;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   172
                 }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   173
         } else {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   174
-                /* if it does exist make sure it has correct mode 0711 */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   175
-                g_chmod (GDM_XAUTH_DIR, 0711);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   176
+                g_set_error (error,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   177
+                     GDM_DISPLAY_ACCESS_FILE_ERROR,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   178
+                     GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   179
+                     _("Cannot fstat() the GDM authorization directory %s"),
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   180
+                     xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   181
+                goto out;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   182
+        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   183
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   184
+        if (dir_exists == TRUE) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   185
+                /* If we did not create the directory, do some cleanup */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   186
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   187
+                /* Make sure it has correct mode 0711 */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   188
+                g_chmod (xauth_dir_name, 0711);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   189
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   190
                 /* and clean up any stale auth subdirs */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   191
-                clean_up_stale_auth_subdirs ();
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   192
+                clean_up_stale_auth_subdirs (xauth_dir_name);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   193
         }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   194
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   195
         if (!_get_uid_and_gid_for_user (username, &uid, &gid)) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   196
@@ -303,9 +398,8 @@ _create_xauth_file_for_user (const char  *username,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   197
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   198
         }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   199
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   200
-        template = g_strdup_printf (GDM_XAUTH_DIR
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   201
-                                    "/auth-for-%s-XXXXXX",
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   202
-                                    username);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   203
+        template = g_strdup_printf ("%s/auth-for-%s-XXXXXX",
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   204
+                                    xauth_dir_name, username);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   205
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   206
         g_debug ("GdmDisplayAccessFile: creating xauth directory %s", template);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   207
         /* Initially create with mode 01700 then later chmod after we create database */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   208
@@ -394,7 +488,9 @@ out:
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   209
         if (fd != -1) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   210
                 close (fd);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   211
         }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   212
-
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   213
+        if (xauth_dir_fp != -1) {
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   214
+		close (xauth_dir_fp);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   215
+        }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   216
         return fp;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   217
 }
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   218
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   219
diff --git a/daemon/gdm-display-access-file.h b/daemon/gdm-display-access-file.h
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   220
index cc7de9e..091b31f 100644
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   221
--- a/daemon/gdm-display-access-file.h
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   222
+++ b/daemon/gdm-display-access-file.h
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   223
@@ -83,6 +83,7 @@ gboolean              gdm_display_access_file_remove_display          (GdmDispla
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   224
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   225
 void                  gdm_display_access_file_close                   (GdmDisplayAccessFile  *file);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   226
 char                 *gdm_display_access_file_get_path                (GdmDisplayAccessFile  *file);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   227
+void                  gdm_display_access_file_cleanup_xauth           (void);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   228
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   229
 G_END_DECLS
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   230
 #endif /* __GDM_DISPLAY_ACCESS_FILE_H__ */
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   231
diff --git a/daemon/main.c b/daemon/main.c
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   232
index 50f6e94..65f34c8 100644
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   233
--- a/daemon/main.c
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   234
+++ b/daemon/main.c
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   235
@@ -47,6 +47,7 @@
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   236
 #include "gdm-settings.h"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   237
 #include "gdm-settings-direct.h"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   238
 #include "gdm-settings-keys.h"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   239
+#include "gdm-display-access-file.h"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   240
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   241
 #define GDM_DBUS_NAME "org.gnome.DisplayManager"
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   242
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   243
@@ -426,6 +427,8 @@ main (int    argc,
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   244
         gdm_settings_direct_shutdown ();
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   245
         gdm_log_shutdown ();
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   246
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   247
+        gdm_display_access_file_cleanup_xauth ();
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   248
+
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   249
         g_main_loop_unref (main_loop);
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   250
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   251
         ret = 0;
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   252
diff --git a/data/Makefile.am b/data/Makefile.am
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   253
index 81cde22..a05fc14 100644
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   254
--- a/data/Makefile.am
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   255
+++ b/data/Makefile.am
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   256
@@ -212,8 +212,10 @@ uninstall-hook:
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   257
 	$(DESTDIR)$(sysconfdir)/dconf/profile/gdm \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   258
 	-rf \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   259
 	$(DESTDIR)$(screenshotdir) \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   260
-	$(DESTDIR)$(xauthdir) \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   261
 	$(DESTDIR)$(PAM_PREFIX)/pam.d
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   262
+	if test "x$(xauthdir)" -ne "x/tmp"; then \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   263
+		rm -rf $(DESTDIR)$(xauthdir) \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   264
+	fi
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   265
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   266
 	if test -n "$(systemdsystemunit)"; then \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   267
 		rm -f $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/$(systemdsystemunit); \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   268
@@ -292,9 +294,11 @@ endif
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   269
 	fi
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   270
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   271
 	if test '!' -d $(DESTDIR)$(xauthdir); then \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   272
-		$(mkinstalldirs) $(DESTDIR)$(xauthdir); \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   273
-		chmod 0711 $(DESTDIR)$(xauthdir); \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   274
-		chown root:gdm $(DESTDIR)$(xauthdir) || : ; \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   275
+		if test "x$(xauthdir)" -ne "x/tmp"; then \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   276
+			$(mkinstalldirs) $(DESTDIR)$(xauthdir); \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   277
+			chmod 0711 $(DESTDIR)$(xauthdir); \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   278
+			chown root:gdm $(DESTDIR)$(xauthdir) || : ; \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   279
+		fi \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   280
 	fi
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   281
 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   282
 	if test -n "$(systemdsystemunit)" -a '!' -d $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR); then \
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   283
-- 
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   284
2.7.4
bcc18175756d 23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
   285