Repository: blackbeam/mysql_async (language: rust)

Issue:
skip_domain_validation not working when using rustls
TLS `skip_domain_validation` is not respected when using rustls.

[This line](https://github.com/blackbeam/mysql_async/blob/e480a019ea6edbe4de664c31708d480ba8173de5/src/io/tls/rustls_io.rs#L139) checks for `"CertNotValidForName"` string, but since rustls 0.21 the error is simply called `NotValidForName`, so the check fails and the connection cannot be completed.

Simply adjusting the checked string is sufficient to fix the issue.
skip_domain_validation not working when using rustls
TLS `skip_domain_validation` is not respected when using rustls.

[This line](https://github.com/blackbeam/mysql_async/blob/e480a019ea6edbe4de664c31708d480ba8173de5/src/io/tls/rustls_io.rs#L139) checks for `"CertNotValidForName"` string, but since rustls 0.21 the error is simply called `NotValidForName`, so the check fails and the connection cannot be completed.

Simply adjusting the checked string is sufficient to fix the issue.


Discussion / hints:

Fix patch:
diff --git a/src/io/tls/rustls_io.rs b/src/io/tls/rustls_io.rs
index a976b961..ceccc539 100644
--- a/src/io/tls/rustls_io.rs
+++ b/src/io/tls/rustls_io.rs
@@ -136,7 +136,7 @@ impl ServerCertVerifier for DangerousVerifier {
             ) {
                 Ok(assertion) => Ok(assertion),
                 Err(ref e)
-                    if e.to_string().contains("CertNotValidForName")
+                    if e.to_string().contains("NotValidForName")
                         && self.skip_domain_validation =>
                 {
                     Ok(rustls::client::ServerCertVerified::assertion())


Test patch: