diff options
author | Ray Strode <rstrode@redhat.com> | 2013-06-03 14:59:40 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2013-06-03 15:02:41 -0400 |
commit | b09603c5ea4d57bde623521626a0da4da96f2759 (patch) | |
tree | 0f59773e1719ca9419cc997eea8fba9252049d97 | |
parent | fb3273bbcda498663b74cb2fb9bbaa3f18130fd8 (diff) |
lib: don't ever consider non-user sessions when running in user session
Right now if a greeter session happens to start in the background, then
libaccountservice will suddenly recognize gdm as a valid user (since
we automatically recognize users for sessions that come in).
This commit makes that detection logic only consider user sessions, not
greeter sessions.
https://bugzilla.gnome.org/show_bug.cgi?id=701514
-rw-r--r-- | src/libaccountsservice/act-user-manager.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c index bf2bd76..a43a68f 100644 --- a/src/libaccountsservice/act-user-manager.c +++ b/src/libaccountsservice/act-user-manager.c @@ -1828,6 +1828,8 @@ reload_systemd_sessions (ActUserManager *manager) if (sessions != NULL) { for (i = 0; sessions[i] != NULL; i ++) { + char *session_class; + res = sd_session_get_state (sessions[i], &state); if (res < 0) { @@ -1842,6 +1844,21 @@ reload_systemd_sessions (ActUserManager *manager) continue; } + session_class = NULL; + res = sd_session_get_class (sessions[i], &session_class); + + if (res < 0) { + g_debug ("Failed to determine class of session %s: %s", sessions[i], strerror (-res)); + continue; + } + + if (g_strcmp0 (session_class, "user") != 0) { + g_debug ("Ignoring non-user session %s (class %s)", sessions[i], session_class); + free (session_class); + continue; + } + free (session_class); + g_hash_table_insert (systemd_sessions, sessions[i], NULL); } |