Summary: | [patch] x11/sddm: use the login class capability database (/etc/login.conf, setusercontext) | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Martin Birgmeier <d8zNeCFG> | ||||||||
Component: | Individual Port(s) | Assignee: | freebsd-kde (group) <kde> | ||||||||
Status: | Closed FIXED | ||||||||||
Severity: | Affects Only Me | CC: | arrowd, sv | ||||||||
Priority: | --- | Keywords: | buildisok | ||||||||
Version: | Latest | Flags: | bugzilla:
maintainer-feedback?
(kde) |
||||||||
Hardware: | Any | ||||||||||
OS: | Any | ||||||||||
Attachments: |
|
Build info is available at https://gitlab.com/swills/freebsd-ports/pipelines/94962623 Hello Martin, thanks for the patch. Looking at the code, I wonder if it takes into account ~/.login_conf file too? Another question - what do you think about upstreaming this? Well, the code simply uses setusercontext and related functions in a way which makes them work with the restrictions given by QT5. I would assume that this function family conforms to login.conf(5) and therefore also reads .login_conf. Regarding upstreaming I am not sure, this is rather specific to FreeBSD. -- Martin Can you rebase your patch onto 0.18.1 version of src/helper/UserSession.cpp, please? The code has changed a bit and I'm not 100% sure how to adapt your patch. See https://github.com/sddm/sddm/blob/v0.18.1/src/helper/UserSession.cpp Created attachment 211450 [details]
patches for 0.18.1
I made a quick port of the patches (including the original ones from the FreeBSD port) to 0.18.1 but did not try them.
-- Martin
One local change snuck in: I have MINIMUM_VT=2, but the original FreeBSD port uses 9. That should be reverted. -- Martin A commit references this bug: Author: arrowd Date: Wed Feb 12 15:31:28 UTC 2020 New revision: 525915 URL: https://svnweb.freebsd.org/changeset/ports/525915 Log: x11/sddm: Update to 0.18.1. Upstream does not provide a config file anymore. SDDM still reads /usr/local/etc/sddm.conf if it is present, but the intended way to configure it now is using /usr/local/etc/sddm.conf.d/ directory. See man sddm.conf(5) for details. Also include a patch to make SDDM take /etc/login.conf into account. PR: 241519 Submitted by: Martin Birgmeier <d8zNeCFG@aon.at> (login.conf patch) Differential Revision: https://reviews.freebsd.org/D23579 Changes: head/x11/sddm/Makefile head/x11/sddm/distinfo head/x11/sddm/files/VirtualTerminal_FreeBSD.cpp head/x11/sddm/files/git-patch-b02b00559 head/x11/sddm/files/patch-data_scripts_Xsession head/x11/sddm/files/patch-services_sddm-greeter.pam head/x11/sddm/files/patch-services_sddm-greeter.pam.in head/x11/sddm/files/patch-src_common_Configuration.h head/x11/sddm/files/patch-src_daemon_CMakeLists.txt head/x11/sddm/files/patch-src_daemon_Display.cpp head/x11/sddm/files/patch-src_daemon_SignalHandler.cpp head/x11/sddm/files/patch-src_helper_Backend.cpp head/x11/sddm/files/patch-src_helper_CMakeLists.txt head/x11/sddm/files/patch-src_helper_HelperApp.cpp head/x11/sddm/files/patch-src_helper_UserSession.cpp head/x11/sddm/pkg-message head/x11/sddm/pkg-plist Let's not close this yet, as I plan to give your patch more testing in my production environment. Your patch indeed makes sddm use values from /etc/login.conf file, great job! However, it still doesn't take ~/.login_conf files into account. Any chance you would implement that? Hi Gleb, As I wrote in comment #3, I am not doing any parsing myself... it should all be done by setusercontext() et al. See https://www.freebsd.org/cgi/man.cgi?login.conf(5). Maybe it is necessary to configure the reading of ~/.login_conf specifically somewhere? -- Martin (In reply to Martin Birgmeier from comment #10) Your code gets executed as root, so I think it is expected that it doesn't check users ~/.login_conf. Maybe it even does take /root/.login_conf into account (I didn't check that), but I want sddm to load .login_conf of **user being logged in**. Since if you already took a look at the codebase, maybe you have an idea which part of code gets executed as user? How does your ~/.login_conf look like? Can you post it here? Everything is done as root, but since a specific pw entry is referenced by the functions the correct config should be read. It is interesting to read /usr/src/lib/libutil/login_class.c... I don't know whether I'll come up with anything soon. -- Martin (In reply to Martin Birgmeier from comment #12) % cat ~/.login_conf me:\ :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,http_proxy=http\c//10.10.7.1\c3128/,https_proxy=http\c//10.10.7.1\c3128/:\ :charset=UTF-8:\ :lang=ru_RU.UTF-8: Created attachment 211692 [details]
new patch for Backend.cpp which should include ~/.login_conf
Can you please try the new patch? It also corrects a memory leak.
Fortunately, K. Evans recently committed r357563 to the main FreeBSD sources... which taught me.
-- Martin
(In reply to Martin Birgmeier from comment #14) Awesome, it works! I'll commit it shortly? Are you still reluctant to upstream your patches? If yes, may I take your patch and upstream it myself? A commit references this bug: Author: arrowd Date: Thu Feb 20 13:50:02 UTC 2020 New revision: 526571 URL: https://svnweb.freebsd.org/changeset/ports/526571 Log: x11/sddm: Enhance Backend.cpp patch to take into account not only /etc/login.conf but also ~/.login_conf file. PR: 241519 Submitted by: Martin Birgmeier <d8zNeCFG@aon.at> Changes: head/x11/sddm/Makefile head/x11/sddm/files/patch-src_helper_Backend.cpp Hi Gleb, I am happy to see that it works. Of course you may upstream this! Best regards, Martin Thanks for your work. :-) It's a small return for all the work others have put in... -- Martin Hi, All! After upgrading to the version 0.18.1, I got a problem. In the file /etc/rc.conf I have a variable sddm_lang="ru_RU". This variable is described in the file /usr/local/etc/rc.d/sddm. Previously, the SDDM interface was in Russian. Now the value of this variable does not affect anything. SDDM interface is now always in English. Can any one help me? While writing the previous comment, I came up with a solution: pw usermod sddm -L russian Thus, I changed the SDDM interface language to Russian. It may be necessary to change the information about the sddm_lang variable in the file /usr/local/etc/rc.d/sddm. (In reply to Serge Volkov from comment #21) Thanks for the report. Can you please open a new PR about this problem, and assign it to me, so it wouldn't get lost? |
Created attachment 208628 [details] patch for x11/sddm to be applied in /usr/ports The attached patch enables sddm to use the login class capability database in /etc/login.conf. The handling of the environment is non-trivial, see the embedded comments. -- Martin