Merge lp:~robert-ancell/unity/moar-pam into lp:unity

Proposed by Robert Ancell
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3741
Proposed branch: lp:~robert-ancell/unity/moar-pam
Merge into: lp:unity
Diff against target: 36 lines (+16/-0)
2 files modified
lockscreen/UserAuthenticatorPam.cpp (+6/-0)
tests/test_user_authenticator_pam.cpp (+10/-0)
To merge this branch: bzr merge lp:~robert-ancell/unity/moar-pam
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+212340@code.launchpad.net

Commit message

Call pam_acct_mgmt and pam_chauthtok when unlocking screen

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) wrote :

Thanks for this.

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/UserAuthenticatorPam.cpp'
2--- lockscreen/UserAuthenticatorPam.cpp 2014-03-07 17:16:56 +0000
3+++ lockscreen/UserAuthenticatorPam.cpp 2014-03-24 00:30:36 +0000
4@@ -53,6 +53,12 @@
5 g_task_run_in_thread(task, [] (GTask* task, gpointer, gpointer data, GCancellable*) {
6 auto self = static_cast<UserAuthenticatorPam*>(data);
7 self->status_ = pam_authenticate(self->pam_handle_, 0);
8+ if (self->status_ == PAM_SUCCESS)
9+ self->status_ = pam_acct_mgmt(self->pam_handle_, 0);
10+ if (self->status_ == PAM_NEW_AUTHTOK_REQD)
11+ self->status_ = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
12+ if (self->status_ == PAM_SUCCESS)
13+ pam_setcred (self->pam_handle_, PAM_REINITIALIZE_CRED);
14 });
15
16 return true;
17
18=== modified file 'tests/test_user_authenticator_pam.cpp'
19--- tests/test_user_authenticator_pam.cpp 2014-02-20 19:43:52 +0000
20+++ tests/test_user_authenticator_pam.cpp 2014-03-24 00:30:36 +0000
21@@ -45,6 +45,16 @@
22 return strcmp(resp[0].resp, "password");
23 }
24
25+int pam_acct_mgmt(pam_handle_t *pamh, int flags)
26+{
27+ return PAM_SUCCESS;
28+}
29+
30+int pam_setcred(pam_handle_t *pamh, int flags)
31+{
32+ return PAM_SUCCESS;
33+}
34+
35 namespace
36 {
37