List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:July 7 2005 8:49pm
Subject:bk commit into 4.1 tree (jimw:1.2331) BUG#11643
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2331 05/07/07 11:49:44 jimw@stripped +6 -0
  Fix crash caused by calling DES_ENCRYPT() without the --des-key-file
  option having been passed to the server. (Bug #11643)

  BitKeeper/etc/config
    1.11 05/07/07 11:49:40 jimw@stripped +1 -1
    Disable openlogging

  mysql-test/t/func_des_encrypt.test
    1.1 05/07/07 11:47:40 jimw@stripped +9 -0
    New BitKeeper file ``mysql-test/t/func_des_encrypt.test''

  mysql-test/r/func_des_encrypt.result
    1.1 05/07/07 11:47:40 jimw@stripped +3 -0
    New BitKeeper file ``mysql-test/r/func_des_encrypt.result''

  sql/mysql_priv.h
    1.354 05/07/07 11:47:40 jimw@stripped +1 -0
    Add init_des_key_file() declaration

  sql/item_strfunc.cc
    1.229 05/07/07 11:47:40 jimw@stripped +11 -0
    Make sure to initialize mutex before using it

  sql/des_key_file.cc
    1.10 05/07/07 11:47:40 jimw@stripped +12 -6
    Split initialization of mutex to new function, and make sure static
    initialization variable is initialized.

  mysql-test/t/func_des_encrypt.test
    1.0 05/07/07 11:47:40 jimw@stripped +0 -0
    BitKeeper file /home/jimw/my/mysql-4.1-11643/mysql-test/t/func_des_encrypt.test

  mysql-test/r/func_des_encrypt.result
    1.0 05/07/07 11:47:40 jimw@stripped +0 -0
    BitKeeper file /home/jimw/my/mysql-4.1-11643/mysql-test/r/func_des_encrypt.result

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-4.1-11643

--- 1.228/sql/item_strfunc.cc	2005-06-27 10:30:54 -07:00
+++ 1.229/sql/item_strfunc.cc	2005-07-07 11:47:40 -07:00
@@ -388,6 +388,9 @@
 
   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 @@
     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 @@
     // 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));

--- 1.353/sql/mysql_priv.h	2005-06-27 06:46:35 -07:00
+++ 1.354/sql/mysql_priv.h	2005-07-07 11:47:40 -07:00
@@ -624,6 +624,7 @@
 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 */

--- 1.10/BitKeeper/etc/config	2004-03-20 02:48:11 -08:00
+++ 1.11/BitKeeper/etc/config	2005-07-07 11:49:40 -07:00
@@ -24,7 +24,7 @@
 # repository is commercial it can be an internal email address or "none"
 # to disable logging.
 # 
-logging:  logging@stripped
+logging: none
 # 
 # If this field is set, all checkins will appear to be made by this user,
 # in effect making this a single user package.  Single user packages are
--- New file ---
+++ mysql-test/r/func_des_encrypt.result	05/07/07 11:47:40
select des_encrypt('hello');
des_encrypt('hello')
€Ö2nV“Ø}

--- New file ---
+++ mysql-test/t/func_des_encrypt.test	05/07/07 11:47:40
-- 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');


--- 1.9/sql/des_key_file.cc	2003-10-07 04:12:08 -07:00
+++ 1.10/sql/des_key_file.cc	2005-07-07 11:47:40 -07:00
@@ -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 @@
   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 ||
Thread
bk commit into 4.1 tree (jimw:1.2331) BUG#11643Jim Winstead7 Jul