[LightDM] Problem with LightDM on Solaris build

Guido Berhoerster gber at opensuse.org
Tue Nov 29 14:20:57 PST 2011


* Raimund Steger <rs at mytum.de> [2011-11-29 19:10]:
> Hi,
> 
> On 2011-11-29 18:07, Guido Berhoerster wrote:
> >[...]
> >>
> >>Is the use of these functions necessary?  Would it make sense to #ifdef
> >>the code so it can also build and work on Solaris?  Any advice about how
> >>to make this code more portable would be appreciated.
> >
> >privileges_drop() is being called from the lightdm daemon running
> >with root privileges, so manipulating real and effective uid/gid
> >without side effects on the saved uid is possible via procfs, ie.
> >/proc/<pid>/ctl. Restoring them later in privileges_reclaim
> >should be possible by first calling setuid() for setting the
> >effective to the saved and then setreuid() for setting the real
> >to the effective uid (and analoguosly calling setgid()/setregid()
> >for restoring the effective/real gid).
> 
> I wonder, is it even necessary in this situation to set the real user ID?

It's what the code currently does though setting the real (and
saved) uid should only be needed for permanently dropping
privileges.

> Wouldn't setegid()/seteuid() (first to the user's, then back to 0)
> suffice for filesystem operations?

I think so, it should also work across Linux and the BSDs.
-- 
Guido Berhoerster


More information about the LightDM mailing list