Merge lp:~robert-ancell/lightdm/system-user into lp:lightdm

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 1836
Merged at revision: 1836
Proposed branch: lp:~robert-ancell/lightdm/system-user
Merge into: lp:lightdm
Diff against target: 117 lines (+25/-10)
3 files modified
liblightdm-gobject/user.c (+17/-9)
tests/scripts/users.conf (+4/-0)
tests/src/test-runner.c (+4/-1)
To merge this branch: bzr merge lp:~robert-ancell/lightdm/system-user
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Robert Ancell Approve
Review via email: mp+194258@code.launchpad.net

Commit message

Don't pass system user accounts from AccountsService to greeters

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'liblightdm-gobject/user.c'
2--- liblightdm-gobject/user.c 2013-10-29 23:38:29 +0000
3+++ liblightdm-gobject/user.c 2013-11-06 23:41:35 +0000
4@@ -436,8 +436,8 @@
5 LightDMUserPrivate *priv = GET_USER_PRIVATE (user);
6
7 g_debug ("User %s changed", priv->path);
8- load_accounts_user (user);
9- g_signal_emit (user, user_signals[CHANGED], 0);
10+ if (load_accounts_user (user))
11+ g_signal_emit (user, user_signals[CHANGED], 0);
12 }
13
14 static gboolean
15@@ -447,6 +447,7 @@
16 GVariant *result, *value;
17 GVariantIter *iter;
18 gchar *name;
19+ gboolean system_account = FALSE;
20 GError *error = NULL;
21
22 /* Get the properties for this user */
23@@ -497,6 +498,8 @@
24 g_free (priv->home_directory);
25 priv->home_directory = g_variant_dup_string (value, NULL);
26 }
27+ else if (strcmp (name, "SystemAccount") == 0 && g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN))
28+ system_account = g_variant_get_boolean (value);
29 else if (strcmp (name, "Language") == 0 && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
30 {
31 if (priv->language)
32@@ -545,7 +548,9 @@
33
34 g_variant_unref (result);
35
36- return TRUE;
37+ priv->loaded_values = TRUE;
38+
39+ return !system_account;
40 }
41
42 static void
43@@ -561,10 +566,15 @@
44 g_debug ("User %s added", path);
45 priv->user_list = user_list;
46 priv->path = g_strdup (path);
47- list_priv->users = g_list_insert_sorted (list_priv->users, user, compare_user);
48 g_signal_connect (user, "changed", G_CALLBACK (user_changed_cb), NULL);
49- if (emit_signal)
50- g_signal_emit (user_list, list_signals[USER_ADDED], 0, user);
51+ if (load_accounts_user (user))
52+ {
53+ list_priv->users = g_list_insert_sorted (list_priv->users, user, compare_user);
54+ if (emit_signal)
55+ g_signal_emit (user_list, list_signals[USER_ADDED], 0, user);
56+ }
57+ else
58+ g_object_unref (user);
59 }
60
61 static void
62@@ -1111,9 +1121,7 @@
63 return;
64 priv->loaded_values = TRUE;
65
66- if (priv->path)
67- load_accounts_user (user);
68- else
69+ if (!priv->path)
70 load_dmrc (user);
71 }
72
73
74=== modified file 'tests/scripts/users.conf'
75--- tests/scripts/users.conf 2013-10-29 23:47:30 +0000
76+++ tests/scripts/users.conf 2013-11-06 23:41:35 +0000
77@@ -43,6 +43,10 @@
78 #?GREETER-X-0 LOG-USER USERNAME=have-password2
79 #?GREETER-X-0 LOG-USER USERNAME=have-password3
80
81+# Add a system user (ignored)
82+#?*ADD-USER USERNAME=lightdm
83+#?RUNNER ADD-USER USERNAME=lightdm
84+
85 # Remove a user
86 #?*DELETE-USER USERNAME=have-password3
87 #?RUNNER DELETE-USER USERNAME=have-password3
88
89=== modified file 'tests/src/test-runner.c'
90--- tests/src/test-runner.c 2013-10-30 01:15:07 +0000
91+++ tests/src/test-runner.c 2013-11-06 23:41:35 +0000
92@@ -1665,7 +1665,7 @@
93 for (link = accounts_users; link; link = link->next)
94 {
95 AccountsUser *user = link->data;
96- if (!user->hidden)
97+ if (!user->hidden && user->uid >= 1000)
98 g_variant_builder_add_value (&builder, g_variant_new_object_path (user->path));
99 }
100
101@@ -1733,6 +1733,8 @@
102 return g_variant_new_string (user->real_name);
103 else if (strcmp (property_name, "HomeDirectory") == 0)
104 return g_variant_new_string (user->home_directory);
105+ else if (strcmp (property_name, "SystemAccount") == 0)
106+ return g_variant_new_boolean (user->uid < 1000);
107 else if (strcmp (property_name, "BackgroundFile") == 0)
108 return g_variant_new_string (user->background ? user->background : "");
109 else if (strcmp (property_name, "Language") == 0)
110@@ -1790,6 +1792,7 @@
111 " <property name='UserName' type='s' access='read'/>"
112 " <property name='RealName' type='s' access='read'/>"
113 " <property name='HomeDirectory' type='s' access='read'/>"
114+ " <property name='SystemAccount' type='b' access='read'/>"
115 " <property name='BackgroundFile' type='s' access='read'/>"
116 " <property name='Language' type='s' access='read'/>"
117 " <property name='IconFile' type='s' access='read'/>"

Subscribers

People subscribed via source and target branches