summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2011-08-06 16:52:06 +0200
committerRobert Ancell <robert.ancell@canonical.com>2011-08-06 16:52:06 +0200
commit4541a69771f63e2dde785c4d12444044d2d0cba7 (patch)
tree476670f31890036b9313547b0abf6136306afaa6 /src
parente49a781430bd8eda9fa42f39a7fd058a8f9f37c7 (diff)
parent6a273a0d26e145f82f416c475ee4122bef767ed9 (diff)
downloadlightdm-4541a69771f63e2dde785c4d12444044d2d0cba7.tar.gz
Add a gdmflexiserver binary that provides backwards compatibility with existing sessions
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/display.c13
-rwxr-xr-xsrc/gdmflexiserver22
-rw-r--r--src/process.c7
-rw-r--r--src/process.h2
5 files changed, 47 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9687c4c4..8fc14fd3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,7 @@
sbin_PROGRAMS = lightdm
+dist_pkglibexec_SCRIPTS = gdmflexiserver
+
ldm-marshal.c: ldm-marshal.list
@GLIB_GENMARSHAL@ --prefix=ldm_marshal $(srcdir)/ldm-marshal.list --header --body > ldm-marshal.c
@@ -69,6 +71,7 @@ BUILT_SOURCES = \
lightdm_CFLAGS = \
$(LIGHTDM_CFLAGS) \
$(WARN_CFLAGS) \
+ -DPKGLIBEXEC_DIR=\"$(pkglibexecdir)\" \
-DCONFIG_DIR=\"$(sysconfdir)/lightdm\" \
-DLOG_DIR=\"$(localstatedir)/log/lightdm\" \
-DRUN_DIR=\"$(localstatedir)/run/lightdm\" \
diff --git a/src/display.c b/src/display.c
index e34b36a3..6eff5fe9 100644
--- a/src/display.c
+++ b/src/display.c
@@ -585,6 +585,7 @@ create_session (Display *display, PAMSession *pam_session, const gchar *session_
{
User *user;
gchar *sessions_dir, *filename, *path, *command = NULL;
+ const gchar *orig_path;
GKeyFile *session_desktop_file;
Session *session;
gchar *cookie;
@@ -652,6 +653,18 @@ create_session (Display *display, PAMSession *pam_session, const gchar *session_
set_env_from_pam_session (session, pam_session);
+ /* Insert our own utility directory to PATH
+ * This is to provide gdmflexiserver which provides backwards compatibility with GDM.
+ * This can be removed when this is no longer required.
+ */
+ orig_path = process_get_env (PROCESS (session), "PATH");
+ if (orig_path)
+ {
+ path = g_strdup_printf ("%s:%s", PKGLIBEXEC_DIR, orig_path);
+ process_set_env (PROCESS (session), "PATH", path);
+ g_free (path);
+ }
+
process_set_log_file (PROCESS (session), log_filename);
/* Open ConsoleKit session */
diff --git a/src/gdmflexiserver b/src/gdmflexiserver
new file mode 100755
index 00000000..3168e177
--- /dev/null
+++ b/src/gdmflexiserver
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 Canonical Ltd
+# Author: Michael Terry <michael.terry@canonical.com>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, version 3 of the License.
+#
+# See http://www.gnu.org/copyleft/gpl.html for the full text of the license.
+
+SEAT=$(dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DisplayManager /org/freedesktop/DisplayManager org.freedesktop.DisplayManager.GetSeatForCookie string:"$XDG_SESSION_COOKIE" 2>/dev/null)
+
+# Pull out seat path
+SEAT=$(echo $SEAT | sed 's/.* object path "\(.*\)"/\1/')
+
+if [ -z "$SEAT" ]; then
+ # something went wrong
+ exit 1
+fi
+
+dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.DisplayManager $SEAT org.freedesktop.DisplayManager.Seat.SwitchToGreeter
diff --git a/src/process.c b/src/process.c
index 286f7323..e51acab9 100644
--- a/src/process.c
+++ b/src/process.c
@@ -97,6 +97,13 @@ process_set_env (Process *process, const gchar *name, const gchar *value)
g_hash_table_insert (process->priv->env, g_strdup (name), g_strdup (value));
}
+const gchar *
+process_get_env (Process *process, const gchar *name)
+{
+ g_return_val_if_fail (process != NULL, FALSE);
+ return g_hash_table_lookup (process->priv->env, name);
+}
+
static void
process_watch_cb (GPid pid, gint status, gpointer data)
{
diff --git a/src/process.h b/src/process.h
index 4e739d60..60c95264 100644
--- a/src/process.h
+++ b/src/process.h
@@ -53,6 +53,8 @@ const gchar *process_get_log_file (Process *process);
void process_set_env (Process *process, const gchar *name, const gchar *value);
+const gchar *process_get_env (Process *process, const gchar *name);
+
gboolean process_start (Process *process,
User *user,
const gchar *working_dir,