Commit 71381de7 authored by Brian Cameron's avatar Brian Cameron

Reapply a better fix for bug #594818 that addresses the problem with the

previous commit.
parent 19658706
......@@ -44,7 +44,7 @@ GLIB_REQUIRED_VERSION=2.22.0
GTK_REQUIRED_VERSION=2.20.0
PANGO_REQUIRED_VERSION=1.3.0
SCROLLKEEPER_REQUIRED_VERSION=0.1.4
GCONF_REQUIRED_VERSION=2.6.1
GCONF_REQUIRED_VERSION=2.31.1
GNOME_PANEL_REQUIRED_VERSION=2.0.0
LIBXKLAVIER_REQUIRED_VERSION=4.0
LIBCANBERRA_GTK_REQUIRED_VERSION=0.4
......@@ -103,6 +103,9 @@ PKG_CHECK_MODULES(GCONF,
AC_SUBST(GCONF_CFLAGS)
AC_SUBST(GCONF_LIBS)
gconf_defaultpath=`pkg-config gconf-2.0 --variable=gconf_defaultpath`
AC_DEFINE_UNQUOTED([GCONF_DEFAULTPATH], "$gconf_defaultpath", [GConf Default Path])
PKG_CHECK_MODULES(DEVKIT_POWER,
devkit-power-gobject >= $DEVKIT_POWER_REQUIRED_VERSION,
have_devicekit_power=yes,
......
......@@ -481,6 +481,7 @@ run_greeter (GdmFactorySlave *slave)
gboolean display_is_local;
char *display_id;
char *display_name;
char *seat_id;
char *display_device;
char *display_hostname;
char *auth_file;
......@@ -491,6 +492,7 @@ run_greeter (GdmFactorySlave *slave)
display_is_local = FALSE;
display_id = NULL;
display_name = NULL;
seat_id = NULL;
auth_file = NULL;
display_device = NULL;
display_hostname = NULL;
......@@ -499,6 +501,7 @@ run_greeter (GdmFactorySlave *slave)
"display-is-local", &display_is_local,
"display-id", &display_id,
"display-name", &display_name,
"display-seat-id", &seat_id,
"display-hostname", &display_hostname,
"display-x11-authority-file", &auth_file,
NULL);
......@@ -555,6 +558,7 @@ run_greeter (GdmFactorySlave *slave)
g_debug ("GdmFactorySlave: Creating greeter on %s %s", display_name, display_device);
slave->priv->greeter = gdm_greeter_session_new (display_name,
seat_id,
display_device,
display_hostname,
display_is_local);
......@@ -584,6 +588,7 @@ run_greeter (GdmFactorySlave *slave)
g_free (display_id);
g_free (display_name);
g_free (seat_id);
g_free (display_device);
g_free (display_hostname);
g_free (auth_file);
......
......@@ -140,6 +140,7 @@ gdm_greeter_session_finalize (GObject *object)
GdmGreeterSession *
gdm_greeter_session_new (const char *display_name,
const char *seat_id,
const char *display_device,
const char *display_hostname,
gboolean display_is_local)
......@@ -153,6 +154,7 @@ gdm_greeter_session_new (const char *display_name,
"server-env-var-name", "GDM_GREETER_DBUS_ADDRESS",
"register-ck-session", TRUE,
"x11-display-name", display_name,
"x11-display-seat-id", seat_id,
"x11-display-device", display_device,
"x11-display-hostname", display_hostname,
"x11-display-is-local", display_is_local,
......
......@@ -50,6 +50,7 @@ typedef struct
GType gdm_greeter_session_get_type (void);
GdmGreeterSession * gdm_greeter_session_new (const char *display_name,
const char *seat_id,
const char *display_device,
const char *display_hostname,
gboolean display_is_local);
......
......@@ -907,6 +907,7 @@ start_greeter (GdmSimpleSlave *slave)
gboolean display_is_local;
char *display_id;
char *display_name;
char *seat_id;
char *display_device;
char *display_hostname;
char *auth_file;
......@@ -918,6 +919,7 @@ start_greeter (GdmSimpleSlave *slave)
display_is_local = FALSE;
display_id = NULL;
display_name = NULL;
seat_id = NULL;
auth_file = NULL;
display_device = NULL;
display_hostname = NULL;
......@@ -926,6 +928,7 @@ start_greeter (GdmSimpleSlave *slave)
"display-id", &display_id,
"display-is-local", &display_is_local,
"display-name", &display_name,
"display-seat-id", &seat_id,
"display-hostname", &display_hostname,
"display-x11-authority-file", &auth_file,
NULL);
......@@ -1007,6 +1010,7 @@ start_greeter (GdmSimpleSlave *slave)
g_debug ("GdmSimpleSlave: Creating greeter on %s %s %s", display_name, display_device, display_hostname);
slave->priv->greeter = gdm_greeter_session_new (display_name,
seat_id,
display_device,
display_hostname,
display_is_local);
......@@ -1034,6 +1038,7 @@ start_greeter (GdmSimpleSlave *slave)
g_free (display_id);
g_free (display_name);
g_free (seat_id);
g_free (display_device);
g_free (display_hostname);
g_free (auth_file);
......
......@@ -66,6 +66,7 @@ struct GdmWelcomeSessionPrivate
char *runtime_dir;
char *x11_display_name;
char *x11_display_seat_id;
char *x11_display_device;
char *x11_display_hostname;
char *x11_authority_file;
......@@ -86,6 +87,7 @@ struct GdmWelcomeSessionPrivate
enum {
PROP_0,
PROP_X11_DISPLAY_NAME,
PROP_X11_DISPLAY_SEAT_ID,
PROP_X11_DISPLAY_DEVICE,
PROP_X11_DISPLAY_HOSTNAME,
PROP_X11_AUTHORITY_FILE,
......@@ -341,7 +343,7 @@ next_line:
}
static GPtrArray *
get_welcome_environment (GdmWelcomeSession *welcome_session)
get_welcome_environment (GdmWelcomeSession *welcome_session, gboolean start_session)
{
GPtrArray *env;
GHashTable *hash;
......@@ -420,6 +422,15 @@ get_welcome_environment (GdmWelcomeSession *welcome_session)
g_hash_table_insert (hash, g_strdup ("SHELL"), g_strdup (pwent->pw_shell));
}
if (start_session && welcome_session->priv->x11_display_seat_id != NULL) {
char *seat_id;
seat_id = welcome_session->priv->x11_display_seat_id +
strlen ("/org/freedesktop/ConsoleKit/");
g_hash_table_insert (hash, g_strdup ("GCONF_DEFAULT_SOURCE_PATH"), g_strdup (GCONF_DEFAULTPATH));
g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id));
}
g_hash_table_insert (hash, g_strdup ("PATH"), g_strdup (g_getenv ("PATH")));
g_hash_table_insert (hash, g_strdup ("WINDOWPATH"), g_strdup (g_getenv ("WINDOWPATH")));
......@@ -515,6 +526,7 @@ typedef struct {
const char *group_name;
const char *runtime_dir;
const char *log_file;
const char *seat_id;
} SpawnChildData;
static void
......@@ -541,6 +553,26 @@ spawn_child_setup (SpawnChildData *data)
_exit (1);
}
if (pwent->pw_dir != NULL) {
struct stat statbuf;
const char *seat_id;
char *gconf_dir;
int r;
seat_id = data->seat_id + strlen ("/org/freedesktop/ConsoleKit/");
gconf_dir = g_strdup_printf ("%s/%s", pwent->pw_dir, seat_id);
/* Verify per-seat gconf directory exists, create if needed */
r = g_stat (gconf_dir, &statbuf);
if (r < 0) {
g_debug ("Making per-seat gconf directory %s", gconf_dir);
g_mkdir (gconf_dir, S_IRWXU | S_IXGRP | S_IRGRP);
g_chmod (gconf_dir, S_IRWXU | S_IXGRP | S_IRGRP);
chown (gconf_dir, pwent->pw_uid, grent->gr_gid);
}
g_free (gconf_dir);
}
g_debug ("GdmWelcomeSession: Setting up run time dir %s", data->runtime_dir);
g_mkdir (data->runtime_dir, 0755);
chown (data->runtime_dir, pwent->pw_uid, pwent->pw_gid);
......@@ -606,6 +638,7 @@ static gboolean
spawn_command_line_sync_as_user (const char *command_line,
const char *user_name,
const char *group_name,
const char *seat_id,
const char *runtime_dir,
const char *log_file,
char **env,
......@@ -634,6 +667,7 @@ spawn_command_line_sync_as_user (const char *command_line,
data.group_name = group_name;
data.runtime_dir = runtime_dir;
data.log_file = log_file;
data.seat_id = seat_id;
local_error = NULL;
res = g_spawn_sync (NULL,
......@@ -664,6 +698,7 @@ static gboolean
spawn_command_line_async_as_user (const char *command_line,
const char *user_name,
const char *group_name,
const char *seat_id,
const char *runtime_dir,
const char *log_file,
char **env,
......@@ -690,6 +725,7 @@ spawn_command_line_async_as_user (const char *command_line,
data.group_name = group_name;
data.runtime_dir = runtime_dir;
data.log_file = log_file;
data.seat_id = seat_id;
local_error = NULL;
res = g_spawn_async (NULL,
......@@ -802,12 +838,13 @@ start_dbus_daemon (GdmWelcomeSession *welcome_session)
g_debug ("GdmWelcomeSession: Starting D-Bus daemon");
env = get_welcome_environment (welcome_session);
env = get_welcome_environment (welcome_session, FALSE);
error = NULL;
res = spawn_command_line_sync_as_user (DBUS_LAUNCH_COMMAND,
welcome_session->priv->user_name,
welcome_session->priv->group_name,
welcome_session->priv->x11_display_seat_id,
welcome_session->priv->runtime_dir,
NULL, /* log file */
(char **)env->pdata,
......@@ -860,7 +897,7 @@ gdm_welcome_session_spawn (GdmWelcomeSession *welcome_session)
/* FIXME: */
}
env = get_welcome_environment (welcome_session);
env = get_welcome_environment (welcome_session, TRUE);
error = NULL;
......@@ -871,6 +908,7 @@ gdm_welcome_session_spawn (GdmWelcomeSession *welcome_session)
ret = spawn_command_line_async_as_user (welcome_session->priv->command,
welcome_session->priv->user_name,
welcome_session->priv->group_name,
welcome_session->priv->x11_display_seat_id,
welcome_session->priv->runtime_dir,
log_path,
(char **)env->pdata,
......@@ -995,6 +1033,14 @@ _gdm_welcome_session_set_x11_display_name (GdmWelcomeSession *welcome_session,
welcome_session->priv->x11_display_name = g_strdup (name);
}
static void
_gdm_welcome_session_set_x11_display_seat_id (GdmWelcomeSession *welcome_session,
const char *sid)
{
g_free (welcome_session->priv->x11_display_seat_id);
welcome_session->priv->x11_display_seat_id = g_strdup (sid);
}
static void
_gdm_welcome_session_set_x11_display_hostname (GdmWelcomeSession *welcome_session,
const char *name)
......@@ -1104,6 +1150,9 @@ gdm_welcome_session_set_property (GObject *object,
case PROP_X11_DISPLAY_NAME:
_gdm_welcome_session_set_x11_display_name (self, g_value_get_string (value));
break;
case PROP_X11_DISPLAY_SEAT_ID:
_gdm_welcome_session_set_x11_display_seat_id (self, g_value_get_string (value));
break;
case PROP_X11_DISPLAY_HOSTNAME:
_gdm_welcome_session_set_x11_display_hostname (self, g_value_get_string (value));
break;
......@@ -1163,6 +1212,9 @@ gdm_welcome_session_get_property (GObject *object,
case PROP_X11_DISPLAY_NAME:
g_value_set_string (value, self->priv->x11_display_name);
break;
case PROP_X11_DISPLAY_SEAT_ID:
g_value_set_string (value, self->priv->x11_display_seat_id);
break;
case PROP_X11_DISPLAY_HOSTNAME:
g_value_set_string (value, self->priv->x11_display_hostname);
break;
......@@ -1241,6 +1293,13 @@ gdm_welcome_session_class_init (GdmWelcomeSessionClass *klass)
"name",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_X11_DISPLAY_SEAT_ID,
g_param_spec_string ("x11-display-seat-id",
"seat id",
"seat id",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_X11_DISPLAY_HOSTNAME,
g_param_spec_string ("x11-display-hostname",
......@@ -1406,6 +1465,7 @@ gdm_welcome_session_finalize (GObject *object)
g_free (welcome_session->priv->group_name);
g_free (welcome_session->priv->runtime_dir);
g_free (welcome_session->priv->x11_display_name);
g_free (welcome_session->priv->x11_display_seat_id);
g_free (welcome_session->priv->x11_display_device);
g_free (welcome_session->priv->x11_display_hostname);
g_free (welcome_session->priv->x11_authority_file);
......
......@@ -6,3 +6,7 @@ xml:readonly:/etc/gconf/gconf.xml.system
# owned by GDM. Sysadmins should create
# another source if they wish to override them.
xml:readonly:$(HOME)/.gconf.mandatory
# Set per-seat configuration directory
xml:readwrite:$(HOME)/$(ENV_GDM_SEAT_ID)/.gconf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment