mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Merge mysql.com:/home/jimw/my/mysql-4.1-11643
into mysql.com:/home/jimw/my/mysql-4.1-clean sql/item_strfunc.cc: Auto merged BitKeeper/etc/config: Resolve conflict
This commit is contained in:
commit
41b038b548
5 changed files with 36 additions and 6 deletions
3
mysql-test/r/func_des_encrypt.result
Normal file
3
mysql-test/r/func_des_encrypt.result
Normal file
|
@ -0,0 +1,3 @@
|
|||
select des_encrypt('hello');
|
||||
des_encrypt('hello')
|
||||
€Ö2nV“Ø}
|
9
mysql-test/t/func_des_encrypt.test
Normal file
9
mysql-test/t/func_des_encrypt.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
-- source include/have_openssl.inc
|
||||
|
||||
# This test can't be in func_encrypt.test, because it requires
|
||||
# --des-key-file to not be set.
|
||||
|
||||
#
|
||||
# Bug #11643: des_encrypt() causes server to die
|
||||
#
|
||||
select des_encrypt('hello');
|
|
@ -22,7 +22,17 @@
|
|||
struct st_des_keyschedule des_keyschedule[10];
|
||||
uint des_default_key;
|
||||
pthread_mutex_t LOCK_des_key_file;
|
||||
static int initialized;
|
||||
static int initialized= 0;
|
||||
|
||||
void
|
||||
init_des_key_file()
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
initialized=1;
|
||||
pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Function which loads DES keys from plaintext file into memory on MySQL
|
||||
|
@ -45,11 +55,7 @@ load_des_key_file(const char *file_name)
|
|||
DBUG_ENTER("load_des_key_file");
|
||||
DBUG_PRINT("enter",("name: %s",file_name));
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
initialized=1;
|
||||
pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
init_des_key_file();
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_des_key_file));
|
||||
if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 ||
|
||||
|
|
|
@ -388,6 +388,9 @@ String *Item_func_des_encrypt::val_str(String *str)
|
|||
|
||||
if (arg_count == 1)
|
||||
{
|
||||
/* Make sure LOCK_des_key_file was initialized. */
|
||||
init_des_key_file();
|
||||
|
||||
/* Protect against someone doing FLUSH DES_KEY_FILE */
|
||||
VOID(pthread_mutex_lock(&LOCK_des_key_file));
|
||||
keyschedule= des_keyschedule[key_number=des_default_key];
|
||||
|
@ -398,6 +401,10 @@ String *Item_func_des_encrypt::val_str(String *str)
|
|||
key_number= (uint) args[1]->val_int();
|
||||
if (key_number > 9)
|
||||
goto error;
|
||||
|
||||
/* Make sure LOCK_des_key_file was initialized. */
|
||||
init_des_key_file();
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_des_key_file));
|
||||
keyschedule= des_keyschedule[key_number];
|
||||
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
|
||||
|
@ -485,6 +492,10 @@ String *Item_func_des_decrypt::val_str(String *str)
|
|||
// Check if automatic key and that we have privilege to uncompress using it
|
||||
if (!(current_thd->master_access & SUPER_ACL) || key_number > 9)
|
||||
goto error;
|
||||
|
||||
/* Make sure LOCK_des_key_file was initialized. */
|
||||
init_des_key_file();
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_des_key_file));
|
||||
keyschedule= des_keyschedule[key_number];
|
||||
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
|
||||
|
|
|
@ -624,6 +624,7 @@ extern char *des_key_file;
|
|||
extern struct st_des_keyschedule des_keyschedule[10];
|
||||
extern uint des_default_key;
|
||||
extern pthread_mutex_t LOCK_des_key_file;
|
||||
void init_des_key_file();
|
||||
bool load_des_key_file(const char *file_name);
|
||||
void free_des_key_file();
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
|
Loading…
Reference in a new issue