Bug 47074 - allow using libsystemd-login in CheckUserAuthorization()
Summary: allow using libsystemd-login in CheckUserAuthorization()
Status: RESOLVED INVALID
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: 7.7 (2012.06)
Hardware: Other Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-07 13:08 UTC by Bill Nottingham
Modified: 2018-06-12 18:42 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
patch (1.01 KB, patch)
2012-03-07 13:08 UTC, Bill Nottingham
no flags Details | Splinter Review

Description Bill Nottingham 2012-03-07 13:08:55 UTC
Created attachment 58146 [details] [review]
patch

os/util.c has CheckUserAuthorization() to determine if the user's allowed to start X. The only implementation there currently uses PAM, which, in 99.9% of the cases where it's used, checks to see if the user is logged in locally.

The attached patch allows this function to use libsystemd-login to see if the user's on an active seat. Briefly tested on a system where user A is logged in on a console:

- root can still start X
- user A can still start X (whether on that console, or logged in remotely)
- user B logged in remotely can't start X

CC'ing Lennart to make sure I'm not horribly misusing the API.
Comment 1 Bill Nottingham 2012-03-07 13:09:18 UTC
Note: if taken, would need the appropriate autoconf/automake bits added.
Comment 2 Lennart Poettering 2012-03-07 14:06:32 UTC
Looks OK, but two points:

The Debian folks will not like you for this, since this will fail if they build systemd support in but don't run systemd. Might make sense to wrap this in a bit of "if (sd_booted() > 0) { ..." around it.

I think it would make sense to allow startx only when invoked from a VT, not already when the user is logged in on one at all that isn't necessarily the one he is invoking startx from. (Especially since we now want to teach startx to take over the VT it has been started on). Hence I'd suggest:

bool allow;

if (sd_booted() > 0) {
        int r;

        allow = false;
        if (sd_session_get_seat(NULL, &seat) > 0) {
                if (strcmp(seat, "seat0") == 0)
                        allow = true;
                free(seat);
        }
} else
        allow = true;
Comment 3 Adam Jackson 2018-06-12 18:42:59 UTC
Mass closure: This bug has been untouched for more than six years, and is not obviously still valid. Please file a new report if you continue to experience issues with a current server.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.