diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/m_ctype.h | 9 | ||||
-rw-r--r-- | include/m_string.h | 2 | ||||
-rw-r--r-- | include/my_global.h | 7 | ||||
-rw-r--r-- | include/my_sys.h | 16 | ||||
-rw-r--r-- | include/my_time.h | 24 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h | 46 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 4 | ||||
-rw-r--r-- | include/mysql/plugin_password_validation.h | 4 | ||||
-rw-r--r-- | include/mysql/plugin_password_validation.h.pp | 4 | ||||
-rw-r--r-- | include/mysql/service_my_print_error.h | 9 | ||||
-rw-r--r-- | include/mysql_embed.h | 1 | ||||
-rw-r--r-- | include/violite.h | 23 | ||||
-rw-r--r-- | include/wsrep.h | 9 |
13 files changed, 80 insertions, 78 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index a4aa5b51218..c6273590bbe 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -362,7 +362,6 @@ extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler; -extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; /* Some typedef to make it easy for C++ to make function pointers */ typedef int (*my_charset_conv_mb_wc)(CHARSET_INFO *, my_wc_t *, @@ -872,14 +871,6 @@ size_t my_strnxfrm_mb_nopad(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); -size_t my_strnxfrm_unicode(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - -size_t my_strnxfrm_unicode_nopad(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - size_t my_strnxfrmlen_unicode(CHARSET_INFO *, size_t); size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, diff --git a/include/m_string.h b/include/m_string.h index d50da8770c3..c8b5774b08c 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -99,7 +99,7 @@ extern char *strmake(char *dst,const char *src,size_t length); #define strmake_buf(D,S) strmake(D, S, sizeof(D) - 1) #else #define strmake_buf(D,S) ({ \ - typeof (D) __x __attribute__((unused)) = { 2 }; \ + __typeof__ (D) __x __attribute__((unused)) = { 2 }; \ strmake(D, S, sizeof(D) - 1); \ }) #endif diff --git a/include/my_global.h b/include/my_global.h index 7904eed3dfc..d620d4e790b 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -133,11 +133,6 @@ #define F_UNLCK 3 #define F_TO_EOF 0x3FFFFFFF -/* Shared memory and named pipe connections are supported. */ -#define HAVE_SMEM 1 -#define HAVE_NAMED_PIPE 1 -#define shared_memory_buffer_length 16000 -#define default_shared_memory_base_name "MYSQL" #endif /* _WIN32*/ @@ -1190,8 +1185,6 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info; /* Things we don't need in the embedded version of MySQL */ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ -#undef HAVE_SMEM /* No shared memory */ - #else #define HAVE_REPLICATION #define HAVE_EXTERNAL_CLIENT diff --git a/include/my_sys.h b/include/my_sys.h index 13ab7b12320..11993c02516 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -104,13 +104,12 @@ typedef struct my_aio_result { #define MY_GIVE_INFO 2U /* Give time info about process*/ #define MY_DONT_FREE_DBUG 4U /* Do not call DBUG_END() in my_end() */ -#define ME_BELL 4U /* Ring bell then printing message */ -#define ME_WAITTANG 0 /* Wait for a user action */ -#define ME_NOREFRESH 64U /* Write the error message to error log */ -#define ME_NOINPUT 0 /* Don't use the input library */ -#define ME_JUST_INFO 1024U /**< not error but just info */ -#define ME_JUST_WARNING 2048U /**< not error but just warning */ -#define ME_FATALERROR 4096U /* Fatal statement error */ +#define ME_BELL 4U /* Ring bell then printing message */ +#define ME_ERROR_LOG 64 /**< write the error message to error log */ +#define ME_ERROR_LOG_ONLY 128 /**< write the error message to error log only */ +#define ME_NOTE 1024 /**< not error but just info */ +#define ME_WARNING 2048 /**< not error but just warning */ +#define ME_FATAL 4096 /**< fatal statement error */ /* Bits in last argument to fn_format */ #define MY_REPLACE_DIR 1U /* replace dir in name with 'dir' */ @@ -329,7 +328,7 @@ typedef struct st_record_cache /* Used when caching records */ enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN, - FILE_BY_MKSTEMP, FILE_BY_DUP + FILE_BY_O_TMPFILE, FILE_BY_MKSTEMP, FILE_BY_DUP }; struct st_my_file_info @@ -904,6 +903,7 @@ static inline char *safe_strdup_root(MEM_ROOT *root, const char *str) } extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); +extern LEX_CSTRING safe_lexcstrdup_root(MEM_ROOT *root, const LEX_CSTRING str); extern my_bool my_compress(uchar *, size_t *, size_t *); extern my_bool my_uncompress(uchar *, size_t , size_t *); extern uchar *my_compress_alloc(const uchar *packet, size_t *len, diff --git a/include/my_time.h b/include/my_time.h index cec168c6fd6..a1eaea90a9c 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -61,12 +61,12 @@ extern uchar days_in_month[]; TIME_FUZZY_DATES is used for the result will only be used for comparison purposes. Conversion is as relaxed as possible. */ -#define TIME_FUZZY_DATES 1U -#define TIME_DATETIME_ONLY 2U -#define TIME_TIME_ONLY 4U -#define TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */ -#define TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */ -#define TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */ +#define C_TIME_FUZZY_DATES 1U +#define C_TIME_DATETIME_ONLY 2U +#define C_TIME_TIME_ONLY 4U +#define C_TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */ +#define C_TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */ +#define C_TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */ #define MYSQL_TIME_WARN_TRUNCATED 1U #define MYSQL_TIME_WARN_OUT_OF_RANGE 2U @@ -110,6 +110,8 @@ static inline void my_time_status_init(MYSQL_TIME_STATUS *status) my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, ulonglong flags, int *was_cut); +my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *l_time, + ulong max_hour, MYSQL_TIME_STATUS *status); my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time, ulonglong flag, MYSQL_TIME_STATUS *status); my_bool str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time, @@ -117,16 +119,6 @@ my_bool str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time, longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, ulonglong flags, int *was_cut); -static inline -longlong double_to_datetime(double nr, MYSQL_TIME *ltime, ulonglong flags, int *cut) -{ - if (nr < 0 || nr > LONGLONG_MAX) - nr= (double)LONGLONG_MAX; - return number_to_datetime((longlong) floor(nr), - (ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR), - ltime, flags, cut); -} - int number_to_time(my_bool neg, ulonglong nr, ulong sec_part, MYSQL_TIME *ltime, int *was_cut); ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *); diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h index 638d9b57fd9..44e51c3fd0b 100644 --- a/include/mysql/plugin_auth.h +++ b/include/mysql/plugin_auth.h @@ -27,7 +27,7 @@ #include <mysql/plugin.h> -#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0201 +#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0202 #include <mysql/plugin_auth_common.h> @@ -60,7 +60,8 @@ typedef struct st_mysql_server_auth_info /** A corresponding column value from the mysql.user table for the - matching account name + matching account name or the preprocessed value, if preprocess_hash + method is not NULL */ const char *auth_string; @@ -130,6 +131,47 @@ struct st_mysql_auth used for authorization. */ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); + /** + Create a password hash (or digest) out of a plain-text password + + Used in SET PASSWORD, GRANT, and CREATE USER to convert user specified + plain-text password into a value that will be stored in mysql.user table. + + @see preprocess_hash + + @param password plain-text password + @param password_length plain-text password length + @param hash the digest will be stored there + @param hash_length in: hash buffer size + out: the actual length of the hash + + @return 0 for ok, 1 for error + + Can be NULL. + */ + int (*hash_password)(const char *password, size_t password_length, + char *hash, size_t *hash_length); + + /** + Prepare the password hash for authentication. + + Password hash is stored in the authentication_string column of the + mysql.user table in a text form. If a plugin needs to preprocess the + value somehow before the authentication (e.g. convert from hex or base64 + to binary), it can do it in this method. This way the conversion + will happen only once, not for every authentication attempt. + + The value written to the out buffer will be cached and later made + available to the authenticate_user() method in the + MYSQL_SERVER_AUTH_INFO::auth_string[] buffer. + + @return 0 for ok, 1 for error + + Can be NULL, in this case the mysql.user.authentication_string value will + be given to the authenticate_user() method as is, unconverted. + */ + int (*preprocess_hash)(const char *hash, size_t hash_length, + unsigned char *out, size_t *out_length); }; #ifdef __cplusplus diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index e515699cad6..7ed786cc1ab 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -561,4 +561,8 @@ struct st_mysql_auth int interface_version; const char *client_auth_plugin; int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); + int (*hash_password)(const char *password, size_t password_length, + char *hash, size_t *hash_length); + int (*preprocess_hash)(const char *hash, size_t hash_length, + unsigned char *out, size_t *out_length); }; diff --git a/include/mysql/plugin_password_validation.h b/include/mysql/plugin_password_validation.h index e2763483db6..699d42d6b50 100644 --- a/include/mysql/plugin_password_validation.h +++ b/include/mysql/plugin_password_validation.h @@ -42,8 +42,8 @@ struct st_mariadb_password_validation Function provided by the plugin which should perform password validation and return 0 if the password has passed the validation. */ - int (*validate_password)(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password); + int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password); }; #ifdef __cplusplus diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 9701ad1b92f..b13f8cc9afb 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -531,6 +531,6 @@ void thd_wakeup_subsequent_commits(void* thd, int wakeup_error); struct st_mariadb_password_validation { int interface_version; - int (*validate_password)(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password); + int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password); }; diff --git a/include/mysql/service_my_print_error.h b/include/mysql/service_my_print_error.h index 5a71be74fd0..0046ba54f6d 100644 --- a/include/mysql/service_my_print_error.h +++ b/include/mysql/service_my_print_error.h @@ -32,10 +32,11 @@ extern "C" { #include <stdlib.h> #endif -#define ME_ERROR_LOG 64 /* Write the message to the error log */ -#define ME_NOTE 1024 /* Not an error, just a note */ -#define ME_WARNING 2048 /* Not an error, just a warning */ -#define ME_FATAL 4096 /* Fatal statement error */ +#define ME_ERROR_LOG 64 /* Write the message to the error log */ +#define ME_ERROR_LOG_ONLY 128 /* Write the error message to error log only */ +#define ME_NOTE 1024 /* Not an error, just a note */ +#define ME_WARNING 2048 /* Not an error, just a warning */ +#define ME_FATAL 4096 /* Fatal statement error */ extern struct my_print_error_service_st { void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...); diff --git a/include/mysql_embed.h b/include/mysql_embed.h index 12b18ff965e..3047593fb6c 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -25,7 +25,6 @@ /* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */ #undef HAVE_DLOPEN /* No udf functions */ -#undef HAVE_SMEM /* No shared memory */ #endif /* EMBEDDED_LIBRARY */ #endif /* MYSQL_EMBED_INCLUDED */ diff --git a/include/violite.h b/include/violite.h index 55f8328df47..74b53f41fdd 100644 --- a/include/violite.h +++ b/include/violite.h @@ -38,7 +38,7 @@ typedef struct st_vio Vio; enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE, - VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY + VIO_TYPE_SSL }; /** @@ -68,13 +68,6 @@ Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); Vio* mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags); #ifdef __WIN__ Vio* vio_new_win32pipe(HANDLE hPipe); -Vio* vio_new_win32shared_memory(HANDLE handle_file_map, - HANDLE handle_map, - HANDLE event_server_wrote, - HANDLE event_server_read, - HANDLE event_client_wrote, - HANDLE event_client_read, - HANDLE event_conn_closed); #else #define HANDLE void * #endif /* __WIN__ */ @@ -89,6 +82,7 @@ size_t vio_write(Vio *vio, const uchar * buf, size_t size); int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode); my_bool vio_is_blocking(Vio *vio); /* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */ +int vio_nodelay(Vio *vio, my_bool on); int vio_fastsend(Vio *vio); /* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */ int vio_keepalive(Vio *vio, my_bool onoff); @@ -264,22 +258,9 @@ struct st_vio #ifdef HAVE_OPENSSL void *ssl_arg; #endif -#ifdef HAVE_SMEM - HANDLE handle_file_map; - char *handle_map; - HANDLE event_server_wrote; - HANDLE event_server_read; - HANDLE event_client_wrote; - HANDLE event_client_read; - HANDLE event_conn_closed; - size_t shared_memory_remain; - char *shared_memory_pos; -#endif /* HAVE_SMEM */ #ifdef _WIN32 HANDLE hPipe; OVERLAPPED overlapped; - DWORD read_timeout_ms; - DWORD write_timeout_ms; #endif }; #endif /* vio_violite_h_ */ diff --git a/include/wsrep.h b/include/wsrep.h index 843b9c51198..f7a9b6b0231 100644 --- a/include/wsrep.h +++ b/include/wsrep.h @@ -50,10 +50,10 @@ #define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) #define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) -#define WSREP_SYNC_WAIT(thd_, before_) \ - { if (WSREP_CLIENT(thd_) && \ +#define WSREP_SYNC_WAIT(thd_, before_) \ + { if (WSREP_CLIENT(thd_) && \ wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } -#define WSREP_ERROR_LABEL wsrep_error_label + #else #define IF_WSREP(A,B) B #define DBUG_ASSERT_IF_WSREP(A) @@ -61,12 +61,11 @@ #define WSREP_INFO(...) #define WSREP_WARN(...) #define WSREP_ERROR(...) -#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) +#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0) #define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) #define WSREP_TO_ISOLATION_END #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) #define WSREP_SYNC_WAIT(thd_, before_) -#define WSREP_ERROR_LABEL goto wsrep_error_label; wsrep_error_label #endif /* WITH_WSREP */ |