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:
@@ -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)
|
||||
|
@@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user