diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2012-02-15 12:08:49 +1100 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2012-02-15 12:08:49 +1100 |
commit | 14b3b8e817da9de8e0bd69ad2ccb2b4258278e95 (patch) | |
tree | fc415fe4cf1f70a70d1b90bf9c52da2c499e8172 /src | |
parent | 5abcd9c4939015454cfa09e24e3a3201678751a0 (diff) | |
download | lightdm-14b3b8e817da9de8e0bd69ad2ccb2b4258278e95.tar.gz |
Detect and handle correctly PAM modules that return user accounts that don't exist
Diffstat (limited to 'src')
-rw-r--r-- | src/display.c | 28 | ||||
-rw-r--r-- | src/greeter.c | 10 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/display.c b/src/display.c index 570d6c15..215611fb 100644 --- a/src/display.c +++ b/src/display.c @@ -260,20 +260,28 @@ autologin_authentication_result_cb (PAMSession *authentication, int result, Disp if (result == PAM_SUCCESS) { + User *user; const gchar *session_name; - - g_debug ("User %s authorized", pam_session_get_username (authentication)); - session_name = user_get_xsession (pam_session_get_user (authentication)); - if (session_name) + user = pam_session_get_user (authentication); + + if (user) { - g_debug ("Using session %s", session_name); - display_set_user_session (display, session_name); - } + g_debug ("User %s authorized", pam_session_get_username (authentication)); - started_session = start_user_session (display, authentication); - if (!started_session) - g_debug ("Failed to start autologin session"); + session_name = user_get_xsession (user); + if (session_name) + { + g_debug ("Using session %s", session_name); + display_set_user_session (display, session_name); + } + + started_session = start_user_session (display, authentication); + if (!started_session) + g_debug ("Failed to start autologin session"); + } + else + g_debug ("User %s was authorized, but no account of that name exists", pam_session_get_username (authentication)); } else g_debug ("Autologin failed authentication"); diff --git a/src/greeter.c b/src/greeter.c index 28ff3b7f..10fc31fb 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -261,7 +261,15 @@ authentication_result_cb (PAMSession *authentication, int result, Greeter *greet g_debug ("Authenticate result for user %s: %s", pam_session_get_username (authentication), pam_session_strerror (authentication, result)); if (result == PAM_SUCCESS) - g_debug ("User %s authorized", pam_session_get_username (authentication)); + { + if (pam_session_get_user (authentication)) + g_debug ("User %s authorized", pam_session_get_username (authentication)); + else + { + g_debug ("User %s authorized, but no account of that name exists", pam_session_get_username (authentication)); + result = PAM_USER_UNKNOWN; + } + } send_end_authentication (greeter, greeter->priv->authentication_sequence_number, pam_session_get_username (authentication), result); } |