Compatibility with Debian stretch & MySQL 5.7

This commit is contained in:
Juan 2018-07-02 17:20:11 +02:00
parent b77a9af188
commit 933bf0c347
10 changed files with 203 additions and 134 deletions

19
.gitignore vendored
View File

@ -1,7 +1,16 @@
.anjuta/
.anjuta_sym_db.db
aclocal.m4
build/
configure
debian/build/
vn-mysql.anjuta
autom4te.cache/
aclocal.m4
.anjuta_sym_db.db
config.log
config.status
libtool
configure
Makefile
Makefile.in
.deps
.libs
*.lo
*.o
*.la

12
INSTALL
View File

@ -1,7 +1,7 @@
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
@ -12,8 +12,8 @@ without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
Briefly, the shell command `./configure && make && make install'
should configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
@ -309,9 +309,10 @@ causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
@ -367,4 +368,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View File

@ -2,7 +2,7 @@
mysql_LIBS = `mysql_config --libs`
mysql_CFLAGS = `mysql_config --cflags`
vn_mysql_libdir = $(libdir)/mysql/plugin
vn_mysql_libdir = /usr/lib/mysql/plugin
vn_mysql_CFLAGS = \
-Wall -O3 \
$(mysql_CFLAGS)

18
clean.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
dir=$PWD
if [ ! -r $dir/configure.ac ]
then
echo "$0: Invalid source directory: $dir"
exit 2
fi
rm -rf $dir/build
rm -rf $dir/configure
rm -rf $dir/gtk-doc.make
rm -rf $dir/aclocal.m4
rm -rf $dir/autom4te.cache
rm -rf $dir/po/Makefile.in.in
rm -rf `find $dir -name Makefile.in`
rm -rf `find $dir -name Makefile`

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
vn-mysql (1.4-deb8) unstable; urgency=low
vn-mysql (1.5.0) unstable; urgency=low
* Initial Release.

2
debian/compat vendored
View File

@ -1 +1 @@
8
9

View File

@ -5,6 +5,10 @@ DROP TABLE IF EXISTS account.user;
CREATE TABLE account.user
SELECT 'proxy' mysql_user, 'test-user' user, '1234' password;
DROP USER 'proxy-auth'@'%';
CREATE USER 'proxy-auth'@'%' IDENTIFIED BY 'password';
GRANT SELECT ON TABLE account.user TO 'proxy-auth'@'%';
DROP USER ''@'%';
CREATE USER ''@'%' IDENTIFIED WITH proxy_auth;
GRANT USAGE ON *.* TO ''@'%';

View File

@ -15,11 +15,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define MYSQL_ABI_CHECK
#include <stdio.h>
#include <string.h>
#include <mysql.h>
#include <mysql/errmsg.h>
#include <mysql/plugin_auth.h>
#include <glib-unix.h>
#define CONFIG_FILE _CONFIG_DIR"/proxy-auth.ini"
@ -401,28 +404,65 @@ proxy_auth_plugin_deinit ()
return 0;
}
static struct st_mysql_auth proxy_auth_handler =
int
generate_auth_string_hash(
char *outbuf, unsigned int *buflen,
const char *inbuf,
unsigned int inbuflen)
{
MYSQL_AUTHENTICATION_INTERFACE_VERSION
,"mysql_clear_password" // Cleartext plugin required in the client
,proxy_auth_plugin_main
if (*buflen < inbuflen)
return 1;
strncpy(outbuf, inbuf, inbuflen);
*buflen = strlen(inbuf);
return 0;
}
int
validate_auth_string_hash(
char* const inbuf __attribute__((unused)),
unsigned int buflen __attribute__((unused)))
{
return 0;
}
int
set_salt(
const char* password __attribute__((unused)),
unsigned int password_len __attribute__((unused)),
unsigned char* salt __attribute__((unused)),
unsigned char* salt_len)
{
*salt_len = 0;
return 0;
}
static struct st_mysql_auth
proxy_auth_handler =
{
MYSQL_AUTHENTICATION_INTERFACE_VERSION,
"mysql_clear_password", // Cleartext plugin required in the client
proxy_auth_plugin_main,
generate_auth_string_hash,
validate_auth_string_hash,
set_salt,
AUTH_FLAG_PRIVILEGED_USER_FOR_PASSWORD_CHANGE
};
mysql_declare_plugin(proxy_auth)
{
MYSQL_AUTHENTICATION_PLUGIN
,&proxy_auth_handler
,"proxy_auth"
,"Alejandro T. Colombini"
,"Proxy user authentication server-side plugin"
,PLUGIN_LICENSE_GPL
,proxy_auth_plugin_init
,proxy_auth_plugin_deinit
,0x0100 // version 1.0
,NULL
,NULL
,NULL
,0
MYSQL_AUTHENTICATION_PLUGIN,
&proxy_auth_handler,
"proxy_auth",
"Alejandro T. Colombini",
"Proxy user authentication server-side plugin",
PLUGIN_LICENSE_GPL,
proxy_auth_plugin_init,
proxy_auth_plugin_deinit,
0x0100, // version 1.0,
NULL,
NULL,
NULL,
0,
}
mysql_declare_plugin_end;

View File

@ -1,5 +1,3 @@
SELECT m.user
FROM user u
JOIN mysql_user m ON u.mysql_user_id = m.id
WHERE u.name = #user AND u.password = MD5(#pass) AND u.active
SELECT mysql_user FROM account.user
WHERE user = #user AND password = #pass