Support of AIX for auth_socket plugin

This commit is contained in:
Etienne Guesnet 2020-09-11 15:58:49 +02:00 committed by Daniel Black
parent 2f5d372444
commit 77d7de8d47
2 changed files with 20 additions and 0 deletions

View file

@ -83,6 +83,19 @@ IF (HAVE_GETPEERUCRED AND HAVE_GETPWUID_POSIX_FINAL)
SET(ok 1) SET(ok 1)
ELSE() ELSE()
# AIX also!
CHECK_CXX_SOURCE_COMPILES(
"#include <sys/socket.h>
int main() {
struct peercred_struct cred;
getsockopt(0, SOL_SOCKET, SO_PEERID, &cred, 0);
}" HAVE_PEERCRED_STRUCT)
IF (HAVE_PEERCRED_STRUCT)
ADD_DEFINITIONS(-DHAVE_PEERCRED_STRUCT)
SET(ok 1)
ELSE()
# Who else? Anyone? # Who else? Anyone?
# C'mon, show your creativity, be different! ifdef's are fun, aren't they? # C'mon, show your creativity, be different! ifdef's are fun, aren't they?
@ -90,6 +103,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)

View file

@ -50,6 +50,12 @@
#elif defined HAVE_GETPEERUCRED #elif defined HAVE_GETPEERUCRED
#include <ucred.h> #include <ucred.h>
#elif defined HAVE_PEERCRED_STRUCT
#define level SOL_SOCKET
#define SO_PEERCRED SO_PEERID
#define uid euid
#define ucred peercred_struct
#else #else
#error impossible #error impossible
#endif #endif