diff --git a/etc/postinst.in b/etc/postinst.in index f4c8673a7..8cbb9bea6 100755 --- a/etc/postinst.in +++ b/etc/postinst.in @@ -46,15 +46,23 @@ then if [ -d "/lib/systemd/system" ] then cp @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/maxscale.service /lib/systemd/system - mkdir -p /lib/systemd/system/maxscale.service.d systemctl daemon-reload elif [ -d "/usr/lib/systemd/system" ] then cp @CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/maxscale.service /usr/lib/systemd/system - mkdir -p /usr/lib/systemd/system/maxscale.service.d systemctl daemon-reload fi + # Remove old directories, mistakenly installed by a few versions + if [ -d /lib/systemd/system/maxscale.service.d ] + then + rmdir /lib/systemd/system/maxscale.service.d + elif [ -d /usr/lib/systemd/system/maxscale.service.d ] + then + rmdir /lib/systemd/system/maxscale.service.d + fi + + mkdir -p /etc/systemd/system/maxscale.service.d systemctl enable maxscale.service else if [ -d "/etc/init/" ] && [ -f "@CMAKE_INSTALL_PREFIX@/@MAXSCALE_SHAREDIR@/upstart/maxscale.conf" ] diff --git a/etc/postrm.in b/etc/postrm.in index 5e477037e..a11ffb66d 100755 --- a/etc/postrm.in +++ b/etc/postrm.in @@ -17,11 +17,13 @@ then if [ -f /usr/lib/systemd/system/maxscale.service ] then - systemd stop maxscale.service + systemctl stop maxscale.service + systemctl disable maxscale.service rm /usr/lib/systemd/system/maxscale.service elif [ -f /lib/systemd/system/maxscale.service ] then - systemd stop maxscale.service + systemctl stop maxscale.service + systemctl disable maxscale.service rm /lib/systemd/system/maxscale.service fi diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 6fce7dfc6..1b5175425 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -564,11 +564,11 @@ int dcb_read(DCB* dcb, else { GWBUF* buffer; - dcb->last_read = mxs_clock(); buffer = dcb_basic_read(dcb, bytes_available, maxbytes, nreadtotal, &nsingleread); if (buffer) { + dcb->last_read = mxs_clock(); nreadtotal += nsingleread; MXS_DEBUG("Read %d bytes from dcb %p in state %s fd %d.", nsingleread, @@ -718,19 +718,19 @@ static int dcb_read_SSL(DCB* dcb, GWBUF** head) dcb_drain_writeq(dcb); } - dcb->last_read = mxs_clock(); buffer = dcb_basic_read_SSL(dcb, &nsingleread); if (buffer) { + dcb->last_read = mxs_clock(); nreadtotal += nsingleread; *head = gwbuf_append(*head, buffer); while (buffer) { - dcb->last_read = mxs_clock(); buffer = dcb_basic_read_SSL(dcb, &nsingleread); if (buffer) { + dcb->last_read = mxs_clock(); nreadtotal += nsingleread; /*< Append read data to the gwbuf */ *head = gwbuf_append(*head, buffer); diff --git a/server/core/mysql_utils.cc b/server/core/mysql_utils.cc index a1a232d19..3fcc16d98 100644 --- a/server/core/mysql_utils.cc +++ b/server/core/mysql_utils.cc @@ -39,6 +39,9 @@ MYSQL* mxs_mysql_real_connect(MYSQL* con, SERVER* server, const char* user, cons bool have_ssl = ssl && !ssl->empty(); if (have_ssl) { + char enforce_tls = 1; + mysql_optionsv(con, MYSQL_OPT_SSL_ENFORCE, (void*)&enforce_tls); + // If an option is empty, a null-pointer should be given to mysql_ssl_set. const char* ssl_key = ssl->key.empty() ? nullptr : ssl->key.c_str(); const char* ssl_cert = ssl->cert.empty() ? nullptr : ssl->cert.c_str();