Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
de9909fa
Commit
de9909fa
authored
Jul 07, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash caused by calling DES_ENCRYPT() without the --des-key-file
option having been passed to the server. (Bug #11643)
parent
fe217934
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
7 deletions
+37
-7
BitKeeper/etc/config
BitKeeper/etc/config
+1
-1
mysql-test/r/func_des_encrypt.result
mysql-test/r/func_des_encrypt.result
+3
-0
mysql-test/t/func_des_encrypt.test
mysql-test/t/func_des_encrypt.test
+9
-0
sql/des_key_file.cc
sql/des_key_file.cc
+12
-6
sql/item_strfunc.cc
sql/item_strfunc.cc
+11
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
No files found.
BitKeeper/etc/config
View file @
de9909fa
...
@@ -24,7 +24,7 @@ description: MySQL - fast and reliable SQL database
...
@@ -24,7 +24,7 @@ description: MySQL - fast and reliable SQL database
# repository is commercial it can be an internal email address or "none"
# repository is commercial it can be an internal email address or "none"
# to disable logging.
# to disable logging.
#
#
logging:
logging@openlogging.org
logging:
none
#
#
# If this field is set, all checkins will appear to be made by this user,
# 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
# in effect making this a single user package. Single user packages are
...
...
mysql-test/r/func_des_encrypt.result
0 → 100644
View file @
de9909fa
select des_encrypt('hello');
des_encrypt('hello')
€Ö2nV“Ø}
mysql-test/t/func_des_encrypt.test
0 → 100644
View file @
de9909fa
--
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'
);
sql/des_key_file.cc
View file @
de9909fa
...
@@ -22,7 +22,17 @@
...
@@ -22,7 +22,17 @@
struct
st_des_keyschedule
des_keyschedule
[
10
];
struct
st_des_keyschedule
des_keyschedule
[
10
];
uint
des_default_key
;
uint
des_default_key
;
pthread_mutex_t
LOCK_des_key_file
;
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
Function which loads DES keys from plaintext file into memory on MySQL
...
@@ -45,11 +55,7 @@ load_des_key_file(const char *file_name)
...
@@ -45,11 +55,7 @@ load_des_key_file(const char *file_name)
DBUG_ENTER
(
"load_des_key_file"
);
DBUG_ENTER
(
"load_des_key_file"
);
DBUG_PRINT
(
"enter"
,(
"name: %s"
,
file_name
));
DBUG_PRINT
(
"enter"
,(
"name: %s"
,
file_name
));
if
(
!
initialized
)
init_des_key_file
();
{
initialized
=
1
;
pthread_mutex_init
(
&
LOCK_des_key_file
,
MY_MUTEX_INIT_FAST
);
}
VOID
(
pthread_mutex_lock
(
&
LOCK_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
||
if
((
file
=
my_open
(
file_name
,
O_RDONLY
|
O_BINARY
,
MYF
(
MY_WME
)))
<
0
||
...
...
sql/item_strfunc.cc
View file @
de9909fa
...
@@ -388,6 +388,9 @@ String *Item_func_des_encrypt::val_str(String *str)
...
@@ -388,6 +388,9 @@ String *Item_func_des_encrypt::val_str(String *str)
if
(
arg_count
==
1
)
if
(
arg_count
==
1
)
{
{
/* Make sure LOCK_des_key_file was initialized. */
init_des_key_file
();
/* Protect against someone doing FLUSH DES_KEY_FILE */
/* Protect against someone doing FLUSH DES_KEY_FILE */
VOID
(
pthread_mutex_lock
(
&
LOCK_des_key_file
));
VOID
(
pthread_mutex_lock
(
&
LOCK_des_key_file
));
keyschedule
=
des_keyschedule
[
key_number
=
des_default_key
];
keyschedule
=
des_keyschedule
[
key_number
=
des_default_key
];
...
@@ -398,6 +401,10 @@ String *Item_func_des_encrypt::val_str(String *str)
...
@@ -398,6 +401,10 @@ String *Item_func_des_encrypt::val_str(String *str)
key_number
=
(
uint
)
args
[
1
]
->
val_int
();
key_number
=
(
uint
)
args
[
1
]
->
val_int
();
if
(
key_number
>
9
)
if
(
key_number
>
9
)
goto
error
;
goto
error
;
/* Make sure LOCK_des_key_file was initialized. */
init_des_key_file
();
VOID
(
pthread_mutex_lock
(
&
LOCK_des_key_file
));
VOID
(
pthread_mutex_lock
(
&
LOCK_des_key_file
));
keyschedule
=
des_keyschedule
[
key_number
];
keyschedule
=
des_keyschedule
[
key_number
];
VOID
(
pthread_mutex_unlock
(
&
LOCK_des_key_file
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_des_key_file
));
...
@@ -485,6 +492,10 @@ String *Item_func_des_decrypt::val_str(String *str)
...
@@ -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
// Check if automatic key and that we have privilege to uncompress using it
if
(
!
(
current_thd
->
master_access
&
SUPER_ACL
)
||
key_number
>
9
)
if
(
!
(
current_thd
->
master_access
&
SUPER_ACL
)
||
key_number
>
9
)
goto
error
;
goto
error
;
/* Make sure LOCK_des_key_file was initialized. */
init_des_key_file
();
VOID
(
pthread_mutex_lock
(
&
LOCK_des_key_file
));
VOID
(
pthread_mutex_lock
(
&
LOCK_des_key_file
));
keyschedule
=
des_keyschedule
[
key_number
];
keyschedule
=
des_keyschedule
[
key_number
];
VOID
(
pthread_mutex_unlock
(
&
LOCK_des_key_file
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_des_key_file
));
...
...
sql/mysql_priv.h
View file @
de9909fa
...
@@ -624,6 +624,7 @@ extern char *des_key_file;
...
@@ -624,6 +624,7 @@ extern char *des_key_file;
extern
struct
st_des_keyschedule
des_keyschedule
[
10
];
extern
struct
st_des_keyschedule
des_keyschedule
[
10
];
extern
uint
des_default_key
;
extern
uint
des_default_key
;
extern
pthread_mutex_t
LOCK_des_key_file
;
extern
pthread_mutex_t
LOCK_des_key_file
;
void
init_des_key_file
();
bool
load_des_key_file
(
const
char
*
file_name
);
bool
load_des_key_file
(
const
char
*
file_name
);
void
free_des_key_file
();
void
free_des_key_file
();
#endif
/* HAVE_OPENSSL */
#endif
/* HAVE_OPENSSL */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment