Commit 102cabfe authored by tonu@x153.internalnet's avatar tonu@x153.internalnet
Browse files

Fixed compilation problems when HAVE_OPENSSL is not defined

parent 6e685042
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -377,6 +377,9 @@ sig_handler mysql_end(int sig)
{
  if (connected)
    mysql_close(&mysql);
  else
    mysql_ssl_clear(&mysql); /* SSL data structres should be freed 
				even if connection was not made */
#ifdef HAVE_READLINE
  if (!status.batch && !quick && !opt_html && !opt_xml)
  {
@@ -2204,6 +2207,9 @@ sql_real_connect(char *host,char *database,char *user,char *password,
    mysql_close(&mysql);
    connected= 0;
  }
  else
    mysql_ssl_clear(&mysql); /* SSL data structres should be freed 
				even if connection was not made */
  mysql_init(&mysql);
  if (opt_connect_timeout)
  {
+0 −3
Original line number Diff line number Diff line
@@ -256,13 +256,10 @@ unsigned long STDCALL mysql_thread_id(MYSQL *mysql);
const char * STDCALL mysql_character_set_name(MYSQL *mysql);

MYSQL *		STDCALL mysql_init(MYSQL *mysql);
#ifdef HAVE_OPENSSL
int		STDCALL mysql_ssl_set(MYSQL *mysql, const char *key,
				      const char *cert, const char *ca,
				      const char *capath);
char *		STDCALL mysql_ssl_cipher(MYSQL *mysql);
int		STDCALL mysql_ssl_clear(MYSQL *mysql);
#endif /* HAVE_OPENSSL */
my_bool		STDCALL mysql_change_user(MYSQL *mysql, const char *user, 
					  const char *passwd, const char *db);
MYSQL *		STDCALL mysql_real_connect(MYSQL *mysql, const char *host,
+12 −17
Original line number Diff line number Diff line
@@ -1359,16 +1359,19 @@ static void mysql_once_init()
#endif
}

#ifdef HAVE_OPENSSL
/**************************************************************************
** Fill in SSL part of MYSQL structure and set 'use_ssl' flag.
** NB! Errors are not reported until you do mysql_real_connect.
**************************************************************************/

int STDCALL
mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
              const char *ca, const char *capath)
mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
	const char *key __attribute__((unused)), 
	const char *cert __attribute__((unused)),
	const char *ca __attribute__((unused)), 
	const char *capath __attribute__((unused)))
{
#ifdef HAVE_OPENSSL
  mysql->options.ssl_key = key==0 ? 0 : my_strdup(key,MYF(0));
  mysql->options.ssl_cert = cert==0 ? 0 : my_strdup(cert,MYF(0));
  mysql->options.ssl_ca = ca==0 ? 0 : my_strdup(ca,MYF(0));
@@ -1376,28 +1379,20 @@ mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
  mysql->options.use_ssl = TRUE;
  mysql->connector_fd = (gptr)new_VioSSLConnectorFd(key, cert, ca, capath);
  DBUG_PRINT("info",("mysql_ssl_set, context: %p",((struct st_VioSSLConnectorFd *)(mysql->connector_fd))->ssl_context_));

#endif
  return 0;
}

/**************************************************************************
**************************************************************************

char * STDCALL
mysql_ssl_cipher(MYSQL *mysql)
{
  return (char *)mysql->net.vio->cipher_description();
}


**************************************************************************
/*
***************************************************************************
** Free strings in the SSL structure and clear 'use_ssl' flag.
** NB! Errors are not reported until you do mysql_real_connect.
**************************************************************************
*/
int STDCALL
mysql_ssl_clear(MYSQL *mysql)
mysql_ssl_clear(MYSQL *mysql __attribute__((unused)))
{
#ifdef HAVE_OPENSSL
  my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
  my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
  my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
@@ -1409,9 +1404,9 @@ mysql_ssl_clear(MYSQL *mysql)
  mysql->options.use_ssl = FALSE;
  my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR));
  mysql->connector_fd = 0;
#endif /* HAVE_OPENSSL */
  return 0;
}
#endif /* HAVE_OPENSSL */

/**************************************************************************
** Connect to sql server
+2 −0
Original line number Diff line number Diff line
@@ -1991,7 +1991,9 @@ The server will not act as a slave.");
    if(hEventShutdown) CloseHandle(hEventShutdown);
  }
#endif
#ifdef HAVE_OPENSSL
  my_free((gptr)ssl_acceptor_fd,MYF(0));
#endif /* HAVE_OPENSSL */
  /* Wait until cleanup is done */
  (void) pthread_mutex_lock(&LOCK_thread_count);
  while (!ready_to_exit)