@@ -827,9 +827,60 @@ static int test_cert_ip(MYSQL *my __attribute((unused)))
827827 return OK;
828828}
829829
830+ static int test_conc795(MYSQL *my __attribute__((unused)))
831+ {
832+ MYSQL *mysql= mysql_init(NULL);
833+ MYSQL_RES *res= NULL;
834+ int rc, ret= FAIL;
835+ MYSQL_ROW row;
836+
837+ set_verify(mysql, 0);
838+
839+ if (ma_is_ip_address(hostname))
840+ {
841+ diag("SNI test skipped (hostname = ip address");
842+ ret = SKIP;
843+ goto end;
844+ }
845+
846+ mysql_ssl_set(mysql, NULL, NULL, NULL, NULL, NULL);
847+
848+ if (!my_test_connect(mysql, hostname, username, password, schema,
849+ port, socketname, 0, 0))
850+ {
851+ diag("error: %s", mysql_error(mysql));
852+ goto end;
853+ }
854+
855+ rc= mysql_query(mysql, "SHOW STATUS LIKE 'Tls_sni_server_name'");
856+ check_mysql_rc(rc, mysql);
857+
858+ if (!(res = mysql_store_result(mysql)) || !(row = mysql_fetch_row(res)))
859+ {
860+ diag("Server doesn't support tls_sni_server_name");
861+ ret= SKIP;
862+ goto end;
863+ }
864+
865+ if (strcmp(row[1], hostname))
866+ {
867+ diag("SNI mismatch: %s != %s", hostname, row[1]);
868+ goto end;
869+ }
870+
871+ diag("SNI match: %s == %s", hostname, row[1]);
872+ ret= OK;
873+ end:
874+ if (res)
875+ mysql_free_result(res);
876+ mysql_close(mysql);
877+ return ret;
878+ }
879+
830880
831881struct my_tests_st my_tests[] = {
832882 /* Don't add test above, test_init needs to be run first */
883+ {"test_conc795", test_conc795, TEST_CONNECTION_NEW, 0, NULL, NULL},
833884 {"test_start_tls_server", test_start_tls_server, TEST_CONNECTION_NONE, 0, NULL, NULL},
834885 {"test_init", test_init, TEST_CONNECTION_NONE, 0, NULL, NULL},
835886 /* Here you can add more tests */
0 commit comments