Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
37ffea61
Commit
37ffea61
authored
26 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
modified to handle W95 (I hope)
Rev: lib/modules/Protocols.pmod/DNS.pmod:1.12
parent
790a05ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Protocols.pmod/DNS.pmod
+46
-38
46 additions, 38 deletions
lib/modules/Protocols.pmod/DNS.pmod
with
46 additions
and
38 deletions
lib/modules/Protocols.pmod/DNS.pmod
+
46
−
38
View file @
37ffea61
...
...
@@ -220,44 +220,56 @@ class client {
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;
{
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";
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
line = lower_case(replace((line/"#")[0], "\t", " "));
array arr = (line/" ") - ({ "" });
if (sizeof(arr) > 1) {
if (is_ip(arr[0])) {
foreach(arr[1..], string name) {
etc_hosts[name] = arr[0];
}
} else {
// Bad /etc/hosts entry ignored.
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
line = lower_case(replace((line/"#")[0], "\t", " "));
array arr = (line/" ") - ({ "" });
if (sizeof(arr) > 1) {
if (is_ip(arr[0])) {
foreach(arr[1..], string name) {
etc_hosts[name] = arr[0];
}
} else {
// Bad /etc/hosts entry ignored.
}
}
}
} else {
// Couldn't read /etc/hosts.
}
} else {
// Couldn't read /etc/hosts.
}
return(etc_hosts[lower_case(host)]);
}
return(etc_hosts[lower_case(host)]);
}
array(string) nameservers = ({});
array domains = ({});
...
...
@@ -267,15 +279,11 @@ class client {
{
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");
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment