Date: Mon, 17 Jun 2024 09:28:39 GMT From: Baptiste Daroussin <bapt@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: f6c04193d0f8 - main - x11/ly: fixed application of login class via setusercontext() Message-ID: <202406170928.45H9SdQx081114@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/ports/commit/?id=f6c04193d0f8d2fe1610a74662d575ef526c16c4 commit f6c04193d0f8d2fe1610a74662d575ef526c16c4 Author: Robin Haberkorn <robin.haberkorn@googlemail.com> AuthorDate: 2024-01-21 19:35:34 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2024-06-17 09:26:54 +0000 x11/ly: fixed application of login class via setusercontext() See also https://github.com/fairyglade/ly/issues/572 --- x11/ly/files/patch-makefile | 2 +- x11/ly/files/patch-src_login.c | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/x11/ly/files/patch-makefile b/x11/ly/files/patch-makefile index d8da24fa3b66..9c79340c04c1 100644 --- a/x11/ly/files/patch-makefile +++ b/x11/ly/files/patch-makefile @@ -15,7 +15,7 @@ endif +ifeq ($(OS), FreeBSD) + FLAGS+= -D_DEFAULT_SOURCE ${CPPFLAGS} ${CFLAGS} -+ LINK+= ${LIBS} ++ LINK+= ${LIBS} -lutil +endif BIND = bin diff --git a/x11/ly/files/patch-src_login.c b/x11/ly/files/patch-src_login.c index 740077a873e7..0bdfda667e36 100644 --- a/x11/ly/files/patch-src_login.c +++ b/x11/ly/files/patch-src_login.c @@ -1,6 +1,6 @@ --- src/login.c.orig 2023-06-15 07:30:09 UTC +++ src/login.c -@@ -19,7 +19,7 @@ +@@ -19,9 +19,13 @@ #include <sys/stat.h> #include <sys/wait.h> #include <unistd.h> @@ -8,8 +8,14 @@ +#include <utmpx.h> #include <xcb/xcb.h> ++#include <sys/param.h> ++#include <sys/types.h> ++#include <login_cap.h> ++ int get_free_display() -@@ -214,13 +214,13 @@ void env_init(struct passwd* pwd) + { + char xlock[1024]; +@@ -214,13 +218,13 @@ // clean env environ[0] = NULL; @@ -25,7 +31,7 @@ // Set PATH if specified in the configuration if (strlen(config.path)) -@@ -259,9 +259,15 @@ void env_xdg(const char* tty_id, const char* desktop_n +@@ -259,9 +263,15 @@ void env_xdg(const char* tty_id, const char* desktop_name) { @@ -41,7 +47,7 @@ setenv("XDG_SESSION_CLASS", "user", 0); setenv("XDG_SESSION_ID", "1", 0); setenv("XDG_SESSION_DESKTOP", desktop_name, 0); -@@ -269,8 +275,8 @@ void env_xdg(const char* tty_id, const char* desktop_n +@@ -269,8 +279,8 @@ setenv("XDG_VTNR", tty_id, 0); } @@ -52,7 +58,7 @@ char *username, pid_t display_pid ) { -@@ -281,24 +287,23 @@ void add_utmp_entry( +@@ -281,24 +291,23 @@ /* only correct for ptys named /dev/tty[pqr][0-9a-z] */ strcpy(entry->ut_id, ttyname(STDIN_FILENO) + strlen("/dev/tty")); @@ -89,7 +95,28 @@ } void xauth(const char* display_name, const char* shell, char* pwd) -@@ -616,7 +621,7 @@ void auth( +@@ -598,6 +607,16 @@ + exit(EXIT_FAILURE); + } + ++ ok = setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL); ++ ++ if (ok != 0) ++ { ++ dgn_throw(DGN_USER_UID); ++ exit(EXIT_FAILURE); ++ } ++ ++ /* This is done by setusercontext() on FreeBSD. */ ++#if 0 + ok = setgid(pwd->pw_gid); + + if (ok != 0) +@@ -613,10 +632,11 @@ + dgn_throw(DGN_USER_UID); + exit(EXIT_FAILURE); + } ++#endif // get a display char vt[5]; @@ -98,7 +125,7 @@ // set env (this clears the environment) env_init(pwd); -@@ -671,13 +676,13 @@ void auth( +@@ -671,13 +691,13 @@ } // add utmp audit
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202406170928.45H9SdQx081114>