[MDEV-3927] Add variable "have yassl" Created: 2012-12-10  Updated: 2012-12-18  Resolved: 2012-12-18

Status: Closed
Project: MariaDB Server
Component/s: None
Fix Version/s: 10.0.1

Type: Task Priority: Minor
Reporter: Georg Richter Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None


 Description   

Since OpenSSL and Yassl have different behaviors, it would be useful to determine if the server was compiled with OpenSSL or Yassl by having an additional variable "have_yassl".

Currently this can be done by checking status variable "SSL_accepts" which is always zero, since Yassl's openssl layer is not complete yet (SSL_CTX::IncrementStats is implememented, but not used). However this method is not transparent and will not work if Yassl got fixed/completed.

Example (server compiled with OpenSSL):

mysql> select * from global_variables where variable_name like '%ssl' \G;
*************************** 1. row ***************************
VARIABLE_NAME: HAVE_SSL
VARIABLE_VALUE: YES
*************************** 2. row ***************************
VARIABLE_NAME: HAVE_YASSL
VARIABLE_VALUE: NO
*************************** 3. row ***************************
 VARIABLE_NAME: HAVE_OPENSSL
VARIABLE_VALUE: YES
3 rows in set (0.01 sec)

Code: (diff against 5.5)

=== modified file 'sql/mysqld.cc'
--- sql/mysqld.cc	2012-11-22 09:19:31 +0000
+++ sql/mysqld.cc	2012-12-10 11:52:44 +0000
@@ -650,7 +650,7 @@
 MY_LOCALE *my_default_lc_messages;
 MY_LOCALE *my_default_lc_time_names;
 
-SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
+SHOW_COMP_OPTION have_ssl, have_yassl, have_symlink, have_dlopen, have_query_cache;
 SHOW_COMP_OPTION have_geometry, have_rtree_keys;
 SHOW_COMP_OPTION have_crypt, have_compress;
 SHOW_COMP_OPTION have_profiling;
@@ -4053,11 +4053,17 @@
       sql_print_warning("Failed to setup SSL");
       sql_print_warning("SSL error: %s", sslGetErrString(error));
       opt_use_ssl = 0;
+#ifdef HAVE_YASSL
+      have_yassl=
+#endif
       have_ssl= SHOW_OPTION_DISABLED;
     }
   }
   else
   {
+#ifdef HAVE_YASSL
+    have_yassl=
+#endif
     have_ssl= SHOW_OPTION_DISABLED;
   }
   if (des_key_file)
@@ -7060,8 +7066,7 @@
   {"Sort_range",	       (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS},
   {"Sort_rows",		       (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS},
   {"Sort_scan",		       (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
-#ifdef HAVE_OPENSSL
-#ifndef EMBEDDED_LIBRARY
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
   {"Ssl_accept_renegotiates",  (char*) &show_ssl_ctx_sess_accept_renegotiate, SHOW_FUNC},
   {"Ssl_accepts",              (char*) &show_ssl_ctx_sess_accept, SHOW_FUNC},
   {"Ssl_callback_cache_hits",  (char*) &show_ssl_ctx_sess_cb_hits, SHOW_FUNC},
@@ -7086,7 +7091,6 @@
   {"Ssl_verify_mode",          (char*) &show_ssl_get_verify_mode, SHOW_FUNC},
   {"Ssl_version",              (char*) &show_ssl_get_version, SHOW_FUNC},
 #endif
-#endif /* HAVE_OPENSSL */
   {"Syncs",                    (char*) &my_sync_count,          SHOW_LONG_NOFLUSH},
   /*
     Expression cache used only for caching subqueries now, so its statistic
@@ -7353,10 +7357,16 @@
     have_profiling = SHOW_OPTION_NO;
 #endif
 
+#if defined(HAVE_YASSL) && !defined(EMBEDDED_LIBRARY)
+  have_yassl=SHOW_OPTION_YES;
+#else
+  have_yassl=SHOW_OPTION_NO;
+#endif
+
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
   have_ssl=SHOW_OPTION_YES;
 #else
-  have_ssl=SHOW_OPTION_NO;
+  have_yassl= have_ssl=SHOW_OPTION_NO;
 #endif
 #ifdef HAVE_BROKEN_REALPATH
   have_symlink=SHOW_OPTION_NO;
 
=== modified file 'sql/set_var.h'
--- sql/set_var.h	2012-10-16 11:04:42 +0000
+++ sql/set_var.h	2012-12-10 10:27:22 +0000
@@ -291,7 +291,7 @@
 extern SHOW_COMP_OPTION have_ndbcluster, have_partitioning;
 extern SHOW_COMP_OPTION have_profiling;
 
-extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
+extern SHOW_COMP_OPTION have_ssl, have_yassl, have_symlink, have_dlopen;
 extern SHOW_COMP_OPTION have_query_cache;
 extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
 extern SHOW_COMP_OPTION have_crypt;
 
=== modified file 'sql/sys_vars.cc'
--- sql/sys_vars.cc	2012-10-18 21:33:06 +0000
+++ sql/sys_vars.cc	2012-12-10 10:26:20 +0000
@@ -3103,6 +3103,10 @@
        "have_openssl", "have_openssl",
        READ_ONLY GLOBAL_VAR(have_ssl), NO_CMD_LINE);
 
+static Sys_var_have Sys_have_yassl(
+       "have_yassl", "have_yassl",
+       READ_ONLY GLOBAL_VAR(have_yassl), NO_CMD_LINE);
+
 static Sys_var_have Sys_have_profiling(
        "have_profiling", "have_profiling",
        READ_ONLY GLOBAL_VAR(have_profiling), NO_CMD_LINE);



 Comments   
Comment by Sergei Golubchik [ 2012-12-18 ]

I think it's a bug that have_openssl is ON when OpenSSL is not used. That's what I'll fix. So, for YaSSL, have_ssl will be ON, but have_openssl will be OFF.

Comment by Sergei Golubchik [ 2012-12-18 ]

pushed into 10.0-base

Generated at Thu Feb 08 06:52:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.