Branch: Tag:

1997-12-11

1997-12-11 02:13:44 by David Hedbor <david@hedbor.org>

Added workaround for mysterious bug (72312 (#72312) @ InfoKOM).

Rev: lib/modules/Protocols.pmod/DNS.pmod:1.6

212:    inherit protocol;       string nameserver; -  array search = ({}); +  array domains = ({});    void create(void|string server)    {    if(!server)
236:    case "search":    rest = replace(rest, "\t", " ");    foreach(rest / " " - ({""}), string dom) -  search += ({dom}); +  domains += ({dom});    break;       case "nameserver":
245:    }    }    if(domain) -  search = ({ domain }) + search; +  domains = ({ domain }) + domains;    } else {    nameserver=server;    }
272:    mixed *gethostbyname(string s)    {    mapping m; -  if(sizeof(search) && s[-1] != '.' && sizeof(s/".") < 3) { +  if(sizeof(domains) && s[-1] != '.' && sizeof(s/".") < 3) {    m=do_sync_query(mkquery(s, C_IN, T_A));    if(!m || !m->an || !sizeof(m->an)) -  foreach(search, string domain) +  foreach(domains, string domain)    {    m=do_sync_query(mkquery(s+"."+domain, C_IN, T_A));    if(m && m->an && sizeof(m->an))
337:    string get_primary_mx(string host)    {    mapping m; -  if(sizeof(search) && host[-1] != '.' && sizeof(host/".") < 3) { +  if(sizeof(domains) && host[-1] != '.' && sizeof(host/".") < 3) {    m=do_sync_query(mkquery(host, C_IN, T_MX));    if(!m || !m->an || !sizeof(m->an)) -  foreach(search, string domain) +  foreach(domains, string domain)    {    m=do_sync_query(mkquery(host+"."+domain, C_IN, T_MX));    if(m && m->an && sizeof(m->an))
445:    {    if(!answer || !answer->an || !sizeof(answer->an))    { -  if(multi == -1 || sizeof(search) < multi) { +  if(multi == -1 || multi >= sizeof(domains)) {    // Either a request without multi (ip, or FQDN) or we have tried all    // domains.    callback(domain,0,@args);    } else {    // Multiple domain request. Try the next one... -  do_query(domain+"."+search[multi], C_IN, T_A, +  do_query(domain+"."+domains[multi], C_IN, T_A,    generic_get, ++multi, "a", domain, callback, @args);    }    } else {
468:       void host_to_ip(string host, function callback, mixed ... args)    { -  if(sizeof(search) && host[-1] != '.' && sizeof(host/".") < 3) { +  if(sizeof(domains) && host[-1] != '.' && sizeof(host/".") < 3) {    do_query(host, C_IN, T_A,    generic_get, 0, "a", host, callback, @args );    } else {