summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmysql-test/mysql-test-run.pl4
-rw-r--r--mysql-test/r/information_schema.result5
-rw-r--r--mysql-test/r/information_schema_chmod.result5
-rw-r--r--mysql-test/t/information_schema.test9
-rw-r--r--mysql-test/t/information_schema_chmod.test20
-rw-r--r--vio/viossl.c60
-rw-r--r--vio/viosslfactories.c2
7 files changed, 59 insertions, 46 deletions
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 78a665d4f00..90155aee9d9 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -376,7 +376,6 @@ sub main () {
check_ndbcluster_support(); # We check whether to actually use it later
check_ssl_support();
- check_running_as_root();
environment_setup();
signal_setup();
@@ -1344,7 +1343,7 @@ sub kill_and_cleanup () {
sub check_running_as_root () {
# Check if running as root
# i.e a file can be read regardless what mode we set it to
- my $test_file= "test_running_as_root.txt";
+ my $test_file= "$opt_vardir/test_running_as_root.txt";
mtr_tofile($test_file, "MySQL");
chmod(oct("0000"), $test_file);
@@ -1661,6 +1660,7 @@ sub initialize_servers () {
save_installed_db();
}
}
+ check_running_as_root();
}
}
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index d5fb046d319..5224971890a 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1083,11 +1083,6 @@ DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
-create database mysqltest;
-create table mysqltest.t1(a int);
-select table_schema from information_schema.tables where table_schema='mysqltest';
-table_schema
-drop database mysqltest;
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
from information_schema.columns where
table_schema='information_schema' and
diff --git a/mysql-test/r/information_schema_chmod.result b/mysql-test/r/information_schema_chmod.result
new file mode 100644
index 00000000000..36124559439
--- /dev/null
+++ b/mysql-test/r/information_schema_chmod.result
@@ -0,0 +1,5 @@
+create database mysqltest;
+create table mysqltest.t1(a int);
+select table_schema from information_schema.tables where table_schema='mysqltest';
+table_schema
+drop database mysqltest;
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 90b0fd95eee..11178adbc9b 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -793,15 +793,6 @@ DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
-#
-# Bug #15851 Unlistable directories yield no info from information_schema
-#
-create database mysqltest;
-create table mysqltest.t1(a int);
---exec chmod -r $MYSQLTEST_VARDIR/master-data/mysqltest
-select table_schema from information_schema.tables where table_schema='mysqltest';
---exec chmod +r $MYSQLTEST_VARDIR/master-data/mysqltest
-drop database mysqltest;
#
# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test
new file mode 100644
index 00000000000..fb850b8e38d
--- /dev/null
+++ b/mysql-test/t/information_schema_chmod.test
@@ -0,0 +1,20 @@
+#
+# Due to "Bug#18474 Unlistable directories yield no info from
+# information_schema, part2" this test can't be run on Window with our
+# current test framework. When "chmod -r" is done within cygwin the
+# MySQL Server can still read the directory.
+# Manual testing shows the functionalty to skip unlistable directories
+# works on windows
+#
+--source include/not_windows.inc
+
+
+#
+# Bug #15851 Unlistable directories yield no info from information_schema
+#
+create database mysqltest;
+create table mysqltest.t1(a int);
+--exec chmod -r $MYSQLTEST_VARDIR/master-data/mysqltest
+select table_schema from information_schema.tables where table_schema='mysqltest';
+--exec chmod +r $MYSQLTEST_VARDIR/master-data/mysqltest
+drop database mysqltest;
diff --git a/vio/viossl.c b/vio/viossl.c
index 38654f05521..e869493c604 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -56,8 +56,10 @@ report_errors(SSL* ssl)
unsigned long l;
const char *file;
const char *data;
- int line,flags;
+ int line, flags;
+#ifndef DBUG_OFF
char buf[512];
+#endif
DBUG_ENTER("report_errors");
@@ -67,15 +69,11 @@ report_errors(SSL* ssl)
file,line,(flags&ERR_TXT_STRING)?data:"")) ;
}
-#ifdef HAVE_YASSL
- /*
- The above calls to ERR_* doesn't return any messages when we
- are using yaSSL since error is stored in the SSL object we used.
- */
if (ssl)
- DBUG_PRINT("error", ("yaSSL: %s", ERR_error_string(SSL_get_error(ssl, l), buf)));
-#endif
- DBUG_PRINT("info", ("errno: %d", socket_errno));
+ DBUG_PRINT("error", ("error: %s",
+ ERR_error_string(SSL_get_error(ssl, l), buf)));
+
+ DBUG_PRINT("info", ("socket_errno: %d", socket_errno));
DBUG_VOID_RETURN;
}
@@ -87,12 +85,11 @@ int vio_ssl_read(Vio *vio, gptr buf, int size)
DBUG_PRINT("enter", ("sd: %d, buf: 0x%p, size: %d, ssl_: 0x%p",
vio->sd, buf, size, vio->ssl_arg));
- if ((r= SSL_read((SSL*) vio->ssl_arg, buf, size)) < 0)
- {
- int err= SSL_get_error((SSL*) vio->ssl_arg, r);
- DBUG_PRINT("error",("SSL_read(): %d SSL_get_error(): %d", r, err));
+ r= SSL_read((SSL*) vio->ssl_arg, buf, size);
+#ifndef DBUG_OFF
+ if (r < 0)
report_errors((SSL*) vio->ssl_arg);
- }
+#endif
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
}
@@ -104,8 +101,11 @@ int vio_ssl_write(Vio *vio, const gptr buf, int size)
DBUG_ENTER("vio_ssl_write");
DBUG_PRINT("enter", ("sd: %d, buf: 0x%p, size: %d", vio->sd, buf, size));
- if ((r= SSL_write((SSL*) vio->ssl_arg, buf, size)) < 0)
+ r= SSL_write((SSL*) vio->ssl_arg, buf, size);
+#ifndef DBUG_OFF
+ if (r < 0)
report_errors((SSL*) vio->ssl_arg);
+#endif
DBUG_PRINT("exit", ("%d", r));
DBUG_RETURN(r);
}
@@ -142,7 +142,6 @@ int vio_ssl_close(Vio *vio)
int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
{
SSL *ssl;
- X509 *client_cert;
my_bool unused;
my_bool net_blocking;
enum enum_vio_type old_type;
@@ -183,6 +182,7 @@ int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
#ifndef DBUG_OFF
{
char buf[1024];
+ X509 *client_cert;
DBUG_PRINT("info",("cipher_name= '%s'", SSL_get_cipher_name(ssl)));
if ((client_cert= SSL_get_peer_certificate (ssl)))
@@ -217,7 +217,6 @@ int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
{
SSL *ssl;
- X509 *server_cert;
my_bool unused;
my_bool net_blocking;
enum enum_vio_type old_type;
@@ -255,20 +254,23 @@ int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
DBUG_RETURN(1);
}
#ifndef DBUG_OFF
- DBUG_PRINT("info",("cipher_name: '%s'" , SSL_get_cipher_name(ssl)));
-
- if ((server_cert= SSL_get_peer_certificate (ssl)))
{
- char buf[256];
- DBUG_PRINT("info",("Server certificate:"));
- X509_NAME_oneline(X509_get_subject_name(server_cert), buf, sizeof(buf));
- DBUG_PRINT("info",("\t subject: %s", buf));
- X509_NAME_oneline (X509_get_issuer_name(server_cert), buf, sizeof(buf));
- DBUG_PRINT("info",("\t issuer: %s", buf));
- X509_free (server_cert);
+ X509 *server_cert;
+ DBUG_PRINT("info",("cipher_name: '%s'" , SSL_get_cipher_name(ssl)));
+
+ if ((server_cert= SSL_get_peer_certificate (ssl)))
+ {
+ char buf[256];
+ DBUG_PRINT("info",("Server certificate:"));
+ X509_NAME_oneline(X509_get_subject_name(server_cert), buf, sizeof(buf));
+ DBUG_PRINT("info",("\t subject: %s", buf));
+ X509_NAME_oneline (X509_get_issuer_name(server_cert), buf, sizeof(buf));
+ DBUG_PRINT("info",("\t issuer: %s", buf));
+ X509_free (server_cert);
+ }
+ else
+ DBUG_PRINT("info",("Server does not have certificate."));
}
- else
- DBUG_PRINT("info",("Server does not have certificate."));
#endif
DBUG_RETURN(0);
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index f1d2b077367..058a19dfa0c 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -339,7 +339,7 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
Use the ssl_fd pointer
*/
SSL_CTX_set_session_id_context(ssl_fd->ssl_context,
- ssl_fd,
+ (const unsigned char *)ssl_fd,
sizeof(ssl_fd));
return ssl_fd;