Merge lp:~3v1n0/unity/safer-pam-handle into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4172
Proposed branch: lp:~3v1n0/unity/safer-pam-handle
Merge into: lp:unity
Diff against target: 22 lines (+3/-2)
1 file modified
lockscreen/UserAuthenticatorPam.cpp (+3/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/safer-pam-handle
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+302518@code.launchpad.net

Commit message

UserAuthenticatorPam: ensure pam_handle_ is null initialized and don't proceed if not set

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

I'm not completely sure this is going to fix the problem described in bug #1611668. But this should not harm so +1 for me.

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 2016-06-17 12:05:17 +0000
3+++ lockscreen/UserAuthenticatorPam.cpp 2016-08-10 09:09:03 +0000
4@@ -39,8 +39,9 @@
5 first_prompt_ = true;
6 username_ = username;
7 authenticate_cb_ = authenticate_cb;
8+ pam_handle_ = nullptr;
9
10- if (!InitPam())
11+ if (!InitPam() || !pam_handle_)
12 return false;
13
14 glib::Object<GTask> task(g_task_new(nullptr, cancellable_, [] (GObject*, GAsyncResult*, gpointer data) {
15@@ -66,7 +67,7 @@
16 if (unity::Settings::Instance().pam_check_account_type())
17 self->status_ = status2;
18
19- pam_setcred (self->pam_handle_, PAM_REINITIALIZE_CRED);
20+ pam_setcred(self->pam_handle_, PAM_REINITIALIZE_CRED);
21 }
22 });
23