File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -248,14 +248,21 @@ namespace SDDM {
248248 m_app->error (m_pam->errorString (), Auth::ERROR_AUTHENTICATION);
249249 return false ;
250250 }
251+
251252 QProcessEnvironment sessionEnv = m_app->session ()->processEnvironment ();
252- QString display = sessionEnv.value (" DISPLAY" );
253- if (!display.isEmpty ()) {
253+ if (sessionEnv.value (" XDG_SESSION_TYPE" ) == QStringLiteral (" x11" )) {
254+ QString display = sessionEnv.value (" DISPLAY" );
255+ if (!display.isEmpty ()) {
254256#ifdef PAM_XDISPLAY
255- m_pam->setItem (PAM_XDISPLAY, qPrintable (display));
257+ m_pam->setItem (PAM_XDISPLAY, qPrintable (display));
256258#endif
257- m_pam->setItem (PAM_TTY, qPrintable (display));
259+ m_pam->setItem (PAM_TTY, qPrintable (display));
260+ }
261+ } else if (sessionEnv.value (" XDG_SESSION_TYPE" ) == QStringLiteral (" wayland" )) {
262+ QString tty = QString (" /dev/tty%1" ).arg (sessionEnv.value (" XDG_VTNR" ));
263+ m_pam->setItem (PAM_TTY, qPrintable (tty));
258264 }
265+
259266 if (!m_pam->putEnv (sessionEnv)) {
260267 m_app->error (m_pam->errorString (), Auth::ERROR_INTERNAL);
261268 return false ;
You can’t perform that action at this time.
0 commit comments