25 const char *h =
static_cast<const char *
>(a);
26 const char *d =
static_cast<const char *
>(b);
27 debugs(28, 7,
"Match:" << h <<
" <> " << d);
37 debugs(28, 3,
"checking '" << host <<
"'");
39 char *h =
const_cast<char *
>(host);
42 debugs(28, 3,
"'" << host <<
"' " << (result ?
"found" :
"NOT found"));
44 return (result !=
nullptr);
51template<
class MatchType>
58 if (cn_data->length > (
int)
sizeof(cn) - 1)
61 char *s =
reinterpret_cast<char *
>(cn_data->data);
63 for (
int i = 0; i < cn_data->length; ++i, ++d, ++s) {
68 cn[cn_data->length] =
'\0';
69 debugs(28, 4,
"Verifying certificate name/subjectAltName " << cn);
78 const auto checklist =
Filled(ch);
80 assert(checklist !=
nullptr && checklist->request !=
nullptr);
82 const char *serverName =
nullptr;
85 const char *clientRequestedServerName =
nullptr;
86 clientSniKeeper =
conn->tlsClientSni();
87 if (clientSniKeeper.
isEmpty()) {
88 const char *host = checklist->request->url.host();
90 clientRequestedServerName = host;
92 clientRequestedServerName = clientSniKeeper.
c_str();
95 X509 *peer_cert =
conn->serverBump() ?
conn->serverBump()->serverCert.get() :
nullptr;
99 serverName = clientRequestedServerName;
101 serverName = clientRequestedServerName;
103 if (X509 *peer_cert = (
conn->serverBump() ?
conn->serverBump()->serverCert.get() :
nullptr))
106 serverName = clientRequestedServerName;
113 return data->match(serverName);
122 static const Acl::Options MyOptions = { &ClientRequested, &ServerProvided, &Consensus };
123 ClientRequested.
linkWith(&useClientRequested);
124 ServerProvided.
linkWith(&useServerProvided);
134 if (useClientRequested)
136 if (useServerProvided)
141 if (optionCount > 1) {
ACLFilledChecklist * Filled(ACLChecklist *checklist)
convenience and safety wrapper for dynamic_cast<ACLFilledChecklist*>
int check_cert_domain(void *check_data, ASN1_STRING *cn_data)
static int aclHostDomainCompare(char *const &a, char *const &b)
int conn
the current server connection FD
int matchDomainName(const char *h, const char *d, MatchDomainNameFlags flags)
Configured ACL parameter(s) (e.g., domain names in dstdomain ACL).
Splay< char * > * domains
bool match(const char *) override
std::unique_ptr< Parameters > data
const Acl::Options & options() override
Acl::BooleanOptionValue useConsensus
Ignore mismatching names.
bool valid() const override
Acl::BooleanOptionValue useClientRequested
Ignore server-supplied names.
Acl::BooleanOptionValue useServerProvided
Ignore client-supplied names.
int match(ACLChecklist *) override
Matches the actual data in checklist against this ACL.
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
Value const * find(FindValue const &, int(*compare)(FindValue const &a, Value const &b)) const
#define debugs(SECTION, LEVEL, CONTENT)
bool checkX509ServerValidity(X509 *cert, const char *server)
int matchX509CommonNames(X509 *peer_cert, void *check_data, int(*check_func)(void *check_data, ASN1_STRING *cn_data))
std::vector< const Option * > Options