That seems to leave the the local_client flag set to UNKNOWN instead of
REMOTE for the case that LocalClient doesn't match anything and falls
through to the return FALSE; at the end.

I'd also be tempted to simplify the logic and reduce duplication a bit
while fixing that:

Bool LocalClient(ClientPtr client)
{
    int                 alen, family, notused;
    Xtransaddr          *from = NULL;
    pointer             addr;
    register HOST       *host;

    oc = client->osPrivate;
    if (!oc || !oc->trans_conn)
        return FALSE;

    if (oc->local_client == LOCAL_CLIENT_UNKNOWN)
    {
        oc->local_client = LOCAL_CLIENT_REMOTE;
        if (!_XSERVTransGetPeerAddr (oc->trans_conn, &notused, &alen, &from))
        {
            family = ConvertAddr ((struct sockaddr *) from,
                                  &alen, (pointer *)&addr);
            if (family == FamilyLocal)
            {
                oc->local_client = LOCAL_CLIENT_LOCAL;
            }
            else if (family != -1)
            {
                for (host = selfhosts; host; host = host->next)
                {
                    if (addrEqual (family, addr, alen, host))
                    {
                        oc->local_client = LOCAL_CLIENT_LOCAL;
                        break;
                    }
                }
            }
            free(from);
        }
    }
    return (oc->local_client == LOCAL_CLIENT_LOCAL) ? TRUE : FALSE;
}


(Quickly thrown together in e-mail, not even checked to see if it compiles.)

-- 
        -Alan Coopersmith-        [email protected]
         Oracle Solaris Platform Engineering: X Window System

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to