$OpenBSD: patch-kdm_backend_auth_c,v 1.3 2004/09/18 09:36:43 espie Exp $
--- kdm/backend/auth.c.orig	Thu Aug  5 20:57:03 2004
+++ kdm/backend/auth.c	Mon Sep  6 11:36:26 2004
@@ -43,6 +43,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>
 
@@ -330,6 +333,25 @@ SaveServerAuthorizations (
 	    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);
     ret = TRUE;
     for (i = 0; i < count; i++)
