summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrançois Andriot <[email protected]>2014-10-18 13:56:58 +0200
committerSlávek Banko <[email protected]>2014-10-18 14:29:17 +0200
commit18b81de37b433e00f5b51323ee6569eb8068cf70 (patch)
treeeecda84074807119ec2dc1b77f753ad6a8cc84cb
parent7d4e25814c489c3e2acd92f5a58384f12adb6e2a (diff)
downloadtdebase-18b81de37b433e00f5b51323ee6569eb8068cf70.tar.gz
tdebase-18b81de37b433e00f5b51323ee6569eb8068cf70.zip
Fix tdm auth backend for openbsd
Signed-off-by: François Andriot <[email protected]>"
-rw-r--r--tdm/backend/auth.c23
1 files changed, 23 insertions, 0 deletions
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 <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
+#ifdef __OpenBSD__
+#include <pwd.h>
+#endif
#include <sys/ioctl.h>
@@ -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++) {
/*