diff --git a/plugin/auth_pam/CMakeLists.txt b/plugin/auth_pam/CMakeLists.txt index f75c2f01f06..51317527c77 100644 --- a/plugin/auth_pam/CMakeLists.txt +++ b/plugin/auth_pam/CMakeLists.txt @@ -5,6 +5,9 @@ CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H) CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP) IF(HAVE_PAM_APPL_H) + IF(HAVE_STRNDUP) + ADD_DEFINITIONS(-DHAVE_STRNDUP) + ENDIF(HAVE_STRNDUP) MYSQL_ADD_PLUGIN(auth_pam auth_pam.c LINK_LIBRARIES pam MODULE_ONLY) ENDIF(HAVE_PAM_APPL_H) diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c index 6507c482ef9..d8211294910 100644 --- a/plugin/auth_pam/auth_pam.c +++ b/plugin/auth_pam/auth_pam.c @@ -14,13 +14,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE /* For strndup() */ -#endif +#define _GNU_SOURCE 1 /* for strndup */ #include #include -#include #include #include @@ -123,8 +120,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) const char *new_username; struct param param; /* The following is written in such a way to make also solaris happy */ - struct pam_conv pam_start_arg = { &conv, NULL }; - pam_start_arg.appdata_ptr= (char*) ¶m; + struct pam_conv pam_start_arg = { &conv, (char*) ¶m }; /* get the service name, as specified in