pike.git / lib / modules / Protocols.pmod / DNS.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:213:       static private int is_ip(string ip)    {    return(replace(ip,    ({ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "." }),    ({ "", "", "", "", "", "", "", "", "", "", "" })) == "");    }       static private mapping etc_hosts;    + #ifdef __NT__ +  string get_tcpip_param(string val) +  { +  foreach(({ +  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", +  "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP" +  }),string key) +  { +  catch { +  return RegGetValue(HKEY_LOCAL_MACHINE, key, value); +  }; +  } +  } + #endif +     static private string match_etc_hosts(string host)    {    if (!etc_hosts) {    string raw;   #ifdef __NT__ -  raw = RegGetValue(HKEY_LOCAL_MACHINE, -  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", -  "DataBasePath"); -  raw+="\\hosts"; +  raw=get_tcpip_param("DataBasePath")+"\\hosts";   #else    raw="/etc/hosts";   #endif    raw = Stdio.read_file(raw);       etc_hosts = ([ "localhost":"127.0.0.1" ]);       if (raw) {    foreach(raw/"\n", string line) {    // Handle comments, and split the line on white-space
pike.git/lib/modules/Protocols.pmod/DNS.pmod:260:    }       array(string) nameservers = ({});    array domains = ({});    void create(void|string server)    {    if(!server)    {    string domain;   #if __NT__ -  domain=RegGetValue(HKEY_LOCAL_MACHINE, -  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", -  "Domain"); -  nameservers = ({ RegGetValue(HKEY_LOCAL_MACHINE, -  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", -  "NameServer") }); -  domains=RegGetValue(HKEY_LOCAL_MACHINE, -  "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", -  "SearchList") / " "- ({""}); +  +  +  domain=get_tcpip_param("Domain"); +  nameservers = ({ get_tcpip_param("NameServer") }); +  domains=get_tcpip_param("SearchList") / " "- ({""});   #else    string resolv_conf = Stdio.read_file("/etc/resolv.conf");       if (!resolv_conf) {    throw(({ "Protocols.DNS.client(): No /etc/resolv.conf!\n",    backtrace() }));    }       foreach(resolv_conf/"\n", string line)    {