From nobody@FreeBSD.org  Mon Oct 15 17:35:08 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 5049D37B40C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Oct 2001 17:34:59 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f9G0Yxb87397;
	Mon, 15 Oct 2001 17:34:59 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200110160034.f9G0Yxb87397@freefall.freebsd.org>
Date: Mon, 15 Oct 2001 17:34:59 -0700 (PDT)
From: Heath Nielson <heath@cs.byu.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Running gdm causes a blank X sreen without a login box.
X-Send-Pr-Version: www-1.0

>Number:         31309
>Category:       ports
>Synopsis:       Running gdm causes a blank X sreen without a login box.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 15 17:40:01 PDT 2001
>Closed-Date:    Tue Oct 16 00:26:25 PDT 2001
>Last-Modified:  Tue Oct 16 00:29:28 PDT 2001
>Originator:     Heath Nielson
>Release:        4.4-FreeBSD Stable
>Organization:
>Environment:
FreeBSD hershey.dyn.bar.net 4.4-STABLE FreeBSD 4.4-STABLE #1: Fri Oct 12 22:28:00 MDT 2001   heath@hershey.dyn.bar.net:/usr/src/sys/compile/HERSHEY  i386
>Description:
When gdm is run, a blank X screen appears.  The gdm login box doesn't appear and appears not to be running.  Users will be unable to login in.  This is due to the fact that gdm tries to set an environment variable "GDM_TIMED_LOGIN" with a NULL value.  This causes a Segmentation Fault on FreeBSD.  I'm not sure whether the value should be NULL or not, but by passing in a space rather than a NULL fixed the problem.  (Fix inspired from David Marker <marker_d@yahoo.com>)

Also there is a problem when gdm creates a local socket.  The sizeof() wasn't specified correctly causing a truncated filename to be created in the /tmp directory, when gdm tries to remove the file through an unlink() call, the unlink() fails and subsequent attempts to bind the local socket will fail with EADDRINUSE.

(BTW sorry for trashing the diffs by sending them through the web page, currently I have no other access to GNATS.)
>How-To-Repeat:
The message after installing gdm says that gdm only works with XFree86-3.3.x so this problem might not present itselft unless the user is running XFree86-4.

Install gdm, run (as root):
/usr/X11R6/bin/gdm -nodaemon
>Fix:
--- daemon/gdm-net.c.orig	Mon Oct 15 14:00:17 2001
+++ daemon/gdm-net.c	Mon Oct 15 14:00:26 2001
@@ -251,11 +251,11 @@
 		return NULL;
 	}
 
+	memset(&addr, 0, sizeof(addr));
 	strcpy (addr.sun_path, sockname);
 	addr.sun_family = AF_UNIX;
 	if (bind (fd,
-		  (struct sockaddr *) &addr, strlen (addr.sun_path) +
-		  sizeof (addr.sun_family)) < 0) {
+		  (struct sockaddr *) &addr, sizeof (addr)) < 0) {
 		gdm_error (_("%s: Could not bind socket"),
 			   "gdm_connection_open_unix");
 		close (fd);
--- daemon/slave.c.orig	Mon Oct 15 17:58:15 2001
+++ daemon/slave.c	Mon Oct 15 17:58:56 2001
@@ -1099,7 +1099,10 @@
 	/* this is again informal only, if the greeter does time out it will
 	 * not actually login a user if it's not enabled for this display */
 	if (d->timed_login_ok) {
-		ve_setenv ("GDM_TIMED_LOGIN_OK", ParsedTimedLogin, TRUE);
+		if(ParsedTimedLogin == NULL)
+			ve_setenv ("GDM_TIMED_LOGIN_OK", " ", TRUE);
+		else
+			ve_setenv ("GDM_TIMED_LOGIN_OK", ParsedTimedLogin, TRUE);
 	} else {
 		ve_unsetenv ("GDM_TIMED_LOGIN_OK");
 	}
>Release-Note:
>Audit-Trail:

From: Maxim Sobolev <sobomax@FreeBSD.org>
To: heath@cs.byu.edu, freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/31309: Running gdm causes a blank X sreen without a login box.
Date: Tue, 16 Oct 2001 06:50:18 +0300 (EEST)

 On Mon, 15 Oct 2001 17:34:59 -0700 (PDT), Heath Nielson wrote:
 > 
 > >Number:         31309
 > >Category:       ports
 > >Synopsis:       Running gdm causes a blank X sreen without a login box.
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       medium
 > >Responsible:    freebsd-ports
 > >State:          closed
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Mon Oct 15 17:40:01 PDT 2001
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Heath Nielson
 > >Release:        4.4-FreeBSD Stable
 > >Organization:
 > >Environment:
 > FreeBSD hershey.dyn.bar.net 4.4-STABLE FreeBSD 4.4-STABLE #1: Fri Oct 12 22:28:00 MDT 2001   heath@hershey.dyn.bar.net:/usr/src/sys/compile/HERSHEY  i386
 > >Description:
 > When gdm is run, a blank X screen appears.  The gdm login box doesn't appear and appears not to be running.  Users will be unable to login in.  This is due to the fact that gdm tries to set an environment variable "GDM_TIMED_LOGIN" with a NULL value.  This causes a Segmentation Fault on FreeBSD.  I'm not sure whether the value should be NULL or not, but by passing in a space rather than a NULL fixed the problem.  (Fix inspired from David Marker <marker_d@yahoo.com>)
 > 
 > Also there is a problem when gdm creates a local socket.  The sizeof() wasn't specified correctly causing a truncated filename to be created in the /tmp directory, when gdm tries to remove the file through an unlink() call, the unlink() fails and subsequent attempts to bind the local socket will fail with EADDRINUSE.
 
 Woohoo! Much needed fix. I'll test it today and commit if it works.
 
 > (BTW sorry for trashing the diffs by sending them through the web page, currently I have no other access to GNATS.)
 
 Not a big deal, though it might be a good idea to learn how to use send-pr(1) -
 it isn't a rocket science, really. :)
 
 -Maxim
State-Changed-From-To: open->closed 
State-Changed-By: sobomax 
State-Changed-When: Tue Oct 16 00:26:25 PDT 2001 
State-Changed-Why:  
Committed, big thanks to you for debugging and fixing this!!!! Please 
don't forget to submit your patches to the GNOME folks ass well via 
their bugzilla problem tracking system. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31309 
>Unformatted:
