From 10344912d45747fc40cc07ae18c0b3753f4c545c Mon Sep 17 00:00:00 2001 From: harvey186 Date: Sat, 21 Oct 2023 11:14:38 +0200 Subject: [PATCH] 0002-hosts_toggle Change-Id: Ie3f634e545352fd1f45d54fb75e255afe430e2a3 --- getaddrinfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/getaddrinfo.cpp b/getaddrinfo.cpp index 064ff57..5177035 100644 --- a/getaddrinfo.cpp +++ b/getaddrinfo.cpp @@ -57,7 +57,7 @@ #include #include - +#include #include "Experiments.h" #include "netd_resolv/resolv.h" #include "res_comp.h" @@ -1548,6 +1548,9 @@ static struct addrinfo* getCustomHosts(const size_t netid, const char* _Nonnull static bool files_getaddrinfo(const size_t netid, const char* name, const addrinfo* pai, addrinfo** res) { + if ((android::base::GetIntProperty("persist.security.hosts_disable", 0) != 0) && (strcmp("localhost", name) != 0) && (strcmp("ip6-localhost", name) != 0)) + return false; + struct addrinfo sentinel = {}; struct addrinfo *p, *cur; FILE* hostf = nullptr; -- 2.34.1