Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
7111-Change-inet_parse-visible_string-1-to-allo...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 7111-Change-inet_parse-visible_string-1-to-allow-empty-st.patch of Package erlang
From 4f7049382757e6804e317b883547ce6b346816e6 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen <raimo@erlang.org> Date: Mon, 3 Apr 2023 16:35:33 +0200 Subject: [PATCH 1/4] Change inet_parse:visible_string/1 to allow empty string --- lib/kernel/src/inet.erl | 4 ++-- lib/kernel/src/inet_db.erl | 7 +++---- lib/kernel/src/inet_parse.erl | 13 ++++--------- lib/kernel/src/inet_res.erl | 4 ++-- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl index d836f6b367..55114ab7f9 100644 --- a/lib/kernel/src/inet.erl +++ b/lib/kernel/src/inet.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2020. All Rights Reserved. +%% Copyright Ericsson AB 1997-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -1513,7 +1513,7 @@ getaddrs_tm({A,B,C,D,E,F,G,H} = IP, Fam, _) -> getaddrs_tm(Address, Family, Timer) when is_atom(Address) -> getaddrs_tm(atom_to_list(Address), Family, Timer); getaddrs_tm(Address, Family, Timer) -> - case inet_parse:visible_string(Address) of + case inet_parse:visible_string(Address) andalso Address =/= "" of false -> {error,einval}; true -> diff --git a/lib/kernel/src/inet_db.erl b/lib/kernel/src/inet_db.erl index 408f563909..0dbfeb80ed 100644 --- a/lib/kernel/src/inet_db.erl +++ b/lib/kernel/src/inet_db.erl @@ -498,7 +498,7 @@ res_check_option(nameservers, NSs) -> res_check_option(alt_nameservers, NSs) -> res_check_list(NSs, fun res_check_ns/1); res_check_option(domain, Dom) -> - Dom =:= "" orelse inet_parse:visible_string(Dom); + inet_parse:visible_string(Dom); res_check_option(lookup, Methods) -> try lists_subtract(Methods, valid_lookup()) of [] -> true; @@ -550,7 +550,6 @@ res_check_ns({{A,B,C,D}, Port}) when ?ip(A,B,C,D), Port band 65535 =:= Port -> true; res_check_ns(_) -> false. -res_check_search("") -> true; res_check_search(Dom) -> inet_parse:visible_string(Dom). socks_option(server) -> db_get(socks5_server); @@ -1044,7 +1043,7 @@ handle_call(Request, From, #state{db=Db}=State) -> end; {set_hostname, Name} -> - case inet_parse:visible_string(Name) of + case inet_parse:visible_string(Name) andalso Name =/= "" of true -> ets:insert(Db, {hostname, Name}), {reply, ok, State}; diff --git a/lib/kernel/src/inet_parse.erl b/lib/kernel/src/inet_parse.erl index 31d759428d..9d54d2c6bd 100644 --- a/lib/kernel/src/inet_parse.erl +++ b/lib/kernel/src/inet_parse.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2021. All Rights Reserved. +%% Copyright Ericsson AB 1997-2023. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -386,14 +386,9 @@ port_proto([$/ | Proto], Port) when Port =/= 0 -> %% Check if a String is a string with visible characters #21..#7E %% visible_string(String) -> Bool %% -visible_string([H|T]) -> - is_vis1([H|T]); -visible_string(_) -> - false. - -is_vis1([C | Cs]) when C >= 16#21, C =< 16#7e -> is_vis1(Cs); -is_vis1([]) -> true; -is_vis1(_) -> false. +visible_string([C | Cs]) when C >= 16#21, C =< 16#7e -> visible_string(Cs); +visible_string([]) -> true; +visible_string(_) -> false. %% %% Check if a String is a domain name according to RFC XXX. diff --git a/lib/kernel/src/inet_res.erl b/lib/kernel/src/inet_res.erl index 4e7809564c..4e0888c62e 100644 --- a/lib/kernel/src/inet_res.erl +++ b/lib/kernel/src/inet_res.erl @@ -490,7 +490,7 @@ getbyname(Name, Type, Timeout) -> getbyname_tm(Name, Type, Timer) when is_list(Name) -> case type_p(Type) of true -> - case inet_parse:visible_string(Name) of + case inet_parse:visible_string(Name) andalso Name =/= "" of false -> {error, formerr}; true -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor