diff options
author | jimw@mysql.com <> | 2005-07-07 11:49:44 -0700 |
---|---|---|
committer | jimw@mysql.com <> | 2005-07-07 11:49:44 -0700 |
commit | de9909faec7ae81b7946f314b97ff2da8be7fe2e (patch) | |
tree | d8301fe302fcd95d93e57744293525f627d870b5 /sql/des_key_file.cc | |
parent | fe21793446a5f533655f3004f11236b9c526bade (diff) | |
download | mariadb-git-de9909faec7ae81b7946f314b97ff2da8be7fe2e.tar.gz |
Fix crash caused by calling DES_ENCRYPT() without the --des-key-file
option having been passed to the server. (Bug #11643)
Diffstat (limited to 'sql/des_key_file.cc')
-rw-r--r-- | sql/des_key_file.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc index c6b4c5f2c34..558e3f16ad2 100644 --- a/sql/des_key_file.cc +++ b/sql/des_key_file.cc @@ -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 || |