diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2013-11-07 15:05:32 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2013-11-07 15:05:32 +1300 |
commit | d1c16e03f68ae8043ddc66c546dad2fbcd9f22b8 (patch) | |
tree | 297ca7995d276efa00010919da8562272616b72b | |
parent | 1d4e7de28a60290ce2d1a659091211b52cc4157e (diff) | |
download | lightdm-git-d1c16e03f68ae8043ddc66c546dad2fbcd9f22b8.tar.gz |
Don't pass system user accounts from AccountsService to greeters.
-rw-r--r-- | liblightdm-gobject/user.c | 11 | ||||
-rw-r--r-- | tests/scripts/users.conf | 4 | ||||
-rw-r--r-- | tests/src/test-runner.c | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/liblightdm-gobject/user.c b/liblightdm-gobject/user.c index d8bd2e08..3983f18d 100644 --- a/liblightdm-gobject/user.c +++ b/liblightdm-gobject/user.c @@ -385,6 +385,7 @@ update_user (UserAccountObject *object) GVariant *result, *value; GVariantIter *iter; gchar *name; + gboolean system_account = FALSE; GError *error = NULL; result = g_dbus_connection_call_sync (g_dbus_proxy_get_connection (object->proxy), @@ -427,6 +428,10 @@ update_user (UserAccountObject *object) g_variant_get (value, "&s", &home_directory); g_free (priv->home_directory); priv->home_directory = g_strdup (home_directory); + } + else if (strcmp (name, "SystemAccount") == 0 && g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN)) + { + system_account = g_variant_get_boolean (value); } else if (strcmp (name, "IconFile") == 0 && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) { @@ -453,7 +458,7 @@ update_user (UserAccountObject *object) g_variant_unref (result); - return TRUE; + return !system_account; } static void @@ -464,8 +469,8 @@ user_signal_cb (GDBusProxy *proxy, gchar *sender_name, gchar *signal_name, GVari if (g_variant_is_of_type (parameters, G_VARIANT_TYPE ("()"))) { g_debug ("User %s changed", g_dbus_proxy_get_object_path (object->proxy)); - update_user (object); - g_signal_emit (object->user, user_signals[CHANGED], 0); + if (update_user (object)) + g_signal_emit (object->user, user_signals[CHANGED], 0); } else g_warning ("Got org.freedesktop.Accounts.User signal Changed with unknown parameters %s", g_variant_get_type_string (parameters)); diff --git a/tests/scripts/users.conf b/tests/scripts/users.conf index ea9c90db..94ac53b2 100644 --- a/tests/scripts/users.conf +++ b/tests/scripts/users.conf @@ -45,6 +45,10 @@ log-user-changes=true #?GREETER-X-0 LOG-USER USERNAME=have-password2 #?GREETER-X-0 LOG-USER USERNAME=have-password3 +# Add a system user (ignored) +#?*ADD-USER USERNAME=lightdm +#?RUNNER ADD-USER USERNAME=lightdm + # Remove a user #?*DELETE-USER USERNAME=have-password3 #?RUNNER DELETE-USER USERNAME=have-password3 diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index 14b1c186..4ae09922 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -1577,7 +1577,7 @@ handle_accounts_call (GDBusConnection *connection, for (link = accounts_users; link; link = link->next) { AccountsUser *user = link->data; - if (!user->hidden) + if (!user->hidden && user->uid >= 1000) g_variant_builder_add_value (&builder, g_variant_new_object_path (user->path)); } @@ -1645,6 +1645,8 @@ handle_user_get_property (GDBusConnection *connection, return g_variant_new_string (user->real_name); else if (strcmp (property_name, "HomeDirectory") == 0) return g_variant_new_string (user->home_directory); + else if (strcmp (property_name, "SystemAccount") == 0) + return g_variant_new_boolean (user->uid < 1000); else if (strcmp (property_name, "BackgroundFile") == 0) return g_variant_new_string (""); else if (strcmp (property_name, "Language") == 0) @@ -1700,6 +1702,7 @@ accounts_name_acquired_cb (GDBusConnection *connection, " <property name='UserName' type='s' access='read'/>" " <property name='RealName' type='s' access='read'/>" " <property name='HomeDirectory' type='s' access='read'/>" + " <property name='SystemAccount' type='b' access='read'/>" " <property name='BackgroundFile' type='s' access='read'/>" " <property name='Language' type='s' access='read'/>" " <property name='XSession' type='s' access='read'/>" |