HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

BUG REPORT: hfaxd dies when it can't resolve own hostname (4.0.8)



I don't read this list, just reporting a bug I found in hylafax 4.0.8

Symptoms: If the system cannot resolve it's own hostname into an
address, hfaxd will SEGV. Although I've pinpointed where the error is,
I'm unable to suggest a fix, because I don't understand how hfaxd uses this 
info. (Sorry) The error occurrs on line 95, of the
file InetFaxServer.c++ Here is the whole function:

InetFaxServer::InetFaxServer()
{
    usedefault = TRUE;
    swaitmax = 90;                      // wait at most 90 seconds
    swaitint = 5;                       // interval between retries

    memset(&data_dest, 0, sizeof (data_dest));
    data_dest.sin_family = AF_INET;

    hostent* hp = Socket::gethostbyname(hostname);
    if (hp != NULL)
        hostname = hp->h_name;
    struct in_addr in;

    memcpy(&in, hp->h_addr, sizeof (in));
                ^^^^^^^^^
	        This is the problem, if hp is null, this SEGV's

    hostaddr = inet_ntoa(in);

    fxAssert(_instance == NULL,
        "Cannot create multiple InetFaxServer instances");
    _instance = this;
}




Project hosted by iFAX Solutions