From: Georgi Kodinov Date: August 6 2010 10:28am Subject: bzr push into mysql-next-mr-wl1054 branch (Georgi.Kodinov:2973 to 2974) WL#1054 List-Archive: http://lists.mysql.com/commits/115173 Message-Id: <201008061028.o76ASA36003403@magare.gmz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5675248409787194097==" --===============5675248409787194097== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline 2974 Georgi Kodinov 2010-08-06 WL#1054: Pluggable authentication support Implemented code review remarks. - the client plugin path is now normalized - pulled the example code typedef out of the client plugin header files modified: include/mysql/client_plugin.h plugin/auth/dialog.c sql-common/client.c 2973 Georgi Kodinov 2010-08-02 WL1054 : fixed a crashing rpl test rpl_current_user(). modified: sql/sql_class.cc === modified file 'include/mysql/client_plugin.h' --- a/include/mysql/client_plugin.h 2010-05-28 08:22:14 +0000 +++ b/include/mysql/client_plugin.h 2010-08-06 10:25:10 +0000 @@ -69,24 +69,6 @@ struct st_mysql_client_plugin_AUTHENTICA int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql); }; -/** - type of the mysql_authentication_dialog_ask function - - @param mysql mysql - @param type type of the input - 1 - ordinary string input - 2 - password string - @param prompt prompt - @param buf a buffer to store the use input - @param buf_len the length of the buffer - - @retval a pointer to the user input string. - It may be equal to 'buf' or to 'mysql->password'. - In all other cases it is assumed to be an allocated - string, and the "dialog" plugin will free() it. -*/ -typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql, - int type, const char *prompt, char *buf, int buf_len); /******** using plugins ************/ /** === modified file 'plugin/auth/dialog.c' --- a/plugin/auth/dialog.c 2010-06-21 14:57:22 +0000 +++ b/plugin/auth/dialog.c 2010-08-06 10:25:10 +0000 @@ -34,9 +34,7 @@ is not known in advance. */ #if defined (WIN32) && !defined (RTLD_DEFAULT) -#define RTLD_DEFAULT GetModuleHandle(NULL) -#else -#define _GNU_SOURCE /* for RTLD_DEFAULT */ +# define RTLD_DEFAULT GetModuleHandle(NULL) #endif #include @@ -47,6 +45,10 @@ #include #include +#if !defined (_GNU_SOURCE) +# define _GNU_SOURCE /* for RTLD_DEFAULT */ +#endif + /** first byte of the question string is the question "type". It can be a "ordinary" or a "password" question. @@ -181,6 +183,25 @@ mysql_declare_plugin_end; a default gets() based implementation will be used. */ +/** + type of the mysql_authentication_dialog_ask function + + @param mysql mysql + @param type type of the input + 1 - ordinary string input + 2 - password string + @param prompt prompt + @param buf a buffer to store the use input + @param buf_len the length of the buffer + + @retval a pointer to the user input string. + It may be equal to 'buf' or to 'mysql->password'. + In all other cases it is assumed to be an allocated + string, and the "dialog" plugin will free() it. +*/ +typedef char *(*mysql_authentication_dialog_ask_t)(struct st_mysql *mysql, + int type, const char *prompt, char *buf, int buf_len); + static mysql_authentication_dialog_ask_t ask; static char *builtin_ask(MYSQL *mysql __attribute__((unused)), @@ -282,7 +303,10 @@ static int perform_dialog(MYSQL_PLUGIN_V or fall back to the default implementation. */ -static int init_dialog(char *unused1, size_t unused2, int unused3, va_list unused4) +static int init_dialog(char *unused1 __attribute__((unused)), + size_t unused2 __attribute__((unused)), + int unused3 __attribute__((unused)), + va_list unused4 __attribute__((unused))) { void *sym= dlsym(RTLD_DEFAULT, "mysql_authentication_dialog_ask"); ask= sym ? (mysql_authentication_dialog_ask_t)sym : builtin_ask; === modified file 'sql-common/client.c' --- a/sql-common/client.c 2010-07-26 09:08:37 +0000 +++ b/sql-common/client.c 2010-08-06 10:25:10 +0000 @@ -1379,7 +1379,19 @@ void mysql_read_default_options(struct s options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1; break; case OPT_plugin_dir: - EXTENSION_SET_STRING(options, plugin_dir, opt_arg); + { + char buff[FN_REFLEN], buff2[FN_REFLEN]; + if (strlen(opt_arg) >= FN_REFLEN) + opt_arg[FN_REFLEN]= '\0'; + if (my_realpath(buff, opt_arg, 0)) + { + DBUG_PRINT("warning",("failed to normalize the plugin path: %s", + opt_arg)); + break; + } + convert_dirname(buff, buff2, NULL); + EXTENSION_SET_STRING(options, plugin_dir, buff2); + } break; case OPT_default_auth: EXTENSION_SET_STRING(options, default_auth, opt_arg); --===============5675248409787194097== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/georgi.kodinov@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: georgi.kodinov@stripped\ # i1i72r97vgh7gtz5 # target_branch: file:///home/kgeorge/mysql/work/wl1054-next-mr/ # testament_sha1: f168f9a8a82b8e3cb2c3e967e82ae5f6b97fb867 # timestamp: 2010-08-06 13:28:10 +0300 # source_branch: bzr+ssh://bk-internal/bzrroot/server/mysql-next-mr/ # base_revision_id: georgi.kodinov@stripped\ # ggzq10mgix3im4ec # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZhgF+cAA6H/gCfYHAB69/// f+/ezr////pgCC33vdb3g72U0rktg9ZAarQ2sISinqTKbINCNGhoG0QNMQAMRoNBoaNNANBkhNNT aqf5NBTyTxTaoyNMgBoaPSBoaAAAaaBqCemqeEFPU008ptQGhpoaAAAAAA0NABiQEjT1JP0kz9Km aT1GT1D0mRoyGRoADIAA00OaYjIyaZNAMhoyGTIAAAZGmRoGEMgSRE0BMINTATFMamIYUj0QaMmh 6R6hoHpNk1IURKl/0xY9PU1drJO0RWTFHrlYkyVmmSFwhVlcqT0mlUwOsJvG8q2w8B1yaK6SBPom mV6UgIJIRfoMMK7YNcIlEwm6U9sECzpkICrboz0n4NvZBBhE9rOK9x5pePnvK2RGb1q1B9uEcO6f mbykikUjp5PqRpwwbVYOeLdhn1wXPipqNCKY5c4RjFMnUP5nkDhe+rG/IQcLQtuatrm/QoYhzLys eIiGQleyFIDMy++0qVrq1tLX5JfE9JxTqtIr/h1jaLn6/FZfKBZYKBQzRplPS1oE8rblvmBZAaFK Dg6MZghbpYZIoYXdTN1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