summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-10-01 14:50:00 -0400
committerLennart Poettering <lennart@poettering.net>2012-10-01 14:50:05 -0400
commita8573ccc35a4efe8900be5d48c6c803670540c2b (patch)
treef2efe319d8c5d8a13a1c197c159735250adc25f9
parentd67227c8b963a4f5ec1472ffc5ff2f5bf04deeed (diff)
pam: check environ[] for XDG_SEAT as fallback
This is useful for systems such as kmscon which want to invoke classic /sbin/login but use it on multiple seats.
-rw-r--r--src/login/pam-module.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/login/pam-module.c b/src/login/pam-module.c
index 0d387918c7..af108c46d5 100644
--- a/src/login/pam-module.c
+++ b/src/login/pam-module.c
@@ -428,8 +428,14 @@ _public_ PAM_EXTERN int pam_sm_open_session(
pam_get_item(handle, PAM_TTY, (const void**) &tty);
pam_get_item(handle, PAM_RUSER, (const void**) &remote_user);
pam_get_item(handle, PAM_RHOST, (const void**) &remote_host);
+
seat = pam_getenv(handle, "XDG_SEAT");
+ if (isempty(seat))
+ seat = getenv("XDG_SEAT");
+
cvtnr = pam_getenv(handle, "XDG_VTNR");
+ if (isempty(cvtnr))
+ cvtnr = getenv("XDG_VTNR");
service = strempty(service);
tty = strempty(tty);
@@ -468,6 +474,8 @@ _public_ PAM_EXTERN int pam_sm_open_session(
class = pam_getenv(handle, "XDG_SESSION_CLASS");
if (isempty(class))
+ class = getenv("XDG_SESSION_CLASS");
+ if (isempty(class))
class = "user";
remote = !isempty(remote_host) &&