changes to make things work in the max version

parent 29ea2e56
......@@ -707,6 +707,32 @@ AC_DEFUN(MYSQL_CHECK_VIO, [
AC_SUBST([vio_libs])
])
AC_DEFUN(MYSQL_FIND_OPENSSL, [
for d in /usr/ssl/include /usr/local/ssl/include /usr/include/openssl \
/usr/include/ssl /opt/ssl/include /opt/openssl/include ; do
if test -f $d/ssl.h ; then
OPENSSL_INCLUDE=$d
fi
done
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
/usr/lib /opt/ssl/lib /opt/openssl/lib ; do
if test -f $d/libssl.a -o -f $d/libssl.so ; then
OPENSSL_LIB=$d
fi
done
if test -z "$OPENSSL_LIB" -o -z "$OPENSSL_INCLUDE" ; then
echo "Could not find an installation of OpenSSL"
if test -n "$OPENSSL_LIB" ; then
if test "$IS_LINUX" = "true"; then
echo "Looks like you've forgotted to install OpenSSL development RPM"
fi
fi
exit 1
fi
])
AC_DEFUN(MYSQL_CHECK_OPENSSL, [
AC_MSG_CHECKING(for OpenSSL)
......@@ -719,15 +745,15 @@ AC_MSG_CHECKING(for OpenSSL)
openssl_includes=""
if test "$openssl" = "yes"
then
if test -n "$vio_dir"
then
AC_MSG_RESULT(yes)
openssl_libs="-L/usr/local/ssl/lib -lssl -lcrypto"
openssl_includes="-I/usr/local/ssl/include"
AC_DEFINE(HAVE_OPENSSL)
else
AC_MSG_RESULT(disabled because --with-vio wasn not used)
fi
MYSQL_FIND_OPENSSL
#force VIO use
vio_dir="vio"
vio_libs="../vio/libvio.la"
AC_DEFINE(HAVE_VIO)
AC_MSG_RESULT(yes)
openssl_libs="-L$OPENSSL_LIB -lssl -lcrypto"
openssl_includes="-I$OPENSSL_INCLUDE"
AC_DEFINE(HAVE_OPENSSL)
else
AC_MSG_RESULT(no)
fi
......
......@@ -337,8 +337,10 @@ static void free_used_memory()
{
uint i;
DBUG_ENTER("free_used_memory");
#ifndef EMBEDDED_LIBRARY
if (manager)
mysql_manager_close(manager);
#endif
close_cons();
close_files();
hash_free(&var_hash);
......@@ -599,6 +601,7 @@ int open_file(const char* name)
return 0;
}
#ifndef EMBEDDED_LIBRARY
int do_server_start(struct st_query* q)
{
return do_server_op(q,"start");
......@@ -636,6 +639,7 @@ int do_server_op(struct st_query* q,const char* op)
return 0;
}
#endif
int do_source(struct st_query* q)
{
......@@ -1182,6 +1186,7 @@ char* safe_get_param(char* str, char** arg, const char* msg)
DBUG_RETURN(str);
}
#ifndef EMBEDDED_LIBRARY
void init_manager()
{
if (!(manager=mysql_manager_init(0)))
......@@ -1192,6 +1197,7 @@ void init_manager()
manager->last_errno);
}
#endif
int safe_connect(MYSQL* con, const char* host, const char* user,
const char* pass,
......@@ -2101,8 +2107,9 @@ int main(int argc, char** argv)
if (cur_file == file_stack)
*++cur_file = stdin;
*lineno=1;
#ifndef EMBEDDED_LIBRARY
init_manager();
#endif
if (!( mysql_init(&cur_con->mysql)))
die("Failed in mysql_init()");
cur_con->name = my_strdup("default", MYF(MY_WME));
......@@ -2134,8 +2141,10 @@ int main(int argc, char** argv)
case Q_DISABLE_QUERY_LOG: disable_query_log=1; break;
case Q_SOURCE: do_source(q); break;
case Q_SLEEP: do_sleep(q); break;
#ifndef EMBEDDED_LIBRARY
case Q_SERVER_START: do_server_start(q); break;
case Q_SERVER_STOP: do_server_stop(q); break;
#endif
case Q_INC: do_inc(q); break;
case Q_DEC: do_dec(q); break;
case Q_ECHO: do_echo(q); break;
......
......@@ -47,7 +47,7 @@ sqlsources = convert.cc derror.cc field.cc field_conv.cc filesort.cc \
hostname.cc init.cc \
item.cc item_buff.cc item_cmpfunc.cc item_create.cc \
item_func.cc item_strfunc.cc item_sum.cc item_timefunc.cc \
item_uniq.cc key.cc lock.cc log.cc log_event.cc md5.c \
item_uniq.cc key.cc lock.cc log.cc log_event.cc \
mini_client.cc net_pkg.cc net_serv.cc opt_ft.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc slave.cc sql_acl.cc \
sql_analyse.cc sql_base.cc sql_cache.cc sql_class.cc \
......@@ -65,7 +65,7 @@ sqlobjects = convert.lo derror.lo field.lo field_conv.lo filesort.lo \
hostname.lo init.lo \
item.lo item_buff.lo item_cmpfunc.lo item_create.lo \
item_func.lo item_strfunc.lo item_sum.lo item_timefunc.lo \
item_uniq.lo key.lo lock.lo log.lo log_event.lo md5.lo \
item_uniq.lo key.lo lock.lo log.lo log_event.lo \
mini_client.lo net_pkg.lo net_serv.lo opt_ft.lo opt_range.lo \
opt_sum.lo procedure.lo records.lo slave.lo sql_acl.lo \
sql_analyse.lo sql_base.lo sql_cache.lo sql_class.lo \
......
......@@ -1473,6 +1473,107 @@ get_info:
DBUG_RETURN(0);
}
/****************************************************************************
* A modified version of connect(). connect2() allows you to specify
* a timeout value, in seconds, that we should wait until we
* derermine we can't connect to a particular host. If timeout is 0,
* my_connect() will behave exactly like connect().
*
* Base version coded by Steve Bernacki, Jr. <steve@navinet.net>
*****************************************************************************/
int my_connect(my_socket s, const struct sockaddr *name, uint namelen,
uint timeout)
{
#if defined(__WIN__) || defined(OS2)
return connect(s, (struct sockaddr*) name, namelen);
#else
int flags, res, s_err;
SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
fd_set sfds;
struct timeval tv;
time_t start_time, now_time;
/* If they passed us a timeout of zero, we should behave
* exactly like the normal connect() call does.
*/
if (timeout == 0)
return connect(s, (struct sockaddr*) name, namelen);
flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */
#ifdef O_NONBLOCK
fcntl(s, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */
#endif
res = connect(s, (struct sockaddr*) name, namelen);
s_err = errno; /* Save the error... */
fcntl(s, F_SETFL, flags);
if ((res != 0) && (s_err != EINPROGRESS))
{
errno = s_err; /* Restore it */
return(-1);
}
if (res == 0) /* Connected quickly! */
return(0);
/* Otherwise, our connection is "in progress." We can use
* the select() call to wait up to a specified period of time
* for the connection to suceed. If select() returns 0
* (after waiting howevermany seconds), our socket never became
* writable (host is probably unreachable.) Otherwise, if
* select() returns 1, then one of two conditions exist:
*
* 1. An error occured. We use getsockopt() to check for this.
* 2. The connection was set up sucessfully: getsockopt() will
* return 0 as an error.
*
* Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk>
* who posted this method of timing out a connect() in
* comp.unix.programmer on August 15th, 1997.
*/
FD_ZERO(&sfds);
FD_SET(s, &sfds);
/*
* select could be interrupted by a signal, and if it is,
* the timeout should be adjusted and the select restarted
* to work around OSes that don't restart select and
* implementations of select that don't adjust tv upon
* failure to reflect the time remaining
*/
start_time = time(NULL);
for (;;)
{
tv.tv_sec = (long) timeout;
tv.tv_usec = 0;
if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0)
break;
now_time=time(NULL);
timeout-= (uint) (now_time - start_time);
if (errno != EINTR || (int) timeout <= 0)
return -1;
}
/* select() returned something more interesting than zero, let's
* see if we have any errors. If the next two statements pass,
* we've got an open socket!
*/
s_err=0;
if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0)
return(-1);
if (s_err)
{ /* getsockopt could succeed */
errno = s_err;
return(-1); /* but return an error... */
}
return(0); /* It's all good! */
#endif
}
int STDCALL
mysql_real_query(MYSQL *mysql, const char *query, uint length)
{
......
-- require r/have_bdb.require
disable_query_log;
show variables like "have_bdb";
enable_query_log;
-- require r/have_gemini.require
disable_query_log;
show variables like "have_gemini";
enable_query_log;
-- require r/have_innodb.require
disable_query_log;
show variables like "have_innodb";
enable_query_log;
-- require r/have_openssl.require
disable_query_log;
show variables like "have_openssl";
enable_query_log;
-- require r/have_openssl_1.require
disable_query_log;
show variables like "have_openssl";
enable_query_log;
-- require r/have_openssl_2.require
disable_query_log;
SHOW STATUS LIKE "SSL_get_cipher";
enable_query_log;
This diff is collapsed.
Variable_name Value
have_ssl YES
have_openssl YES
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment