Skip to content

Commit 8515ca3

Browse files
committed
sys-auth/libnss-mysql: fix building against MariaDB 10.2+ and MySQL 8
Closes: gentoo#15083 Closes: https://bugs.gentoo.org/693392 Package-Manager: Portage-2.3.96, Repoman-2.3.22 Signed-off-by: Thomas Deutschmann <[email protected]>
1 parent 1a5b3ca commit 8515ca3

3 files changed

+118
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--- a/src/mysql.c
2+
+++ b/src/mysql.c
3+
@@ -196,6 +196,7 @@
4+
int retval;
5+
sql_server_t *server = &conf.sql.server;
6+
unsigned int port;
7+
+ my_bool reconnect = 1;
8+
9+
DENTER
10+
11+
@@ -238,8 +239,9 @@
12+
DSRETURN (NSS_UNAVAIL)
13+
}
14+
ci.valid = ntrue;
15+
- ci.link.reconnect = 0; /* Safety: We can't let MySQL assume socket is
16+
- still valid; see _nss_mysql_validate_socket */
17+
+ /* Safety: We can't let MySQL assume socket is still valid;
18+
+ see _nss_mysql_validate_socket */
19+
+ mysql_options(&ci.link, MYSQL_OPT_RECONNECT, &reconnect);
20+
DSRETURN (NSS_SUCCESS)
21+
}
22+
_nss_mysql_log (LOG_ALERT, "Connection to server '%s' failed: %s",
23+
--- a/src/nss_mysql.h
24+
+++ b/src/nss_mysql.h
25+
@@ -72,6 +72,10 @@ typedef nss_status_t NSS_STATUS;
26+
/* Default initializers */
27+
#define DEF_TIMEOUT 3
28+
29+
+#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 80001
30+
+#define my_bool bool
31+
+#endif
32+
+
33+
#ifdef DEBUG
34+
void _nss_mysql_debug (char *fmt, ...);
35+
#define DEBUG_FILE "/tmp/libnss-mysql-debug.log"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--- libnss-mysql-1.5/acinclude.m4
2+
+++ libnss-mysql-1.5.sal/acinclude.m4
3+
@@ -80,6 +80,18 @@
4+
fi
5+
done
6+
7+
+dnl Test also $libdir path
8+
+if test -f "$libdir/libmysqlclient.so"
9+
+then
10+
+ MYSQL_LIB_DIR="$libdir"
11+
+ break
12+
+fi
13+
+if test -f "$libdir/mysql/libmysqlclient.so"
14+
+then
15+
+ MYSQL_LIB_DIR="$libdir/mysql"
16+
+ break
17+
+fi
18+
+
19+
if test -n "$MYSQL_LIB_DIR"
20+
then
21+
AC_MSG_RESULT([$MYSQL_LIB_DIR])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright 1999-2020 Gentoo Authors
2+
# Distributed under the terms of the GNU General Public License v2
3+
4+
EAPI=7
5+
6+
inherit autotools
7+
8+
KEYWORDS="amd64 ppc ~sparc x86"
9+
10+
DESCRIPTION="NSS MySQL Library"
11+
HOMEPAGE="http://libnss-mysql.sourceforge.net/"
12+
SRC_URI="http://libnss-mysql.sourceforge.net/snapshot/${PN}-${PV/1.5_p/}.tgz"
13+
LICENSE="GPL-2"
14+
SLOT="0"
15+
IUSE="debug"
16+
17+
DEPEND="dev-db/mysql-connector-c:="
18+
RDEPEND="${DEPEND}"
19+
20+
S="${WORKDIR}/${PN}"
21+
22+
DOCS=( AUTHORS DEBUGGING FAQ INSTALL NEWS README THANKS
23+
TODO UPGRADING ChangeLog
24+
)
25+
26+
PATCHES=(
27+
"${FILESDIR}"/${P}-no-automagic-debug.diff
28+
"${FILESDIR}"/${PN}-1.5_p20060915-multiarch.patch
29+
"${FILESDIR}"/${PN}-1.5_p20060915-mariadb10.2.patch
30+
)
31+
32+
src_prepare() {
33+
default
34+
35+
mv configure.{in,ac} || die
36+
37+
eautoreconf
38+
}
39+
40+
src_configure() {
41+
# Usually, authentication libraries don't belong into usr.
42+
# But here, it's required that the lib is in the same dir
43+
# as libmysql, because else failures may occur on boot if
44+
# udev tries to access a user / group that doesn't exist
45+
# on the system before /usr is mounted.
46+
econf --libdir="/usr/$(get_libdir)" \
47+
$(use_enable debug)
48+
}
49+
50+
src_install() {
51+
default
52+
53+
find "${ED}" -name '*.la' -delete || die
54+
55+
newdoc sample/README README.sample
56+
57+
local subdir
58+
for subdir in sample/{linux,freebsd,complex,minimal} ; do
59+
docinto "${subdir}"
60+
dodoc "${subdir}/"{*.sql,*.cfg}
61+
done
62+
}

0 commit comments

Comments
 (0)