Setting of DISPLAY Variable

Sturle Sunde sturle.sunde at usit.uio.no
Tue Aug 7 23:54:16 EST 2001


Damien Miller <djm at mindrot.org> writes:
> On Mon, 6 Aug 2001, Frank-M Mohr wrote:
>> I'm currently testing OpenSSH_2.9p2 on AIX.
>>
>> Is there any reason why the hostname is used for the DISPLAY
>> variable instead of localhost?
> 
> IIRC some broken X server detect "localhost" in $DISPLAY and force
> the use of a Unix socket.

X11R6.4 is the last release with this bug.  In xc/lib/X11/ConnDis.c:

 #ifdef LOCALCONN
    /* check if phostname == localnodename */
    if (phostname && uname(&sys) >= 0 &&
        !strncmp(phostname, sys.nodename, strlen(sys.nodename)))
    {
        Xfree (phostname);
        phostname = copystring ("unix", 4);
    }
 #endif

I added "&& idisplay == 0" to the if test above to fix this problem in
my X11R6.4, but that's a quick and dirty solution.  Newer releases use
this:

 #ifdef LOCALCONN
    /* check if phostname == localnodename AND protocol not specified */
    if (!pprotocol && phostname && uname(&sys) >= 0 &&
        !strncmp(phostname, sys.nodename, 
        (strlen(sys.nodename) < strlen(phostname) ? 
        strlen(phostname) : strlen(sys.nodename))))
    {
 #ifdef TCPCONN
        /*
         * We'll first attempt to connect using the local transport.  If
         * this fails (which is the case if sshd X protocol forwarding is
         * being used), retry using tcp and this hostname.
         */
        tcphostname = copystring(phostname, strlen(phostname));
 #endif
        Xfree (phostname);
        phostname = copystring ("unix", 4);
    }
 #endif



Anyone working with the exit status bug in OpenSSH?  My script for
deleting users fails randomly because of it, so it's critical! 8-)

-- 
Sturle      All eyes were on Ford Prefect. Some of them were on stalks.
~~~~~~           -- Douglas Adams, So long, and thanks for all the fish



More information about the openssh-unix-dev mailing list