Merge lp://qastaging/~mterry/lightdm/root-tests into lp://qastaging/lightdm

Proposed by Michael Terry
Status: Rejected
Rejected by: Robert Ancell
Proposed branch: lp://qastaging/~mterry/lightdm/root-tests
Merge into: lp://qastaging/lightdm
Prerequisite: lp://qastaging/~mterry/lightdm/test-force-greeter-close
Diff against target: 42 lines (+9/-0)
2 files modified
tests/src/guest-account.c (+5/-0)
tests/src/libsystem.c (+4/-0)
To merge this branch: bzr merge lp://qastaging/~mterry/lightdm/root-tests
Reviewer Review Type Date Requested Status
LightDM Development Team Pending
Review via email: mp+126611@code.qastaging.launchpad.net

Description of the change

This branch lets the test suite be run as root. Without this, you get lots of ".Xauthority could not be opened: permission denied" errors. Because the home directory of the user is created as root in several tests:
* guest tests
* test-home-dir-on-session
* test-home-dir-on-authenticate

By chown'ing the directories as appropriate, we can proceed.

I confess I'm a little confused on how the test suite normally handles the made up uid/gid for test users. How does this work when the test suite is being run by a normal user? Like, how does my user 'mike' get to create files under a home directory for 1020/1020? I see that we overload getuid(), but surely that doesn't really work like that, or unix security has a problem. :)

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

The real problem turned out to be we weren't overloading setegid, setresgid, seteuid and setresuid which are the syscalls we use (now) to drop privileges. When running the tests as root lightdm attempted to an successfully dropped privileges with these calls which is why they couldn't read all the other root files.

LightDM only tries to drop privileges when getresuid is 0 which is why this doesn't occur when not running as root. We have this check in case you are running in test mode (though it would be nice to be able to avoid this check).

Note, we should be overriding getresuid in libsystem but for some reason the tests fail when that occurs running as non-root so it's currently disabled.

See revision 1548

Unmerged revisions

1552. By Michael Terry

tests: chown newly created home dirs to let tests pass as root

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches