29 #include <sys/socket.h>
38 socklen_t cred_len=
sizeof(cred);
39 struct passwd pwd_buf, *pwd;
51 vio->
info(vio, &vio_info);
52 if (vio_info.protocol != MYSQL_VIO_SOCKET)
56 if (getsockopt(vio_info.
socket, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len))
59 if (cred_len !=
sizeof(cred))
63 getpwuid_r(cred.uid, &pwd_buf, buf,
sizeof(buf), &pwd);
73 MYSQL_AUTHENTICATION_INTERFACE_VERSION,
78 mysql_declare_plugin(socket_auth)
80 MYSQL_AUTHENTICATION_PLUGIN,
84 "Unix Socket based authentication",
94 mysql_declare_plugin_end;