openbsd-ports/x11/kde/base3/patches/patch-kdm_backend_auth_c

40 lines
919 B
Plaintext

$OpenBSD: patch-kdm_backend_auth_c,v 1.4 2005/03/29 21:18:35 espie Exp $
--- kdm/backend/auth.c.orig Wed Feb 23 12:25:59 2005
+++ kdm/backend/auth.c Wed Mar 23 11:54:51 2005
@@ -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 );
ret = TRUE;
for (i = 0; i < count; i++) {