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.
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.
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.
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.
One local change snuck in: I have MINIMUM_VT=2, but the original FreeBSD port uses 9. That should be reverted.
A commit references this bug:
Date: Wed Feb 12 15:31:28 UTC 2020
New revision: 525915
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
Also include a patch to make SDDM take /etc/login.conf into account.
Submitted by: Martin Birgmeier <d8zNeCFG@aon.at> (login.conf patch)
Differential Revision: https://reviews.freebsd.org/D23579
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?
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?
(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.
(In reply to Martin Birgmeier from comment #12)
% cat ~/.login_conf
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.
(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:
Date: Thu Feb 20 13:50:02 UTC 2020
New revision: 526571
x11/sddm: Enhance Backend.cpp patch to take into account not only /etc/login.conf
but also ~/.login_conf file.
Submitted by: Martin Birgmeier <d8zNeCFG@aon.at>
I am happy to see that it works.
Of course you may upstream this!
Thanks for your work.
It's a small return for all the work others have put in...
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?