]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Refactor shared data tests so they don't require root.
authorRobert Ancell <robert.ancell@canonical.com>
Tue, 25 Feb 2014 04:29:48 +0000 (17:29 +1300)
committerRobert Ancell <robert.ancell@canonical.com>
Tue, 25 Feb 2014 04:29:48 +0000 (17:29 +1300)
We now specifically test the use cases of writing data between greeters and sessions.
The new tests do not check the directory is removed when a user is removed (it's done in the background so we can't reliably be sure when it will complete).
The new tests do not check the ownership of the directories.

17 files changed:
tests/Makefile.am
tests/scripts/shared-data-dirs-autologin.conf [deleted file]
tests/scripts/shared-data-dirs.conf [deleted file]
tests/scripts/shared-data-greeter-to-session.conf [new file with mode: 0644]
tests/scripts/shared-data-invalid-user.conf [new file with mode: 0644]
tests/scripts/shared-data-session-to-greeter-autologin.conf [new file with mode: 0644]
tests/scripts/shared-data-session-to-greeter.conf [new file with mode: 0644]
tests/src/libsystem.c
tests/src/test-gobject-greeter.c
tests/src/test-runner.c
tests/src/test-session.c
tests/test-shared-data-dirs [deleted file]
tests/test-shared-data-dirs-autologin [deleted file]
tests/test-shared-data-greeter-to-session [new file with mode: 0755]
tests/test-shared-data-invalid-user [new file with mode: 0755]
tests/test-shared-data-session-to-greeter [new file with mode: 0755]
tests/test-shared-data-session-to-greeter-autologin [new file with mode: 0755]

index 734fc66e7a2b4aeed4dae9631b75c31f93a4ac36..caf765a75a935c223399a0b816bfdbdefc08c535 100644 (file)
@@ -110,8 +110,10 @@ TESTS = \
        test-script-hook-fail-display-setup \
        test-script-hook-fail-greeter-setup \
        test-script-hook-fail-session-setup \
-       test-shared-data-dirs \
-       test-shared-data-dirs-autologin \
+       test-shared-data-greeter-to-session \
+       test-shared-data-session-to-greeter \
+       test-shared-data-session-to-greeter-autologin \
+       test-shared-data-invalid-user \
        test-upstart-autologin \
        test-upstart-login \
        test-dbus \
@@ -408,8 +410,10 @@ EXTRA_DIST = \
        scripts/plymouth-inactive-vt.conf \
        scripts/plymouth-no-seat.conf \
        scripts/restart-authentication.conf \
-       scripts/shared-data-dirs.conf \
-       scripts/shared-data-dirs-autologin.conf \
+       scripts/shared-data-greeter-to-session.conf \
+       scripts/shared-data-invalid-user.conf \
+       scripts/shared-data-session-to-greeter.conf \
+       scripts/shared-data-session-to-greeter-autologin.conf \
        scripts/script-hooks.conf \
        scripts/script-hook-fail-display-setup.conf \
        scripts/script-hook-fail-greeter-setup.conf \
diff --git a/tests/scripts/shared-data-dirs-autologin.conf b/tests/scripts/shared-data-dirs-autologin.conf
deleted file mode 100644 (file)
index 1783a54..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Make sure we manage shared user data directories when autologin is used
-#
-
-[SeatDefaults]
-autologin-user=have-password1
-
-#?RUNNER DAEMON-START
-
-# X server starts
-#?XSERVER-0 START VT=7 SEAT=seat0
-
-# Daemon connects when X server is ready
-#?*XSERVER-0 INDICATE-READY
-#?XSERVER-0 INDICATE-READY
-#?XSERVER-0 ACCEPT-CONNECT
-
-# Session starts
-#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 DESKTOP_SESSION=default USER=have-password1
-#?XSERVER-0 ACCEPT-CONNECT
-#?SESSION-X-0 CONNECT-XSERVER
-
-# Make sure we created the directory as we started session
-#?*LIST-SHARED-DATA-DIRS
-#?RUNNER LIST-SHARED-DATA-DIRS DIRS=have-password1:1000:100:0770
-
-# Cleanup
-#?*STOP-DAEMON
-#?XSERVER-0 TERMINATE SIGNAL=15
-#?SESSION-X-0 TERMINATE SIGNAL=15
-#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/shared-data-dirs.conf b/tests/scripts/shared-data-dirs.conf
deleted file mode 100644 (file)
index 530fa26..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Make sure we manage shared user data directories on startup and over time
-#
-
-[test-runner-config]
-# One normal, one with bad permissions, one to delete
-shared-data-dirs=have-password1:1000:100:0770 have-password2:1000:1000:0777 xxx:1004:100:0770
-
-#?RUNNER DAEMON-START
-
-# X server starts
-#?XSERVER-0 START VT=7 SEAT=seat0
-
-# Startup creation/deletion
-#?*WAIT
-#?*LIST-SHARED-DATA-DIRS
-#?RUNNER LIST-SHARED-DATA-DIRS DIRS=have-password1:1000:100:0770,have-password2:1000:1000:0777
-
-# Daemon connects when X server is ready
-#?*XSERVER-0 INDICATE-READY
-#?XSERVER-0 INDICATE-READY
-#?XSERVER-0 ACCEPT-CONNECT
-
-# Greeter starts
-#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
-#?XSERVER-0 ACCEPT-CONNECT
-#?GREETER-X-0 CONNECT-XSERVER
-#?GREETER-X-0 CONNECT-TO-DAEMON
-#?GREETER-X-0 CONNECTED-TO-DAEMON
-
-# Make sure we can create/chown a directory from the greeter
-#?*GREETER-X-0 ENSURE-SHARED-DATA-DIR USERNAME=have-password2
-#?GREETER-X-0 ENSURE-SHARED-DATA-DIR RESULT=TRUE
-#?*LIST-SHARED-DATA-DIRS
-#?RUNNER LIST-SHARED-DATA-DIRS DIRS=have-password1:1000:100:0770,have-password2:1001:100:0770,lightdm:100:100:0770
-
-# Log into account without a password
-#?*GREETER-X-0 AUTHENTICATE USERNAME=no-password1
-#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
-#?*GREETER-X-0 START-SESSION
-#?GREETER-X-0 TERMINATE SIGNAL=15
-
-# Session starts
-#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/no-password1 DESKTOP_SESSION=default USER=no-password1
-#?XSERVER-0 ACCEPT-CONNECT
-#?SESSION-X-0 CONNECT-XSERVER
-
-# Make sure we created the directory as we started session
-#?*LIST-SHARED-DATA-DIRS
-#?RUNNER LIST-SHARED-DATA-DIRS DIRS=have-password1:1000:100:0770,have-password2:1001:100:0770,lightdm:100:100:0770,no-password1:1005:100:0770
-
-# Delete one user
-#?*DELETE-USER USERNAME=have-password1
-#?RUNNER DELETE-USER USERNAME=have-password1
-#?*WAIT
-#?*LIST-SHARED-DATA-DIRS
-#?RUNNER LIST-SHARED-DATA-DIRS DIRS=have-password2:1001:100:0770,lightdm:100:100:0770,no-password1:1005:100:0770
-
-# Cleanup
-#?*STOP-DAEMON
-#?XSERVER-0 TERMINATE SIGNAL=15
-#?SESSION-X-0 TERMINATE SIGNAL=15
-#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/shared-data-greeter-to-session.conf b/tests/scripts/shared-data-greeter-to-session.conf
new file mode 100644 (file)
index 0000000..9bdb8c1
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Make sure we can make a shared data directory to write from the greeter to the session
+#
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Check greeter can write to data directory
+#?*GREETER-X-0 WRITE-SHARED-DATA USERNAME=no-password1 DATA=HELLO
+#?GREETER-X-0 WRITE-SHARED-DATA RESULT=TRUE
+
+# Log into account without a password
+#?*GREETER-X-0 AUTHENTICATE USERNAME=no-password1
+#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
+#?*GREETER-X-0 START-SESSION
+#?GREETER-X-0 TERMINATE SIGNAL=15
+
+# Session starts
+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/no-password1 DESKTOP_SESSION=default USER=no-password1
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Check session can read from shared data directory
+#?*SESSION-X-0 READ-SHARED-DATA
+#?SESSION-X-0 READ-SHARED-DATA DATA=HELLO
+
+# Cleanup
+#?*STOP-DAEMON
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/shared-data-invalid-user.conf b/tests/scripts/shared-data-invalid-user.conf
new file mode 100644 (file)
index 0000000..7a787bc
--- /dev/null
@@ -0,0 +1,30 @@
+#
+# Make sure we handle requesting an invalid user to share data with
+#
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Try and write data to an invalid user
+#?*GREETER-X-0 WRITE-SHARED-DATA USERNAME=invalid DATA=HELLO
+#?GREETER-X-0 WRITE-SHARED-DATA ERROR=NO_SHARED_DIR
+
+# Cleanup
+#?*STOP-DAEMON
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?GREETER-X-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/shared-data-session-to-greeter-autologin.conf b/tests/scripts/shared-data-session-to-greeter-autologin.conf
new file mode 100644 (file)
index 0000000..3bff22b
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Make sure a shared data directory is created on autologin and can be written back to the greeter
+#
+
+[SeatDefaults]
+autologin-user=have-password1
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Session starts
+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 DESKTOP_SESSION=default USER=have-password1
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Check session can write to data directory
+#?*SESSION-X-0 WRITE-SHARED-DATA DATA=HELLO
+#?SESSION-X-0 WRITE-SHARED-DATA RESULT=TRUE
+
+# Logout session
+#?*SESSION-X-0 LOGOUT
+
+# X server stops
+#?XSERVER-0 TERMINATE SIGNAL=15
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Check greeter can read from user
+#?*GREETER-X-0 READ-SHARED-DATA USERNAME=have-password1 DATA=HELLO
+#?GREETER-X-0 READ-SHARED-DATA DATA=HELLO
+
+# Cleanup
+#?*STOP-DAEMON
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?GREETER-X-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/shared-data-session-to-greeter.conf b/tests/scripts/shared-data-session-to-greeter.conf
new file mode 100644 (file)
index 0000000..dd00ee9
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Make sure a shared data directory is created on login and can be written back to the greeter
+#
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Log into account without a password
+#?*GREETER-X-0 AUTHENTICATE USERNAME=no-password1
+#?GREETER-X-0 AUTHENTICATION-COMPLETE USERNAME=no-password1 AUTHENTICATED=TRUE
+#?*GREETER-X-0 START-SESSION
+#?GREETER-X-0 TERMINATE SIGNAL=15
+
+# Session starts
+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/no-password1 DESKTOP_SESSION=default USER=no-password1
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Check session can write to data directory
+#?*SESSION-X-0 WRITE-SHARED-DATA DATA=HELLO
+#?SESSION-X-0 WRITE-SHARED-DATA RESULT=TRUE
+
+# Logout session
+#?*SESSION-X-0 LOGOUT
+
+# X server stops
+#?XSERVER-0 TERMINATE SIGNAL=15
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Check greeter can read from user
+#?*GREETER-X-0 READ-SHARED-DATA USERNAME=no-password1 DATA=HELLO
+#?GREETER-X-0 READ-SHARED-DATA DATA=HELLO
+
+# Cleanup
+#?*STOP-DAEMON
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?GREETER-X-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
index b4db0c35310bba952b2c1b0c8a2e6402c1a165e0..2fdd19c1d0b3600d46a908003a4c4a629b93d2ca 100644 (file)
@@ -454,17 +454,8 @@ mkdir (const char *pathname, mode_t mode)
 int
 chown (const char *pathname, uid_t owner, gid_t group)
 {
-    int (*_chown) (const char *pathname, uid_t owner, gid_t group);
-    gchar *new_path = NULL;
-    int result;
-
-    _chown = (int (*)(const char *pathname, uid_t owner, gid_t group)) dlsym (RTLD_NEXT, "chown");
-
-    new_path = redirect_path (pathname);
-    result = _chown (new_path, owner, group);
-    g_free (new_path);
-
-    return result;
+    /* Just fake it - we're not root */
+    return 0;
 }
 
 int
index 972f2ba9dabe137021a4b9cad4b0f2baa6ea0153..7918f49059a45d6118e1bb237165b763ec107ff4 100644 (file)
@@ -203,8 +203,58 @@ request_cb (const gchar *request)
     if (strcmp (name, "LOG-USER-LIST-LENGTH") == 0)
         status_notify ("%s LOG-USER-LIST-LENGTH N=%d", greeter_id, lightdm_user_list_get_length (lightdm_user_list_get_instance ()));
 
-    if (strcmp (name, "ENSURE-SHARED-DATA-DIR") == 0)
-        status_notify ("%s ENSURE-SHARED-DATA-DIR RESULT=%s", greeter_id, lightdm_greeter_ensure_shared_data_dir_sync (greeter, g_hash_table_lookup (params, "USERNAME")) ? "TRUE" : "FALSE");
+    if (strcmp (name, "WRITE-SHARED-DATA") == 0)
+    {
+        gchar *dir;
+
+        dir = lightdm_greeter_ensure_shared_data_dir_sync (greeter, g_hash_table_lookup (params, "USERNAME"));
+        if (dir)
+        {
+            gchar *path;
+            FILE *f;
+
+            g_printerr ("dir='%s'\n", dir);
+
+            path = g_build_filename (dir, "data", NULL);
+            if (!(f = fopen (path, "w")) || fprintf (f, "%s", (const gchar *) g_hash_table_lookup (params, "DATA")) < 0)
+                status_notify ("%s WRITE-SHARED-DATA ERROR=%s", greeter_id, strerror (errno));
+            else
+                status_notify ("%s WRITE-SHARED-DATA RESULT=TRUE", greeter_id);
+
+            if (f)
+                fclose (f);
+            g_free (path);
+            g_free (dir);
+        }
+        else
+            status_notify ("%s WRITE-SHARED-DATA ERROR=NO_SHARED_DIR", greeter_id);
+    }
+
+    if (strcmp (name, "READ-SHARED-DATA") == 0)
+    {
+        gchar *dir;
+
+        dir = lightdm_greeter_ensure_shared_data_dir_sync (greeter, g_hash_table_lookup (params, "USERNAME"));
+        if (dir)
+        {
+            gchar *path;
+            gchar *contents = NULL;
+            GError *error = NULL;
+
+            g_printerr ("dir='%s'\n", dir);
+
+            path = g_build_filename (dir, "data", NULL);
+            if (g_file_get_contents (path, &contents, NULL, &error))
+                status_notify ("%s READ-SHARED-DATA DATA=%s", greeter_id, contents);
+            else
+                status_notify ("%s READ-SHARED-DATA ERROR=%s", greeter_id, error->message);
+            g_free (path);
+            g_free (contents);
+            g_clear_error (&error);
+        }
+        else
+            status_notify ("%s READ-SHARED-DATA ERROR=NO_SHARED_DIR", greeter_id);
+    }
 
     if (strcmp (name, "WATCH-USER") == 0)
     {
index 57af25b4210266fa0592a7480250bc4ab9ef36d8..d8b948b92d0c2a306474688f2e339b8e056d2805 100644 (file)
@@ -411,45 +411,6 @@ handle_command (const gchar *command)
         g_main_loop_run (loop);
         g_main_loop_unref (loop);
     }
-    else if (strcmp (name, "LIST-SHARED-DATA-DIRS") == 0)
-    {
-        gchar *shared_dir;
-        GDir *dir;
-        const gchar *path;
-        GList *paths = NULL, *link;
-        GString *status;
-
-        shared_dir = g_strdup_printf ("%s/var/lib/lightdm-data", temp_dir);
-        dir = g_dir_open (shared_dir, 0, NULL);
-        while ((path = g_dir_read_name (dir)))
-        {
-            gchar *full_path = g_build_filename (shared_dir, path, NULL);
-            paths = g_list_insert_sorted (paths, full_path, (GCompareFunc)g_strcmp0);
-        }
-        g_dir_close (dir);
-        g_free (shared_dir);
-
-        status = g_string_new ("RUNNER LIST-SHARED-DATA-DIRS DIRS=");
-        for (link = paths; link; link = link->next)
-        {
-            path = (const gchar *)link->data;
-            GStatBuf buf;
-            if (g_stat (path, &buf) != 0)
-                continue;
-
-            if (link != paths)
-                g_string_append (status, ",");
-            gchar *basename = g_path_get_basename (path);
-            g_string_append_printf (status, "%s:%u:%u:0%o", basename,
-                                    buf.st_uid, buf.st_gid,
-                                    buf.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO));
-            g_free (basename);
-        }
-        g_list_free_full (paths, g_free);
-
-        check_status (status->str);
-        g_string_free (status, TRUE);
-    }
     else if (strcmp (name, "LIST-SEATS") == 0)
     {
         GVariant *result, *value;
index efebbb61d109a057718d336de8fe009d6699c33c..d7f23a918b9efca3175c7edbc49e0bc1ecc7a8d1 100644 (file)
@@ -153,13 +153,14 @@ request_cb (const gchar *request)
     if (g_str_has_prefix (request, r))
     {
         const gchar *name = request + strlen (r);
-        gchar *contents;
+        gchar *contents = NULL;
         GError *error = NULL;
 
         if (g_file_get_contents (name, &contents, NULL, &error))
             status_notify ("%s READ FILE=%s TEXT=%s", session_id, name, contents);
         else
             status_notify ("%s READ FILE=%s ERROR=%s", session_id, name, error->message);
+        g_free (contents);
         g_clear_error (&error);
     }
     g_free (r);
@@ -197,6 +198,59 @@ request_cb (const gchar *request)
         g_string_free (mode_string, TRUE);
     }
     g_free (r);
+
+    r = g_strdup_printf ("%s WRITE-SHARED-DATA DATA=", session_id);
+    if (g_str_has_prefix (request, r))
+    {
+        const gchar *data = request + strlen (r);
+        gchar *dir;
+      
+        dir = getenv ("XDG_GREETER_DATA_DIR");
+        if (dir)
+        {
+            gchar *path;
+            FILE *f;
+
+            path = g_build_filename (dir, "data", NULL);
+            if (!(f = fopen (path, "w")) || fprintf (f, "%s", data) < 0)
+                status_notify ("%s WRITE-SHARED-DATA ERROR=%s", session_id, strerror (errno));
+            else
+                status_notify ("%s WRITE-SHARED-DATA RESULT=TRUE", session_id);
+
+            if (f)
+                fclose (f);
+            g_free (path);
+        }
+        else
+            status_notify ("%s WRITE-SHARED-DATA ERROR=NO_XDG_GREETER_DATA_DIR", session_id);
+    }
+    g_free (r);
+
+    r = g_strdup_printf ("%s READ-SHARED-DATA", session_id);
+    if (strcmp (request, r) == 0)
+    {
+        gchar *dir;
+
+        dir = getenv ("XDG_GREETER_DATA_DIR");
+        if (dir)
+        {
+            gchar *path;
+            gchar *contents = NULL;
+            GError *error = NULL;
+
+            path = g_build_filename (dir, "data", NULL);
+            if (g_file_get_contents (path, &contents, NULL, &error))
+                status_notify ("%s READ-SHARED-DATA DATA=%s", session_id, contents);
+            else
+                status_notify ("%s WRITE-SHARED-DATA ERROR=%s", session_id, error->message);
+            g_free (path);
+            g_free (contents);
+            g_clear_error (&error);
+        }
+        else
+            status_notify ("%s WRITE-SHARED-DATA ERROR=NO_XDG_GREETER_DATA_DIR", session_id);
+    }
+    g_free (r);
 }
 
 int
diff --git a/tests/test-shared-data-dirs b/tests/test-shared-data-dirs
deleted file mode 100755 (executable)
index e4c475e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-./src/dbus-env ./src/test-runner shared-data-dirs test-gobject-greeter
diff --git a/tests/test-shared-data-dirs-autologin b/tests/test-shared-data-dirs-autologin
deleted file mode 100755 (executable)
index 710661f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-./src/dbus-env ./src/test-runner shared-data-dirs-autologin test-gobject-greeter
diff --git a/tests/test-shared-data-greeter-to-session b/tests/test-shared-data-greeter-to-session
new file mode 100755 (executable)
index 0000000..ae80823
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner shared-data-greeter-to-session test-gobject-greeter
diff --git a/tests/test-shared-data-invalid-user b/tests/test-shared-data-invalid-user
new file mode 100755 (executable)
index 0000000..4118ab7
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner shared-data-invalid-user test-gobject-greeter
diff --git a/tests/test-shared-data-session-to-greeter b/tests/test-shared-data-session-to-greeter
new file mode 100755 (executable)
index 0000000..3effe57
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner shared-data-session-to-greeter test-gobject-greeter
diff --git a/tests/test-shared-data-session-to-greeter-autologin b/tests/test-shared-data-session-to-greeter-autologin
new file mode 100755 (executable)
index 0000000..94072b4
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner shared-data-session-to-greeter-autologin test-gobject-greeter