diff options
author | Raimo Niskanen <[email protected]> | 2013-06-10 11:43:15 +0200 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2013-06-10 11:43:15 +0200 |
commit | 10671126a75d14977a769d9dfce461482093c5c8 (patch) | |
tree | e80ac8aaef51e9e1829623d6088a152a45da661c /lib/kernel/src/inet_hosts.erl | |
parent | a49832f74d364e01d9fb7a98caf3ca942a0a0341 (diff) | |
parent | 54240a5829cac17ea59eeeb16f343f3f2817d7b3 (diff) | |
download | otp-10671126a75d14977a769d9dfce461482093c5c8.tar.gz otp-10671126a75d14977a769d9dfce461482093c5c8.tar.bz2 otp-10671126a75d14977a769d9dfce461482093c5c8.zip |
Merge branch 'raimo/inet-gethostbyname-lowercase-search/OTP-10689' into maint
* raimo/inet-gethostbyname-lowercase-search/OTP-10689:
Add test cases for host lookup case (in)sensitivity
Improve case (in)sensitivity for host lookups
Diffstat (limited to 'lib/kernel/src/inet_hosts.erl')
-rw-r--r-- | lib/kernel/src/inet_hosts.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/kernel/src/inet_hosts.erl b/lib/kernel/src/inet_hosts.erl index df1d4fc0be..6e9719b4aa 100644 --- a/lib/kernel/src/inet_hosts.erl +++ b/lib/kernel/src/inet_hosts.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2009. All Rights Reserved. +%% Copyright Ericsson AB 1997-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -38,9 +38,12 @@ gethostbyname(_) -> {error, formerr}. gethostbyname(Name, Type) when is_list(Name), is_atom(Type) -> - case gethostbyname(Name, Type, inet_hosts_byname, inet_hosts_byaddr) of + %% Byname has lowercased names while Byaddr keep the name casing. + %% This is to be able to reconstruct the original /etc/hosts entry. + N = inet_db:tolower(Name), + case gethostbyname(N, Type, inet_hosts_byname, inet_hosts_byaddr) of false -> - case gethostbyname(Name, Type, + case gethostbyname(N, Type, inet_hosts_file_byname, inet_hosts_file_byaddr) of false -> {error,nxdomain}; |