Skip to content

Instantly share code, notes, and snippets.

@Habbie
Last active May 7, 2019 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Habbie/31a5a6a6dc15d1ba727fe3f1d23a968c to your computer and use it in GitHub Desktop.
Save Habbie/31a5a6a6dc15d1ba727fe3f1d23a968c to your computer and use it in GitHub Desktop.
diff --git a/pdns/dnsdistdist/tcpiohandler.cc b/pdns/dnsdistdist/tcpiohandler.cc
index 6e77c7840..a565e9d7d 100644
--- a/pdns/dnsdistdist/tcpiohandler.cc
+++ b/pdns/dnsdistdist/tcpiohandler.cc
@@ -236,6 +236,11 @@ public:
{
int res = SSL_accept(d_conn.get());
if (res == 1) {
+ const char *sni = SSL_get_servername(d_conn.get(), TLSEXT_NAMETYPE_host_name);
+ if(sni)
+ cerr<<"sni="<<sni<<endl;
+ else
+ cerr<<"no sni"<<endl;
return IOState::Done;
}
else if (res < 0) {
@@ -720,6 +725,12 @@ public:
do {
ret = gnutls_handshake(d_conn.get());
if (ret == GNUTLS_E_SUCCESS) {
+ char sni[1000];
+ size_t snilen=sizeof(sni);
+ unsigned int snitype;
+ int ret2 = gnutls_server_name_get(d_conn.get(), sni, &snilen, &snitype, 0);
+ if(!ret2) cerr<<"gnutls_server_name_get: ret2="<<ret2<<", snilen="<<snilen<<", snitype="<<snitype<<", sni="<<sni<<endl;
+ else cerr<<"no sni"<<endl;
return IOState::Done;
}
else if (ret == GNUTLS_E_AGAIN) {
@@ -1009,12 +1020,14 @@ bool TLSFrontend::setupTLS()
#ifdef HAVE_GNUTLS
if (d_provider == "gnutls") {
d_ctx = std::make_shared<GnuTLSIOCtx>(*this);
+ cerr<<"made gnutls context"<<endl;
return true;
}
#endif /* HAVE_GNUTLS */
#ifdef HAVE_LIBSSL
if (d_provider == "openssl") {
d_ctx = std::make_shared<OpenSSLTLSIOCtx>(*this);
+ cerr<<"made openssl context"<<endl;
return true;
}
#endif /* HAVE_LIBSSL */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment