aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-11-13 16:06:24 +0000
committerTarmac <Unknown>2012-11-13 16:06:24 +0000
commita7b8ed9c8c18e48c51d08ca1b0ef0ab3de485461 (patch)
tree8b0514e92eb3d0d76ab395a55931828269e028a5
parent5191f0e8e414d9542b77eaed253a28c7919b1b8b (diff)
parent8709a6ca1c048401486a632f5a6b343a9c59b313 (diff)
downloadayatana-indicator-session-a7b8ed9c8c18e48c51d08ca1b0ef0ab3de485461.tar.gz
ayatana-indicator-session-a7b8ed9c8c18e48c51d08ca1b0ef0ab3de485461.tar.bz2
ayatana-indicator-session-a7b8ed9c8c18e48c51d08ca1b0ef0ab3de485461.zip
In users-service-dbus.c, check to make sure that create_display_proxy() succeeded before using the proxy pointer that gets returned. Fixes: https://bugs.launchpad.net/bugs/1078119.
Approved by Lars Uebernickel, PS Jenkins bot.
-rw-r--r--src/users-service-dbus.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c
index fec17dc..f12f47c 100644
--- a/src/users-service-dbus.c
+++ b/src/users-service-dbus.c
@@ -927,11 +927,16 @@ users_service_dbus_get_user_list (UsersServiceDbus * self)
void
users_service_dbus_show_greeter (UsersServiceDbus * self)
{
+ DisplayManagerSeat * dp;
+
g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
- g_clear_object (&dp);
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ display_manager_seat_call_switch_to_greeter_sync (dp, NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -942,11 +947,16 @@ users_service_dbus_show_greeter (UsersServiceDbus * self)
void
users_service_dbus_activate_guest_session (UsersServiceDbus * self)
{
- g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
+ DisplayManagerSeat * dp;
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
- g_clear_object (&dp);
+ g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
+
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ display_manager_seat_call_switch_to_guest_sync (dp, "", NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -958,12 +968,17 @@ void
users_service_dbus_activate_user_session (UsersServiceDbus * self,
AccountsUser * user)
{
+ DisplayManagerSeat * dp;
+
g_return_if_fail (IS_USERS_SERVICE_DBUS(self));
- const char * const username = accounts_user_get_user_name (user);
- DisplayManagerSeat * dp = create_display_proxy (self);
- display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
- g_clear_object (&dp);
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ const char * const username = accounts_user_get_user_name (user);
+ display_manager_seat_call_switch_to_user_sync (dp, username, "", NULL, NULL);
+ g_clear_object (&dp);
+ }
}
/**
@@ -974,11 +989,18 @@ users_service_dbus_activate_user_session (UsersServiceDbus * self,
gboolean
users_service_dbus_guest_session_enabled (UsersServiceDbus * self)
{
- g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE);
+ DisplayManagerSeat * dp;
+ gboolean enabled = FALSE;
+
+ g_return_val_if_fail (IS_USERS_SERVICE_DBUS(self), enabled);
+
+ dp = create_display_proxy (self);
+ if (dp != NULL)
+ {
+ enabled = display_manager_seat_get_has_guest_account (dp);
+ g_clear_object (&dp);
+ }
- DisplayManagerSeat * dp = create_display_proxy (self);
- const gboolean enabled = display_manager_seat_get_has_guest_account (dp);
- g_clear_object (&dp);
return enabled;
}