$OpenBSD: patch-kdm_backend_auth_c,v 1.5 2006/02/03 12:23:15 espie Exp $
--- kdm/backend/auth.c.orig	Thu Jan 19 18:03:14 2006
+++ kdm/backend/auth.c	Tue Jan 24 12:11:35 2006
@@ -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>
 
@@ -288,6 +291,25 @@ SaveServerAuthorizations( struct display
 			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++) {
 		/*
