From 18b81de37b433e00f5b51323ee6569eb8068cf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Sat, 18 Oct 2014 13:56:58 +0200 Subject: Fix tdm auth backend for openbsd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: François Andriot " --- tdm/backend/auth.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tdm') diff --git a/tdm/backend/auth.c b/tdm/backend/auth.c index bd183142c..b92881789 100644 --- a/tdm/backend/auth.c +++ b/tdm/backend/auth.c @@ -41,6 +41,9 @@ from the copyright holder. #include #include #include +#ifdef __OpenBSD__ +#include +#endif #include @@ -290,6 +293,26 @@ SaveServerAuthorizations( struct display *d, Xauth **auths, int count ) return FALSE; } } +#ifdef __OpenBSD__ + { + struct passwd *x11; + uid_t uid; + gid_t gid; + /* Give read capability to group _x11 */ + x11 = getpwnam("_x11"); + if (x11 == NULL) { + LogError("Can't find _x11 user\n"); + uid = getuid(); + gid = getgid(); + } else { + uid = x11->pw_uid; + gid = x11->pw_gid; + } + + fchown(fileno(auth_file), uid, gid); + } +#endif + Debug( "file: %s auth: %p\n", d->authFile, auths ); for (i = 0; i < count; i++) { /* -- cgit v1.2.3