FreeBSD Bugzilla – Attachment 208628 Details for
Bug 241519
[patch] x11/sddm: use the login class capability database (/etc/login.conf, setusercontext)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for x11/sddm to be applied in /usr/ports
sddm.patch (text/plain), 4.21 KB, created by
Martin Birgmeier
on 2019-10-27 10:28:48 UTC
(
hide
)
Description:
patch for x11/sddm to be applied in /usr/ports
Filename:
MIME Type:
Creator:
Martin Birgmeier
Created:
2019-10-27 10:28:48 UTC
Size:
4.21 KB
patch
obsolete
>--- ./x11/sddm/files/XXXpatch-src_helper_Backend.cpp.ORIG 2019-10-27 07:48:10.488432000 +0100 >+++ ./x11/sddm/files/patch-src_helper_Backend.cpp 2019-10-27 08:16:37.971092000 +0100 >@@ -0,0 +1,33 @@ >+--- ./src/helper/Backend.cpp.ORIG 2017-12-05 17:00:16.000000000 +0100 >++++ ./src/helper/Backend.cpp 2019-10-27 09:09:12.407454000 +0100 >+@@ -29,6 +29,10 @@ >+ #include <QtCore/QProcessEnvironment> >+ >+ #include <pwd.h> >++#if defined(Q_OS_FREEBSD) >++#include <sys/types.h> >++#include <login_cap.h> >++#endif /* defined(Q_OS_FREEBSD) */ >+ >+ namespace SDDM { >+ Backend::Backend(HelperApp* parent) >+@@ -70,6 +74,19 @@ >+ .arg(mainConfig.X11.UserAuthFile.get()); >+ env.insert(QStringLiteral("XAUTHORITY"), value); >+ } >++#if defined(Q_OS_FREEBSD) >++ /* get additional environment variables via setclassenvironment(); >++ this needs to be done here instead of in UserSession::setupChildProcess >++ as the environment for execve() is prepared here */ >++ login_cap_t *lc; >++ >++ if ((lc = login_getpwclass(pw)) != 0) { >++ setclassenvironment(lc, pw, 1); /* path variables */ >++ setclassenvironment(lc, pw, 0); /* non-path variables */ >++ /* copy all environment variables that are now set */ >++ env.insert(QProcessEnvironment::systemEnvironment()); >++ } >++#endif /* defined(Q_OS_FREEBSD) */ >+ // TODO: I'm fairly sure this shouldn't be done for PAM sessions, investigate! >+ m_app->session()->setProcessEnvironment(env); >+ } >--- ./x11/sddm/files/XXXpatch-src_helper_CMakeLists.txt.ORIG 2019-10-26 13:33:37.970994000 +0200 >+++ ./x11/sddm/files/patch-src_helper_CMakeLists.txt 2019-10-26 14:10:22.574342000 +0200 >@@ -0,0 +1,12 @@ >+--- ./src/helper/CMakeLists.txt.ORIG 2017-12-05 17:00:16.000000000 +0100 >++++ ./src/helper/CMakeLists.txt 2019-10-26 13:31:46.619098000 +0200 >+@@ -37,6 +37,9 @@ >+ else() >+ target_link_libraries(sddm-helper crypt) >+ endif() >++if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") >++ target_link_libraries(sddm-helper util) >++endif() >+ >+ if(JOURNALD_FOUND) >+ target_link_libraries(sddm-helper ${JOURNALD_LIBRARIES}) >--- ./x11/sddm/files/XXXpatch-src_helper_UserSession2.cpp.ORIG 2019-10-26 13:34:12.915163000 +0200 >+++ ./x11/sddm/files/patch-src_helper_UserSession2.cpp 2019-10-27 08:17:41.861917000 +0100 >@@ -0,0 +1,35 @@ >+--- ./src/helper/UserSession.cpp.ORIG 2019-10-27 09:01:43.058761000 +0100 >++++ ./src/helper/UserSession.cpp 2019-10-27 09:05:06.270407000 +0100 >+@@ -32,6 +32,9 @@ >+ #include <grp.h> >+ #include <unistd.h> >+ #include <fcntl.h> >++#if defined(Q_OS_FREEBSD) >++#include <login_cap.h> >++#endif /* defined(Q_OS_FREEBSD) */ >+ >+ namespace SDDM { >+ UserSession::UserSession(HelperApp *parent) >+@@ -110,6 +113,14 @@ >+ >+ const QByteArray username = qobject_cast<HelperApp*>(parent())->user().toLocal8Bit(); >+ struct passwd *pw = getpwnam(username.constData()); >++#if defined(Q_OS_FREEBSD) >++ /* execve() uses the environment prepared in Backend::openSession(), >++ therefore environment variables which are set here are ignored. */ >++ if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) != 0) { >++ qCritical() << "setusercontext(NULL, *, " << pw->pw_uid << ", LOGIN_SETALL) failed for user: " << username; >++ exit(Auth::HELPER_OTHER_ERROR); >++ } >++#else /* defined(Q_OS_FREEBSD) */ >+ if (setgid(pw->pw_gid) != 0) { >+ qCritical() << "setgid(" << pw->pw_gid << ") failed for user: " << username; >+ exit(Auth::HELPER_OTHER_ERROR); >+@@ -122,6 +133,7 @@ >+ qCritical() << "setuid(" << pw->pw_uid << ") failed for user: " << username; >+ exit(Auth::HELPER_OTHER_ERROR); >+ } >++#endif /* defined(Q_OS_FREEBSD) */ >+ if (chdir(pw->pw_dir) != 0) { >+ qCritical() << "chdir(" << pw->pw_dir << ") failed for user: " << username; >+ qCritical() << "verify directory exist and has sufficient permissions"; >--- ./x11/sddm/XXXpkg-message.ORIG 2019-08-14 18:16:00.721534000 +0200 >+++ ./x11/sddm/pkg-message 2019-10-27 08:00:25.954955000 +0100 >@@ -1,8 +0,0 @@ >-[ >-{ type: install >- message: <<EOM >-SDDM does not support login.conf(5), and no special restrictions >-or settings from login.conf are enforced or applied. >-EOM >-} >-]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 241519
: 208628 |
211450
|
211692