27 const char *h =
static_cast<const char *
>(a);
28 const char *d =
static_cast<const char *
>(b);
29 debugs(28, 7,
"Match:" << h <<
" <> " << d);
39 debugs(28, 3,
"checking '" << host <<
"'");
41 char *h =
const_cast<char *
>(host);
44 debugs(28, 3,
"'" << host <<
"' " << (result ?
"found" :
"NOT found"));
46 return (result !=
nullptr);
92 (void)ip.
toStr(hostStr,
sizeof(hostStr));
93 return parameters.match(hostStr);
99 const auto checklist =
Filled(ch);
101 assert(checklist !=
nullptr && checklist->request !=
nullptr);
103 std::optional<AnyP::Host> serverNameFromConn;
105 std::optional<AnyP::Host> clientRequestedServerName;
106 const auto &clientSni = conn->tlsClientSni();
107 if (clientSni.isEmpty()) {
108 clientRequestedServerName = checklist->request->url.parsedHost();
118 X509 *peer_cert = conn->serverBump() ? conn->serverBump()->serverCert.get() :
nullptr;
121 if (!peer_cert || !clientRequestedServerName ||
123 serverNameFromConn = clientRequestedServerName;
124 }
else if (useClientRequested)
125 serverNameFromConn = clientRequestedServerName;
127 if (X509 *peer_cert = (conn->serverBump() ? conn->serverBump()->serverCert.get() :
nullptr))
129 if (!useServerProvided)
130 serverNameFromConn = clientRequestedServerName;
134 std::optional<SBuf> printedServerName;
135 if (serverNameFromConn)
136 printedServerName =
ToSBuf(*serverNameFromConn);
137 const auto serverName = printedServerName ? printedServerName->c_str() :
"none";
138 return data->match(serverName);
147 static const Acl::Options MyOptions = { &ClientRequested, &ServerProvided, &Consensus };
148 ClientRequested.
linkWith(&useClientRequested);
149 ServerProvided.
linkWith(&useServerProvided);
159 if (useClientRequested)
161 if (useServerProvided)
166 if (optionCount > 1) {
static int aclHostDomainCompare(char *const &a, char *const &b)
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
static int aclHostDomainCompare(char *const &a, char *const &b)
int matchDomainName(const char *h, const char *d, MatchDomainNameFlags flags)
Configured ACL parameter(s) (e.g., domain names in dstdomain ACL).
bool match(const char *) override
const Acl::Options & options() override
bool valid() const override
int match(ACLChecklist *) override
Matches the actual data in checklist against this Acl::Node.
GeneralNameMatcher for matching configured ACL parameters.
ServerNameMatcher(ServerNameCheck::Parameters &p)
bool matchIp(const Ip::Address &) const override
ServerNameCheck::Parameters & parameters
configured ACL parameters
bool matchDomainName(const Dns::DomainName &) const override
a type-specific Option (e.g., a boolean –toggle or -m=SBuf)
void linkWith(Recipient *recipient) const
who to tell when this option is enabled
static std::optional< Host > ParseSimpleDomainName(const SBuf &)
char * toStr(char *buf, const unsigned int blen, int force=AF_UNSPEC) const
Value const * find(FindValue const &, int(*compare)(FindValue const &a, Value const &b)) const
an algorithm for checking/testing/comparing X.509 certificate names
#define debugs(SECTION, LEVEL, CONTENT)
#define MAX_IPSTRLEN
Length of buffer that needs to be allocated to old a null-terminated IP-string.
std::vector< const Option * > Options
bool HasMatchingSubjectName(X509 &, const GeneralNameMatcher &)
bool HasSubjectName(X509 &, const AnyP::Host &)
whether at least one common or alternate subject name matches the given one
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf