#include #include #include #include static zend_uchar* mysqlnd_ldap_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self, size_t * auth_data_len, MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, const size_t passwd_len, zend_uchar * auth_plugin_data, const size_t auth_plugin_data_len, const MYSQLND_SESSION_OPTIONS * const session_options, const MYSQLND_PFC_DATA * const pfc_data, const zend_ulong mysql_flags) { zend_uchar * ret = NULL; if (passwd && passwd_len) ret = (zend_uchar*) zend_strndup(passwd, passwd_len); *auth_data_len = passwd_len; return ret; } static struct st_mysqlnd_authentication_plugin* mysqlnd_plugin_auth_ldap_ptr = NULL; static PHP_MINIT_FUNCTION(mysql_auth_ldap) { struct st_mysqlnd_authentication_plugin mysqlnd_plugin_auth_ldap = { { MYSQLND_PLUGIN_API_VERSION, "auth_plugin_auth_ldap", MYSQLND_VERSION_ID, PHP_MYSQLND_VERSION, "PHP License 3.01", "isundil ", { NULL, NULL }, { NULL } }, { mysqlnd_ldap_auth_get_auth_data, NULL } }; mysqlnd_plugin_auth_ldap_ptr = (struct st_mysqlnd_authentication_plugin*) malloc(sizeof(mysqlnd_plugin_auth_ldap)); memcpy(mysqlnd_plugin_auth_ldap_ptr, &mysqlnd_plugin_auth_ldap, sizeof(mysqlnd_plugin_auth_ldap)); mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) mysqlnd_plugin_auth_ldap_ptr); } static PHP_MSHUTDOWN_FUNCTION(mysql_auth_ldap) { static int call_count = 0; if (++call_count > 1) free(mysqlnd_plugin_auth_ldap_ptr); } static const zend_module_dep mysql_auth_ldap_dep[] = { ZEND_MOD_REQUIRED("mysqlnd") ZEND_MOD_END }; static zend_function_entry mysqlnd_functions[] = { PHP_FE_END }; PHP_MINFO_FUNCTION(mysql_auth_ldap) { php_info_print_table_start(); php_info_print_table_row(2, "mysql ldap auth plugin", "enabled"); php_info_print_table_end(); } zend_module_entry mysql_auth_ldap_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, mysql_auth_ldap_dep, "mysql_auth_ldap", mysqlnd_functions, PHP_MINIT(mysql_auth_ldap), PHP_MSHUTDOWN(mysql_auth_ldap), NULL, NULL, NULL, "0.1", STANDARD_MODULE_PROPERTIES }; ZEND_GET_MODULE(mysql_auth_ldap)