Merge lp:~azzar1/unity/lp-1413790 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3913
Proposed branch: lp:~azzar1/unity/lp-1413790
Merge into: lp:unity
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:~azzar1/unity/lp-1413790
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+247397@code.launchpad.net

Commit message

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

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 :

Approved as discussed.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'UnityCore/GnomeSessionManager.cpp'
--- UnityCore/GnomeSessionManager.cpp 2015-01-14 00:10:20 +0000
+++ UnityCore/GnomeSessionManager.cpp 2015-01-24 00:58:29 +0000
@@ -22,6 +22,8 @@
22#include <NuxCore/Logger.h>22#include <NuxCore/Logger.h>
23#include "Variant.h"23#include "Variant.h"
2424
25#include <grp.h>
26
25namespace unity27namespace unity
26{28{
27namespace session29namespace session
@@ -483,6 +485,18 @@
483 return inhibitors.GetBool();485 return inhibitors.GetBool();
484}486}
485487
488bool GnomeManager::Impl::IsUserInGroup(std::string const& user_name, std::string const& group_name)
489{
490 auto group = getgrnam(group_name.c_str());
491
492 if (group && group->gr_mem)
493 for (int i = 0; group->gr_mem[i]; ++i)
494 if (g_strcmp0(group->gr_mem[i], user_name.c_str()) == 0)
495 return true;
496
497 return false;
498}
499
486// Public implementation500// Public implementation
487501
488GnomeManager::GnomeManager()502GnomeManager::GnomeManager()
@@ -654,7 +668,8 @@
654 glib::Object<GSettings> lockdown_settings(g_settings_new(GNOME_LOCKDOWN_OPTIONS.c_str()));668 glib::Object<GSettings> lockdown_settings(g_settings_new(GNOME_LOCKDOWN_OPTIONS.c_str()));
655669
656 if (g_settings_get_boolean(lockdown_settings, DISABLE_LOCKSCREEN_KEY.c_str()) ||670 if (g_settings_get_boolean(lockdown_settings, DISABLE_LOCKSCREEN_KEY.c_str()) ||
657 UserName().find("guest-") == 0 || is_locked())671 UserName().find("guest-") == 0 ||
672 impl_->IsUserInGroup(UserName(), "nopasswdlogin"))
658 {673 {
659 return false;674 return false;
660 }675 }
661676
=== modified file 'UnityCore/GnomeSessionManagerImpl.h'
--- UnityCore/GnomeSessionManagerImpl.h 2014-05-16 04:24:05 +0000
+++ UnityCore/GnomeSessionManagerImpl.h 2015-01-24 00:58:29 +0000
@@ -64,6 +64,8 @@
64 bool InteractiveMode();64 bool InteractiveMode();
65 void UpdateHaveOtherOpenSessions();65 void UpdateHaveOtherOpenSessions();
6666
67 bool IsUserInGroup(std::string const& user_name, std::string const& group_name);
68
67 GnomeManager* manager_;69 GnomeManager* manager_;
68 bool test_mode_;70 bool test_mode_;
69 bool can_shutdown_;71 bool can_shutdown_;