MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / tlsValidateCertificateName

Function tlsValidateCertificateName

src/tls.cpp:655–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655bool tlsValidateCertificateName(tls_connection* conn){
656 const char* cn = "";
657 if (tlsCheckCertificateAgainstAllowlist(conn, g_pserver->tls_allowlist, &cn)) {
658 return true;
659 } else {
660 /* If neither the CN nor the SANs match, update the SSL error and return false */
661 conn->c.last_errno = 0;
662 if (conn->ssl_error) zfree(conn->ssl_error);
663 size_t bufsize = 512;
664 conn->ssl_error = (char*)zmalloc(bufsize);
665 snprintf(conn->ssl_error, bufsize, "Client CN (%s) and SANs not found in allowlist.", cn);
666 return false;
667 }
668}
669
670static connection *createTLSConnection(int client_side) {
671 SSL_CTX *ctx = redis_tls_ctx;

Callers 1

tlsHandleEventFunction · 0.85

Calls 3

zfreeFunction · 0.85
zmallocFunction · 0.85

Tested by

no test coverage detected