Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
12dc142a
Commit
12dc142a
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Dominick Meglio host file path discovery patch for windows
parent
cb806708
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ares/CHANGES
+14
-0
14 additions, 0 deletions
ares/CHANGES
ares/ares_gethostbyaddr.c
+16
-5
16 additions, 5 deletions
ares/ares_gethostbyaddr.c
ares/ares_gethostbyname.c
+16
-6
16 additions, 6 deletions
ares/ares_gethostbyname.c
ares/ares_private.h
+2
-2
2 additions, 2 deletions
ares/ares_private.h
with
48 additions
and
13 deletions
ares/CHANGES
+
14
−
0
View file @
12dc142a
Changelog for the c-ares project
* September 26
- Dominick Meglio patched: C-ares on Windows assumed that the HOSTS file is
located in a static location. It assumed
C:\Windows\System32\Drivers\Etc. This is a poor assumption to make. In fact,
the location of the HOSTS file can be changed via a registry setting.
There is a key called DatabasePath which specifies the path to the HOSTS
file:
http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx
The patch will make c-ares correctly consult the registry for the location
of this file.
* August 29
- Gisle Vanem fixed the MSVC build files.
...
...
This diff is collapsed.
Click to expand it.
ares/ares_gethostbyaddr.c
+
16
−
5
View file @
12dc142a
...
...
@@ -150,12 +150,23 @@ static int file_lookup(struct in_addr *addr, struct hostent **host)
char
PATH_HOSTS
[
MAX_PATH
];
if
(
IsNT
)
{
GetSystemDirectory
(
PATH_HOSTS
,
MAX_PATH
);
strcat
(
PATH_HOSTS
,
PATH_HOSTS_NT
);
}
else
{
char
tmp
[
MAX_PATH
];
HKEY
hkeyHosts
;
if
(
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
WIN_NS_NT_KEY
,
0
,
KEY_READ
,
&
hkeyHosts
)
==
ERROR_SUCCESS
)
{
DWORD
dwLength
=
MAX_PATH
;
RegQueryValueEx
(
hkeyHosts
,
DATABASEPATH
,
NULL
,
NULL
,
tmp
,
&
dwLength
);
ExpandEnvironmentStrings
(
tmp
,
PATH_HOSTS
,
MAX_PATH
);
RegCloseKey
(
hkeyHosts
);
}
}
else
GetWindowsDirectory
(
PATH_HOSTS
,
MAX_PATH
);
strcat
(
PATH_HOSTS
,
PATH_HOSTS_9X
);
}
strcat
(
PATH_HOSTS
,
WIN_PATH_HOSTS
);
#elif defined(WATT32)
extern
const
char
*
_w32_GetHostsFile
(
void
);
...
...
This diff is collapsed.
Click to expand it.
ares/ares_gethostbyname.c
+
16
−
6
View file @
12dc142a
...
...
@@ -220,15 +220,25 @@ static int file_lookup(const char *name, struct hostent **host)
int
status
;
#ifdef WIN32
char
PATH_HOSTS
[
MAX_PATH
];
if
(
IsNT
)
{
GetSystemDirectory
(
PATH_HOSTS
,
MAX_PATH
);
strcat
(
PATH_HOSTS
,
PATH_HOSTS_NT
);
}
else
{
char
tmp
[
MAX_PATH
];
HKEY
hkeyHosts
;
if
(
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
WIN_NS_NT_KEY
,
0
,
KEY_READ
,
&
hkeyHosts
)
==
ERROR_SUCCESS
)
{
DWORD
dwLength
=
MAX_PATH
;
RegQueryValueEx
(
hkeyHosts
,
DATABASEPATH
,
NULL
,
NULL
,
tmp
,
&
dwLength
);
ExpandEnvironmentStrings
(
tmp
,
PATH_HOSTS
,
MAX_PATH
);
RegCloseKey
(
hkeyHosts
);
}
}
else
GetWindowsDirectory
(
PATH_HOSTS
,
MAX_PATH
);
strcat
(
PATH_HOSTS
,
PATH_HOSTS_9X
);
}
strcat
(
PATH_HOSTS
,
WIN_PATH_HOSTS
);
#elif defined(WATT32)
extern
const
char
*
_w32_GetHostsFile
(
void
);
...
...
This diff is collapsed.
Click to expand it.
ares/ares_private.h
+
2
−
2
View file @
12dc142a
...
...
@@ -46,8 +46,8 @@
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define NAMESERVER "NameServer"
#define DHCPNAMESERVER "DhcpNameServer"
#define
P
AT
H_HOSTS_NT "\\drivers\\etc\\hosts
"
#define PATH_HOSTS
_9X
"\\hosts"
#define
D
AT
ABASEPATH "DatabasePath
"
#define
WIN_
PATH_HOSTS "\\hosts"
#elif defined(WATT32)
...
...
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