Ejemplo n.º 1
0
ARRAY8Ptr
getLocalAddress (void)
{
    static int	haveLocalAddress;

    if (!haveLocalAddress)
    {
# if defined(IPv6) && defined(AF_INET6)
	struct addrinfo *ai;

	if (getaddrinfo(localHostname(), NULL, NULL, &ai) != 0) {
	    XdmcpAllocARRAY8 (&localAddress, 4);
	    localAddress.data[0] = 127;
	    localAddress.data[1] = 0;
	    localAddress.data[2] = 0;
	    localAddress.data[3] = 1;
	} else {
	    if (ai->ai_addr->sa_family == AF_INET) {
		XdmcpAllocARRAY8 (&localAddress, sizeof(struct in_addr));
		memcpy(localAddress.data,
		  &((struct sockaddr_in *)ai->ai_addr)->sin_addr,
		  sizeof(struct in_addr));
	    } else if (ai->ai_addr->sa_family == AF_INET6) {
		XdmcpAllocARRAY8 (&localAddress, sizeof(struct in6_addr));
		memcpy(localAddress.data,
		  &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr,
		  sizeof(struct in6_addr));
	    }
	    freeaddrinfo(ai);
	}
# else
	struct hostent	*hostent;

	hostent = gethostbyname (localHostname());
	if (hostent != NULL) {
	    XdmcpAllocARRAY8 (&localAddress, hostent->h_length);
	    memmove(localAddress.data, hostent->h_addr, hostent->h_length);
	} else {
	    /* Assume 127.0.0.1 */
	    XdmcpAllocARRAY8 (&localAddress, 4);
	    localAddress.data[0] = 127;
	    localAddress.data[1] = 0;
	    localAddress.data[2] = 0;
	    localAddress.data[3] = 1;
	}
# endif

    }
    return &localAddress;
}
Ejemplo n.º 2
0
void
XdmcpRegisterAuthentication (
    char    *name,
    int	    namelen,
    char    *data,
    int	    datalen,
    ValidatorFunc Validator,
    GeneratorFunc Generator,
    AddAuthorFunc AddAuth)
{
    int	    i;
    ARRAY8  AuthenticationName, AuthenticationData;
    static AuthenticationFuncsPtr	newFuncs;

    if (!XdmcpAllocARRAY8 (&AuthenticationName, namelen))
	return;
    if (!XdmcpAllocARRAY8 (&AuthenticationData, datalen))
    {
	XdmcpDisposeARRAY8 (&AuthenticationName);
	return;
    }
    for (i = 0; i < namelen; i++)
	AuthenticationName.data[i] = name[i];
    for (i = 0; i < datalen; i++)
	AuthenticationData.data[i] = data[i];
    if (!(XdmcpReallocARRAYofARRAY8 (&AuthenticationNames,
				     AuthenticationNames.length + 1) &&
	  XdmcpReallocARRAYofARRAY8 (&AuthenticationDatas,
				     AuthenticationDatas.length + 1) &&
	  (newFuncs = (AuthenticationFuncsPtr) xalloc (
			(AuthenticationNames.length + 1) * sizeof (AuthenticationFuncsRec)))))
    {
	XdmcpDisposeARRAY8 (&AuthenticationName);
	XdmcpDisposeARRAY8 (&AuthenticationData);
	return;
    }
    for (i = 0; i < AuthenticationNames.length - 1; i++)
	newFuncs[i] = AuthenticationFuncsList[i];
    newFuncs[AuthenticationNames.length-1].Validator = Validator;
    newFuncs[AuthenticationNames.length-1].Generator = Generator;
    newFuncs[AuthenticationNames.length-1].AddAuth = AddAuth;
    xfree (AuthenticationFuncsList);
    AuthenticationFuncsList = newFuncs;
    AuthenticationNames.data[AuthenticationNames.length-1] = AuthenticationName;
    AuthenticationDatas.data[AuthenticationDatas.length-1] = AuthenticationData;
}
Ejemplo n.º 3
0
static void ClientAddress(struct sockaddr *from, ARRAY8Ptr addr, /* return */
                          ARRAY8Ptr port,                        /* return */
                          CARD16 *type)                          /* return */
{
    int length, family;
    char *data;

    data = NetaddrPort((XdmcpNetaddr)from, &length);
    XdmcpAllocARRAY8(port, length);
    memmove(port->data, data, length);
    port->length = length;

    family = ConvertAddr((XdmcpNetaddr)from, &length, &data);
    XdmcpAllocARRAY8(addr, length);
    memmove(addr->data, data, length);
    addr->length = length;

    *type = family;
}
Ejemplo n.º 4
0
static HostEntry *
ReadHostEntry (FILE *file)
{
    char	    *hostOrAlias;
    HostEntry	    *h;
    struct hostent  *hostent;

tryagain:
    hostOrAlias = ReadWord (file, TRUE);
    if (!hostOrAlias)
	return NULL;
    h = (HostEntry *) malloc (sizeof (DisplayEntry));
    if (*hostOrAlias == ALIAS_CHARACTER)
    {
	h->type = HOST_ALIAS;
	h->entry.aliasName = malloc (strlen (hostOrAlias) + 1);
	if (!h->entry.aliasName) {
	    free ((char *) h);
	    return NULL;
	}
	strcpy (h->entry.aliasName, hostOrAlias);
    }
    else if (!strcmp (hostOrAlias, CHOOSER_STRING))
    {
	h->type = HOST_CHOOSER;
    }
    else if (!strcmp (hostOrAlias, BROADCAST_STRING))
    {
	h->type = HOST_BROADCAST;
    }
    else if (!strcmp (hostOrAlias, NOBROADCAST_STRING))
    {
	h->type = HOST_NOBROADCAST;
    }
    else
    {
	h->type = HOST_ADDRESS;
	hostent = gethostbyname (hostOrAlias);
	if (!hostent)
	{
	    Debug ("No such host %s\n", hostOrAlias);
	    LogError ("Access file \"%s\", host \"%s\" not found\n", accessFile, hostOrAlias);
	    free ((char *) h);
	    goto tryagain;
	}
	if (!XdmcpAllocARRAY8 (&h->entry.hostAddress, hostent->h_length))
	{
	    LogOutOfMem ("ReadHostEntry\n");
	    free ((char *) h);
	    return NULL;
	}
	memmove( h->entry.hostAddress.data, hostent->h_addr, hostent->h_length);
    }
    return h;
}
Ejemplo n.º 5
0
static void
XdmcpRegisterDisplayClass(const char *name, int length)
{
    int i;

    XdmcpDisposeARRAY8(&DisplayClass);
    if (!XdmcpAllocARRAY8(&DisplayClass, length))
        return;
    for (i = 0; i < length; i++)
        DisplayClass.data[i] = (CARD8) name[i];
}
Ejemplo n.º 6
0
static void
XdmcpRegisterManufacturerDisplayID(const char *name, int length)
{
    int i;

    XdmcpDisposeARRAY8(&ManufacturerDisplayID);
    if (!XdmcpAllocARRAY8(&ManufacturerDisplayID, length))
        return;
    for (i = 0; i < length; i++)
        ManufacturerDisplayID.data[i] = (CARD8) name[i];
}
Ejemplo n.º 7
0
void ForEachListenAddr (
    ListenFunc	listenfunction,
    ListenFunc	mcastfunction,
    void	**closure)
{
    DisplayEntry    *d;
    HostEntry	    *h;
    int		    listenFound = 0;

    for (d = database; d != NULL ; d = d->next)
    {
	if (d->type == DISPLAY_LISTEN) {
	    listenFound = 1;
	    h = d->hosts;
	    if (h != NULL) {
		(*listenfunction) (&h->entry.hostAddress, closure);
		for (h = h->next; h != NULL; h = h->next) {
		    (*mcastfunction) (&h->entry.hostAddress, closure);
		}
	    }
	}
    }
    if (!listenFound) {
	(*listenfunction) (NULL, closure);
# if defined(IPv6) && defined(AF_INET6) && defined(XDM_DEFAULT_MCAST_ADDR6)
	{   /* Join default IPv6 Multicast Group */

	    static ARRAY8	defaultMcastAddress;

	    if (defaultMcastAddress.length == 0) {
		struct in6_addr addr6;

		if (inet_pton(AF_INET6,XDM_DEFAULT_MCAST_ADDR6,&addr6) == 1) {
		    if (!XdmcpAllocARRAY8 (&defaultMcastAddress,
		      sizeof(struct in6_addr))) {
			LogOutOfMem ("ReadHostEntry\n");
			defaultMcastAddress.length = -1;
		    } else {
			memcpy(defaultMcastAddress.data, &addr6,
			  sizeof(struct in6_addr));
		    }
		} else {
		    defaultMcastAddress.length = -1;
		}
	    }
	    if ( defaultMcastAddress.length == sizeof(struct in6_addr) ) {
		(*mcastfunction) (&defaultMcastAddress, closure);
	    }
	}
# endif
    }
}
Ejemplo n.º 8
0
static Bool
XdmAuthenticationGenerator (ARRAY8Ptr privateData, ARRAY8Ptr outgoingData, 
    xdmOpCode packet_type)
{
    outgoingData->length = 0;
    outgoingData->data = 0;
    if (packet_type == REQUEST) {
	if (XdmcpAllocARRAY8 (outgoingData, 8))
	    XdmcpWrap ((unsigned char *)&rho, (unsigned char *)&privateKey,
		       outgoingData->data, 8);
    }
    return TRUE;
}
Ejemplo n.º 9
0
ARRAY8Ptr
getLocalAddress ()
{
    static int	haveLocalAddress;
    
    if (!haveLocalAddress)
    {
	struct hostent	*hostent;

	hostent = gethostbyname (localHostname());
	XdmcpAllocARRAY8 (&localAddress, hostent->h_length);
	bcopy (hostent->h_addr, localAddress.data, hostent->h_length);
    }
    return &localAddress;
}
Ejemplo n.º 10
0
ARRAY8Ptr
getLocalAddress(void)
{
    static int haveLocalAddress;

    if (!haveLocalAddress) {
#if defined(IPv6) && defined(AF_INET6)
        struct addrinfo *ai;

        if (getaddrinfo(localHostname(), 0, 0, &ai)) {
            XdmcpAllocARRAY8(&localAddress, 4);
            localAddress.data[0] = 127;
            localAddress.data[1] = 0;
            localAddress.data[2] = 0;
            localAddress.data[3] = 1;
        } else {
            if (ai->ai_family == AF_INET) {
                XdmcpAllocARRAY8(&localAddress, sizeof(struct in_addr));
                memcpy(localAddress.data,
                       &((struct sockaddr_in *)ai->ai_addr)->sin_addr,
                       sizeof(struct in_addr));
            } else /* if (ai->ai_family == AF_INET6) */ {
                XdmcpAllocARRAY8(&localAddress, sizeof(struct in6_addr));
                memcpy(localAddress.data,
                       &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr,
                       sizeof(struct in6_addr));
            }
            freeaddrinfo(ai);
#else
        struct hostent *hostent;

        if ((hostent = gethostbyname(localHostname()))) {
            XdmcpAllocARRAY8(&localAddress, hostent->h_length);
            memmove(localAddress.data, hostent->h_addr, hostent->h_length);
#endif
            haveLocalAddress = True;
        }
    }
    return &localAddress;
}


void
scanAccessDatabase(int force)
{
    struct _displayAddress *da;
    char *cptr;
    int nChars, i;

    debug("scanAccessDatabase\n");
    if (Setjmp(cnftalk.errjmp))
        return; /* may memleak */
    if (startConfig(GC_gXaccess, &accData->dep, force) <= 0)
        return;
    free(accData->hostList);
    accData->nHosts = gRecvInt();
    accData->nListens = gRecvInt();
    accData->nAliases = gRecvInt();
    accData->nAcls = gRecvInt();
    nChars = gRecvInt();
    if (!(accData->hostList = (HostEntry *)
              Malloc(accData->nHosts * sizeof(HostEntry) +
                     accData->nListens * sizeof(ListenEntry) +
                     accData->nAliases * sizeof(AliasEntry) +
                     accData->nAcls * sizeof(AclEntry) +
                     nChars))) {
        closeGetter();
        return;
    }
    accData->listenList = (ListenEntry *)(accData->hostList + accData->nHosts);
    accData->aliasList = (AliasEntry *)(accData->listenList + accData->nListens);
    accData->acList = (AclEntry *)(accData->aliasList + accData->nAliases);
    cptr = (char *)(accData->acList + accData->nAcls);
    for (i = 0; i < accData->nHosts; i++) {
        switch ((accData->hostList[i].type = gRecvInt())) {
        case HOST_ALIAS:
            accData->hostList[i].entry.aliasPattern = cptr;
            cptr += gRecvStrBuf(cptr);
            break;
        case HOST_PATTERN:
            accData->hostList[i].entry.hostPattern = cptr;
            cptr += gRecvStrBuf(cptr);
            break;
        case HOST_ADDRESS:
            da = &accData->hostList[i].entry.displayAddress;
            da->hostAddress.data = (unsigned char *)cptr;
            cptr += (da->hostAddress.length = gRecvArrBuf(cptr));
            switch (gRecvInt()) {
#ifdef AF_INET
            case AF_INET:
                da->connectionType = FamilyInternet;
                break;
#endif
#if defined(IPv6) && defined(AF_INET6)
            case AF_INET6:
                da->connectionType = FamilyInternet6;
                break;
#endif
#ifdef AF_DECnet
            case AF_DECnet:
                da->connectionType = FamilyDECnet;
                break;
#endif
/*#ifdef AF_UNIX
            case AF_UNIX:
#endif*/
            default:
                da->connectionType = FamilyLocal;
                break;
            }
            break;
        case HOST_BROADCAST:
            break;
        default:
            logError("Received unknown host type %d from config reader\n", accData->hostList[i].type);
            return;
        }
    }
    for (i = 0; i < accData->nListens; i++) {
        accData->listenList[i].iface = gRecvInt();
        accData->listenList[i].mcasts = gRecvInt();
        accData->listenList[i].nmcasts = gRecvInt();
    }
    for (i = 0; i < accData->nAliases; i++) {
        accData->aliasList[i].name = cptr;
        cptr += gRecvStrBuf(cptr);
        accData->aliasList[i].hosts = gRecvInt();
        accData->aliasList[i].nhosts = gRecvInt();
    }
    for (i = 0; i < accData->nAcls; i++) {
        accData->acList[i].entries = gRecvInt();
        accData->acList[i].nentries = gRecvInt();
        accData->acList[i].hosts = gRecvInt();
        accData->acList[i].nhosts = gRecvInt();
        accData->acList[i].flags = gRecvInt();
    }
}


/* Returns True if string is matched by pattern.  Does case folding.
 */
static int
patternMatch(const char *string, const char *pattern)
{
    int p, s;

    if (!string)
        string = "";

    for (;;) {
        s = *string++;
        switch (p = *pattern++) {
        case '*':
            if (!*pattern)
                return True;
            for (string--; *string; string++)
                if (patternMatch(string, pattern))
                    return True;
            return False;
        case '?':
            if (s == '\0')
                return False;
            break;
        case '\0':
            return s == '\0';
        case '\\':
            p = *pattern++;
            /* fall through */
        default:
            if (tolower(p) != tolower(s))
                return False;
        }
    }
}
Ejemplo n.º 11
0
static DisplayEntry *
ReadDisplayEntry (FILE *file)
{
    char	    *displayOrAlias;
    DisplayEntry    *d;
    struct _display *display;
    HostEntry	    *h, **prev;

tryagain:
    displayOrAlias = ReadWord (file, FALSE);
    if (!displayOrAlias)
	return NULL;
    d = malloc (sizeof (DisplayEntry));
    d->notAllowed = 0;
    d->notBroadcast = 0;
    d->chooser = 0;
    if (*displayOrAlias == ALIAS_CHARACTER)
    {
	d->type = DISPLAY_ALIAS;
	d->entry.aliasName = strdup (displayOrAlias);
	if (!d->entry.aliasName)
	{
	    free (d);
	    return NULL;
	}
    }
    else if (!strcmp(displayOrAlias, LISTEN_STRING))
    {
	d->type = DISPLAY_LISTEN;
    }
    else
    {
	if (*displayOrAlias == NEGATE_CHARACTER)
	{
	    d->notAllowed = 1;
	    ++displayOrAlias;
	}
	if (HasGlobCharacters (displayOrAlias))
	{
	    d->type = DISPLAY_PATTERN;
	    d->entry.displayPattern = strdup (displayOrAlias);
	    if (!d->entry.displayPattern)
	    {
		free (d);
		return NULL;
	    }
	}
	else
	{
	    void *addr = NULL;
	    size_t addr_length = 0;
	    int addrtype = 0;

# if defined(IPv6) && defined(AF_INET6)
	    struct addrinfo *ai = NULL;

	    if (getaddrinfo(displayOrAlias, NULL, NULL, &ai) == 0) {
		addrtype = ai->ai_addr->sa_family;
		if (addrtype == AF_INET) {
		    addr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr;
		    addr_length = sizeof(struct in_addr);
		} else if (addrtype == AF_INET6) {
		    addr = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
		    addr_length = sizeof(struct in6_addr);
		}
	    }
# else
	    struct hostent  *hostent;

	    if ((hostent = gethostbyname (displayOrAlias)) != NULL)
	    {
		Debug("ReadDisplayEntry: %s\n", displayOrAlias);
		addr = hostent->h_addr;
		addrtype = hostent->h_addrtype;
		addr_length = hostent->h_length;
	    }
# endif
	    if (addr == NULL)
	    {
		LogError ("Access file %s, display %s unknown\n", accessFile, displayOrAlias);
		free (d);
# if defined(IPv6) && defined(AF_INET6)
		if (ai)
		    freeaddrinfo(ai);
# endif
		goto tryagain;
	    }
	    d->type = DISPLAY_ADDRESS;
	    display = &d->entry.displayAddress;
	    if (!XdmcpAllocARRAY8 (&display->clientAddress, addr_length))
	    {
		free (d);
# if defined(IPv6) && defined(AF_INET6)
		if (ai)
		    freeaddrinfo(ai);
# endif
		return NULL;
	    }
	    memmove( display->clientAddress.data, addr, addr_length);
# if defined(IPv6) && defined(AF_INET6)
	    if (ai)
		freeaddrinfo(ai);
# endif
	    switch (addrtype)
	    {
# ifdef AF_UNIX
	    case AF_UNIX:
		display->connectionType = FamilyLocal;
		break;
# endif
# ifdef AF_INET
	    case AF_INET:
		display->connectionType = FamilyInternet;
		break;
# endif
# if defined(IPv6) && defined(AF_INET6)
	    case AF_INET6:
		display->connectionType = FamilyInternet6;
		break;
# endif
# ifdef AF_DECnet
	    case AF_DECnet:
		display->connectionType = FamilyDECnet;
		break;
# endif
	    default:
		display->connectionType = FamilyLocal;
		break;
	    }
	}
    }
    prev = &d->hosts;
    while ((h = ReadHostEntry (file)))
    {
	if (h->type == HOST_CHOOSER)
	{
	    FreeHostEntry (h);
	    d->chooser = 1;
	} else if (h->type == HOST_NOBROADCAST) {
	    FreeHostEntry (h);
	    d->notBroadcast = 1;
	} else if (h->type == HOST_ANYADDR) {
	    if (d->type == DISPLAY_LISTEN) {
		*prev = h;
		prev = &h->next;
	    } else {
		Debug("Wildcard host specified in Xaccess for type other than LISTEN -- ignoring\n");
		FreeHostEntry (h);
	    }
	} else {
	    *prev = h;
	    prev = &h->next;
	}
    }
    *prev = NULL;
    return d;
}
Ejemplo n.º 12
0
static HostEntry *
ReadHostEntry (FILE *file)
{
    char	    *hostOrAlias;
    HostEntry	    *h;

tryagain:
    hostOrAlias = ReadWord (file, TRUE);
    if (!hostOrAlias)
	return NULL;
    h = malloc (sizeof (DisplayEntry));
    h->hopCount = 1;
    if (*hostOrAlias == ALIAS_CHARACTER)
    {
	h->type = HOST_ALIAS;
	h->entry.aliasName = strdup (hostOrAlias);
	if (!h->entry.aliasName) {
	    free (h);
	    return NULL;
	}
    }
    else if (!strcmp (hostOrAlias, CHOOSER_STRING))
    {
	h->type = HOST_CHOOSER;
    }
    else if (!strcmp (hostOrAlias, BROADCAST_STRING))
    {
	h->type = HOST_BROADCAST;
    }
    else if (!strcmp (hostOrAlias, NOBROADCAST_STRING))
    {
	h->type = HOST_NOBROADCAST;
    }
    else if (!strcmp (hostOrAlias, WILDCARD_STRING))
    {
	h->type = HOST_ANYADDR;
	h->entry.hostAddress.length = 0;
    }
    else
    {
	void *addr=NULL;
	size_t addr_length=0;
# if defined(IPv6) && defined(AF_INET6)
	struct addrinfo *ai = NULL;
# else
	struct hostent  *hostent = gethostbyname (hostOrAlias);
# endif
	char *hops = strrchr(hostOrAlias, '/');

	if (hops) {
	    *(hops++) = '\0';
	    h->hopCount = strtol(hops, NULL, 10);
	    if (h->hopCount < 1)
		h->hopCount = 1;
	}

# if defined(IPv6) && defined(AF_INET6)
	if (getaddrinfo(hostOrAlias, NULL, NULL, &ai) == 0) {
	    if (ai->ai_addr->sa_family == AF_INET) {
		addr = &((struct sockaddr_in *)ai->ai_addr)->sin_addr;
		addr_length = sizeof(struct in_addr);
	    } else if (ai->ai_addr->sa_family == AF_INET6) {
		addr = &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
		addr_length = sizeof(struct in6_addr);
	    }
	}
# else
	if (hostent) {
	    addr = hostent->h_addr;
	    addr_length = hostent->h_length;
	}
# endif
	h->type = HOST_ADDRESS;

	if (!addr)
	{
	    Debug ("No such host %s\n", hostOrAlias);
	    LogError ("Access file \"%s\", host \"%s\" not found\n", accessFile, hostOrAlias);
	    free (h);
# if defined(IPv6) && defined(AF_INET6)
	    if (ai)
		freeaddrinfo(ai);
# endif
	    goto tryagain;
	}
	if (!XdmcpAllocARRAY8 (&h->entry.hostAddress, addr_length))
	{
	    LogOutOfMem ("ReadHostEntry\n");
	    free (h);
# if defined(IPv6) && defined(AF_INET6)
	    if (ai)
		freeaddrinfo(ai);
# endif
	    return NULL;
	}
	memmove( h->entry.hostAddress.data, addr, addr_length);
# if defined(IPv6) && defined(AF_INET6)
	if (ai)
	    freeaddrinfo(ai);
# endif
    }
    return h;
}
Ejemplo n.º 13
0
static DisplayEntry *
ReadDisplayEntry (FILE *file)
{
    char	    *displayOrAlias;
    DisplayEntry    *d;
    struct _display *display;
    HostEntry	    *h, **prev;
    struct hostent  *hostent;
    
    displayOrAlias = ReadWord (file, FALSE);
    if (!displayOrAlias)
    	return NULL;
    d = (DisplayEntry *) malloc (sizeof (DisplayEntry));
    d->notAllowed = 0;
    d->notBroadcast = 0;
    d->chooser = 0;
    if (*displayOrAlias == ALIAS_CHARACTER)
    {
	d->type = DISPLAY_ALIAS;
	d->entry.aliasName = malloc (strlen (displayOrAlias) + 1);
	if (!d->entry.aliasName)
	{
	    free ((char *) d);
	    return NULL;
	}
	strcpy (d->entry.aliasName, displayOrAlias);
    }
    else
    {
	if (*displayOrAlias == NEGATE_CHARACTER)
	{
	    d->notAllowed = 1;
	    ++displayOrAlias;
	}
    	if (HasGlobCharacters (displayOrAlias))
    	{
	    d->type = DISPLAY_PATTERN;
	    d->entry.displayPattern = malloc (strlen (displayOrAlias) + 1);
	    if (!d->entry.displayPattern)
	    {
	    	free ((char *) d);
	    	return NULL;
	    }
	    strcpy (d->entry.displayPattern, displayOrAlias);
    	}
    	else
    	{
	    if ((hostent = gethostbyname (displayOrAlias)) == NULL)
	    {
		LogError ("Access file %s, display %s unknown\n", accessFile, displayOrAlias);
		free ((char *) d);
		return NULL;
	    }
	    d->type = DISPLAY_ADDRESS;
	    display = &d->entry.displayAddress;
	    if (!XdmcpAllocARRAY8 (&display->clientAddress, hostent->h_length))
	    {
	    	free ((char *) d);
	    	return NULL;
	    }
	    memmove( display->clientAddress.data, hostent->h_addr, hostent->h_length);
	    switch (hostent->h_addrtype)
	    {
#ifdef AF_UNIX
	    case AF_UNIX:
	    	display->connectionType = FamilyLocal;
	    	break;
#endif
#ifdef AF_INET
	    case AF_INET:
	    	display->connectionType = FamilyInternet;
	    	break;
#endif
#ifdef AF_DECnet
	    case AF_DECnet:
	    	display->connectionType = FamilyDECnet;
	    	break;
#endif
	    default:
	    	display->connectionType = FamilyLocal;
	    	break;
	    }
    	}
    }
    prev = &d->hosts;
    while ((h = ReadHostEntry (file)))
    {
	if (h->type == HOST_CHOOSER)
	{
	    FreeHostEntry (h);
	    d->chooser = 1;
	} else if (h->type == HOST_NOBROADCAST) {
	    FreeHostEntry (h);
	    d->notBroadcast = 1;
	} else {
	    *prev = h;
	    prev = &h->next;
	}
    }
    *prev = NULL;
    return d;
}