Merge lp:~bregma/unity/lp-1413790-trusty into lp:unity/7.2

Proposed by Stephen M. Webb
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3811
Proposed branch: lp:~bregma/unity/lp-1413790-trusty
Merge into: lp:unity/7.2
Diff against target: 54 lines (+18/-1)
2 files modified
UnityCore/GnomeSessionManager.cpp (+16/-1)
UnityCore/GnomeSessionManagerImpl.h (+2/-0)
To merge this branch: bzr merge lp:~bregma/unity/lp-1413790-trusty
Reviewer Review Type Date Requested Status
Christopher Townsend Approve
Review via email: mp+252643@code.launchpad.net

Commit message

made unity unlockable if user is in nopsswdlogin group

Description of the change

Make unity unlockable if user is in nopsswdlogin group. On super+l the screensaver is activated.

Cherry-picked from trunk.

To post a comment you must log in.
Revision history for this message
Christopher Townsend (townsend) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UnityCore/GnomeSessionManager.cpp'
2--- UnityCore/GnomeSessionManager.cpp 2014-12-16 19:27:36 +0000
3+++ UnityCore/GnomeSessionManager.cpp 2015-03-11 19:28:23 +0000
4@@ -22,6 +22,8 @@
5 #include <NuxCore/Logger.h>
6 #include "Variant.h"
7
8+#include <grp.h>
9+
10 namespace unity
11 {
12 namespace session
13@@ -483,6 +485,18 @@
14 return inhibitors.GetBool();
15 }
16
17+bool GnomeManager::Impl::IsUserInGroup(std::string const& user_name, std::string const& group_name)
18+{
19+ auto group = getgrnam(group_name.c_str());
20+
21+ if (group && group->gr_mem)
22+ for (int i = 0; group->gr_mem[i]; ++i)
23+ if (g_strcmp0(group->gr_mem[i], user_name.c_str()) == 0)
24+ return true;
25+
26+ return false;
27+}
28+
29 // Public implementation
30
31 GnomeManager::GnomeManager()
32@@ -651,7 +665,8 @@
33 glib::Object<GSettings> lockdown_settings(g_settings_new(GNOME_LOCKDOWN_OPTIONS.c_str()));
34
35 if (g_settings_get_boolean(lockdown_settings, DISABLE_LOCKSCREEN_KEY.c_str()) ||
36- UserName().find("guest-") == 0 || is_locked())
37+ UserName().find("guest-") == 0 ||
38+ impl_->IsUserInGroup(UserName(), "nopasswdlogin"))
39 {
40 return false;
41 }
42
43=== modified file 'UnityCore/GnomeSessionManagerImpl.h'
44--- UnityCore/GnomeSessionManagerImpl.h 2014-07-23 18:56:11 +0000
45+++ UnityCore/GnomeSessionManagerImpl.h 2015-03-11 19:28:23 +0000
46@@ -64,6 +64,8 @@
47 bool InteractiveMode();
48 void UpdateHaveOtherOpenSessions();
49
50+ bool IsUserInGroup(std::string const& user_name, std::string const& group_name);
51+
52 GnomeManager* manager_;
53 bool test_mode_;
54 bool can_shutdown_;

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: