1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

auth_socket: Add SO_PEERCRED definitions for NetBSD

A getsockopt level of 0 is requied on NetBSD when using
Unix-domain socket LOCAL_* options, SOL_SOCKET will not
work.
This commit is contained in:
nia
2021-08-04 15:32:31 +02:00
committed by Daniel Black
parent 2db692f5b4
commit 7308e009c9
2 changed files with 23 additions and 0 deletions

View File

@@ -57,6 +57,21 @@ IF (HAVE_XUCRED)
SET(ok 1)
ELSE()
# NetBSD, is that you?
CHECK_CXX_SOURCE_COMPILES(
"#include <sys/un.h>
#include <sys/socket.h>
int main() {
struct unpcbid unp;
socklen_t unpl = sizeof(unp);
getsockopt(0, 0, LOCAL_PEEREID, &unp, &unpl);
}" HAVE_UNPCBID)
IF (HAVE_UNPCBID)
ADD_DEFINITIONS(-DHAVE_UNPCBID)
SET(ok 1)
ELSE()
# illumos, is that you?
CHECK_CXX_SOURCE_COMPILES(
"#include <ucred.h>
@@ -104,6 +119,7 @@ ENDIF()
ENDIF()
ENDIF()
ENDIF()
ENDIF()
IF(ok)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT)

View File

@@ -47,6 +47,13 @@
#define uid cr_uid
#define ucred xucred
#elif defined HAVE_UNPCBID
#include <sys/un.h>
#define level 0
#define SO_PEERCRED LOCAL_PEEREID
#define uid unp_euid
#define ucred unpcbid
#elif defined HAVE_GETPEERUCRED
#include <ucred.h>