Commit 7308e009 authored by nia's avatar nia Committed by Daniel Black

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.
parent 2db692f5
...@@ -57,6 +57,21 @@ IF (HAVE_XUCRED) ...@@ -57,6 +57,21 @@ IF (HAVE_XUCRED)
SET(ok 1) SET(ok 1)
ELSE() 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? # illumos, is that you?
CHECK_CXX_SOURCE_COMPILES( CHECK_CXX_SOURCE_COMPILES(
"#include <ucred.h> "#include <ucred.h>
...@@ -104,6 +119,7 @@ ENDIF() ...@@ -104,6 +119,7 @@ ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF()
IF(ok) IF(ok)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT) MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT)
......
...@@ -47,6 +47,13 @@ ...@@ -47,6 +47,13 @@
#define uid cr_uid #define uid cr_uid
#define ucred xucred #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 #elif defined HAVE_GETPEERUCRED
#include <ucred.h> #include <ucred.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment