VirtualBox

Changeset 30921 in vbox


Ignore:
Timestamp:
Jul 20, 2010 4:09:30 AM (15 years ago)
Author:
vboxsync
Message:

NAT/hostresolver: trim ending dots confusing host resolver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/libalias/alias_dns.c

    r28800 r30921  
    186186    struct hostent *h = NULL;
    187187    char cname[255];
     188    int cname_len = 0;
    188189
    189190    struct udphdr *udp = NULL;
     
    195196        return 0; /* this is respose */
    196197
     198    memset(cname, 0, sizeof(cname));
    197199    qw_qname = (char *)&hdr[1];
    198200    Assert((ntohs(hdr->X.qdcount) == 1));
     
    207209
    208210    QStr2CStr(qw_qname, cname, sizeof(cname));
     211    cname_len = RTStrNLen(cname, sizeof(cname));
     212    /* Some guests like win-xp adds _dot_ after host name
     213     * and after domain name (not passed with host resolver)
     214     * that confuses host resolver.
     215     */
     216    if (   cname_len > 2
     217        && cname[cname_len - 1] == '.'
     218        && cname[cname_len - 2] == '.')
     219    {
     220        cname[cname_len - 1] = 0;
     221        cname[cname_len - 2] = 0;
     222    }
    209223    h = gethostbyname(cname);
    210224    fprintf(stderr, "cname:%s\n", cname);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette