List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:June 27 2011 4:36pm
Subject:Re: bzr commit into mysql-trunk branch (Georgi.Kodinov:3224) Bug#11753167
View as plain text  
Hi Georgi,

On 6/27/11 12:48 PM, Georgi Kodinov wrote:
> #At file:///Users/kgeorge/mysql/work/B11753167-trunk/ based on
> revid:dmitry.lenev@stripped
> 
>  3224 Georgi Kodinov	2011-06-27
>       Bug #11753167: 44559: SSL KEYS WITH PASSPHRASES
>       
>       Implemented a default password reading callback for yaSSL
>       using mysql client's get_tty_password().
>       It does that by:
>       - Implementing an extended version of get_tty_password()
>       called get_tty_password_ext() that takes a strdup function 
>       pointer.
>       - Adds client/get_password.c to the yassl lib and uses the 
>       C preprocessor to rename get_tty_passord() and 
>       get_tty_password_ext() to names prefixed
>       with yassl and internal to the yassl library.
>       Since the password can't be read from a file, only a manual
>       test performed and no automatic test case added.
> 
>     modified:
>       client/get_password.c
>       extra/yassl/CMakeLists.txt
>       extra/yassl/src/yassl_int.cpp
>       include/mysql.h.pp
>       include/mysql_com.h
> === modified file 'client/get_password.c'
> --- a/client/get_password.c	2008-02-19 17:45:11 +0000
> +++ b/client/get_password.c	2011-06-27 15:48:05 +0000
> @@ -63,12 +63,13 @@
>  /* were just going to fake it here and get input from
>     the keyboard */
>  
> -char *get_tty_password(const char *opt_message)
> +char *get_tty_password_ext(const char *opt_message,
> +                           char *(* strdup_function)(const char *, int))
>  {

typedef the function signature. (see sighandler_t type).

> 
> === modified file 'extra/yassl/CMakeLists.txt'
> --- a/extra/yassl/CMakeLists.txt	2011-04-04 08:47:25 +0000
> +++ b/extra/yassl/CMakeLists.txt	2011-06-27 15:48:05 +0000
> @@ -21,9 +21,14 @@ INCLUDE_DIRECTORIES(
>  
>  ADD_DEFINITIONS(${SSL_DEFINES})
>  
> +# rename get_tty_password to avoid collisions with the main binary
> +ADD_DEFINITIONS(-Dget_tty_password_ext=yassl_mysql_get_tty_password_ext)
> +ADD_DEFINITIONS(-Dget_tty_password=yassl_mysql_get_tty_password)

You don't need this anymore, do you?

> +
>  SET(YASSL_SOURCES  src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp
> src/handshake.cpp src/lock.cpp 
>  				src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp
> 
> -				src/yassl_imp.cpp src/yassl_int.cpp)
> +				src/yassl_imp.cpp src/yassl_int.cpp
> +                                ../../client/get_password.c )
>  
>  ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
>  RESTRICT_SYMBOL_EXPORTS(yassl)
> 
> === modified file 'extra/yassl/src/yassl_int.cpp'
> --- a/extra/yassl/src/yassl_int.cpp	2011-04-04 08:47:25 +0000
> +++ b/extra/yassl/src/yassl_int.cpp	2011-06-27 15:48:05 +0000
> @@ -68,6 +68,8 @@
>  
>  #endif // YASSL_PURE_C
>  
> +/* for the definition of get_tty_password() */
> +#include <mysql.h>

Just add the prototype for get_tty_password_ext and be done with it..

>  
>  namespace yaSSL {
>  
> @@ -1799,8 +1801,46 @@ bool SSL_METHOD::multipleProtocol() cons
>  }
>  
>  
> +/** Implement a my_strdup replacement, so we can reuse get_password() */
> +extern "C" char *yassl_mysql_strdup(const char *from,
> +                                    int my_flags __attribute__((unused)))

Just omit the my_flags name, no need for the unused attribute.

> 
> === modified file 'include/mysql.h.pp'
> --- a/include/mysql.h.pp	2011-05-31 13:52:09 +0000
> +++ b/include/mysql.h.pp	2011-06-27 15:48:05 +0000
> @@ -138,6 +138,8 @@ my_bool check_scramble(const unsigned ch
>  void get_salt_from_password(unsigned char *res, const char *password);
>  void make_password_from_salt(char *to, const unsigned char *hash_stage2);
>  char *octet2hex(char *to, const char *str, unsigned int len);
> +char *get_tty_password_ext(const char *opt_message,
> +                           char *(* strdup_function)(const char *, int));

Let's not add this to the ABI. Just define the prototype in the single
where it's needed.

Regards,

Davi
Thread
bzr commit into mysql-trunk branch (Georgi.Kodinov:3224) Bug#11753167Georgi Kodinov27 Jun
  • Re: bzr commit into mysql-trunk branch (Georgi.Kodinov:3224) Bug#11753167Davi Arnaut27 Jun