List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:August 6 2010 10:27am
Subject:bzr commit into mysql-next-mr-wl1054 branch (Georgi.Kodinov:2974) WL#1054
View as plain text  
#At file:///home/kgeorge/mysql/work/wl1054-next-mr/ based on revid:georgi.kodinov@stripped

 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
=== 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 <my_global.h>
@@ -47,6 +45,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#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);


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100806102510-i1i72r97vgh7gtz5.bundle
Thread
bzr commit into mysql-next-mr-wl1054 branch (Georgi.Kodinov:2974) WL#1054Georgi Kodinov6 Aug
  • Re: bzr commit into mysql-next-mr-wl1054 branch(Georgi.Kodinov:2974) WL#1054Sergei Golubchik6 Aug
Re: bzr commit into mysql-next-mr-wl1054 branch(Georgi.Kodinov:2974) WL#1054Sergei Golubchik6 Aug
Re: bzr commit into mysql-next-mr-wl1054 branch(Georgi.Kodinov:2974) WL#1054Sergei Golubchik6 Aug
Re: bzr commit into mysql-next-mr-wl1054 branch(Georgi.Kodinov:2974) WL#1054Sergei Golubchik6 Aug