mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 15:45:33 +02:00
Fixed sleep time in mysql-test-run
Fixed bug in query cache. Cleaned up des_crypt code. BitKeeper/deleted/.del-fsck.mysql~87170d4358b50d60: Delete: fs/fsck.mysql Docs/manual.texi: Changed != to <> mysql-test/mysql-test-run.sh: Fix sleep times to take into account creation of InnoDB tables. mysql-test/r/group_by.result: More tests mysql-test/r/query_cache.result: More tests mysql-test/r/union.result: More tests mysql-test/t/func_str.test: Fix for FreeBSD mysql-test/t/query_cache.test: More tests mysql-test/t/union.test: More tests mysys/my_winsem.c: Cleanup comments sql/des_key_file.cc: Cleanup des_crypt code sql/item_strfunc.cc: Cleanup des_crypt code sql/item_strfunc.h: Cleanup des_crypt code sql/mysql_priv.h: Cleanup des_crypt code sql/mysqld.cc: Cleanup des_crypt code sql/sql_acl.cc: For for GRANT and lower-case-table names sql/sql_cache.cc: Function for integrity checking. Fixed bug when merging blocks. sql/sql_cache.h: Function for integrity checking. sql/sql_delete.cc: Cleanup sql/sql_parse.cc: For for GRANT and lower-case-table names sql/sql_union.cc: Cleanup & fixed bug in LIMIT handling sql/sql_yacc.yy: C
This commit is contained in:
parent
f0f71accfc
commit
33a096829b
24 changed files with 828 additions and 384 deletions
|
|
@ -15,72 +15,80 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
#include <mysql_priv.h>
|
||||
#include <m_ctype.h>
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
|
||||
/*
|
||||
Function which loads DES keys from plaintext file
|
||||
into memory on MySQL server startup and on command
|
||||
FLUSH DES_KEYS. Blame tonu@spam.ee on bugs ;)
|
||||
Function which loads DES keys from plaintext file into memory on MySQL
|
||||
server startup and on command FLUSH DES_KEYS. Blame tonu@spam.ee on bugs ;)
|
||||
*/
|
||||
void
|
||||
|
||||
struct st_des_keyschedule des_keyschedule[10];
|
||||
uint default_des_key;
|
||||
|
||||
void
|
||||
load_des_key_file(const char *file_name)
|
||||
{
|
||||
FILE *file;
|
||||
int ret=0;
|
||||
char offset;
|
||||
char buf[1024];
|
||||
File file;
|
||||
des_cblock ivec={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
st_des_keyblock keyblock;
|
||||
char offset;
|
||||
IO_CACHE io;
|
||||
DBUG_ENTER("load_des_key_file");
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
DBUG_PRINT("enter",("name: %s",file_name));
|
||||
if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 ||
|
||||
init_io_cache(&io, file, IO_SIZE*2, READ_CACHE, 0, 0, MYF(MY_WME)))
|
||||
goto error;
|
||||
|
||||
bzero((char*) des_keyschedule,sizeof(struct st_des_keyschedule) * 10);
|
||||
default_des_key=15; // Impossible key
|
||||
for (;;)
|
||||
{
|
||||
goto error_noclose;
|
||||
}
|
||||
while(!feof(file))
|
||||
{
|
||||
if ((my_fread(file, &offset, 1, MY_WME)) != 1)
|
||||
goto error_close;
|
||||
fgets(buf,sizeof(buf),file);
|
||||
int len=strlen(buf);
|
||||
if (len-->=1)
|
||||
buf[len]='\0';
|
||||
/* We make good 24-byte (168 bit) key from given plaintext key with MD5 */
|
||||
offset-='0';
|
||||
if (offset >= 0 && offset <=9)
|
||||
char *start, *end;
|
||||
char buf[1024];
|
||||
st_des_keyblock keyblock;
|
||||
uint length;
|
||||
|
||||
if (!(length=my_b_gets(&io,buf,sizeof(buf)-1)))
|
||||
break; // End of file
|
||||
offset=buf[0];
|
||||
if (offset >= '0' && offset <= '9') // If ok key
|
||||
{
|
||||
EVP_BytesToKey(EVP_des_ede3_cbc(),EVP_md5(),NULL,
|
||||
(uchar *)buf,
|
||||
strlen(buf),1,(uchar *)&keyblock,ivec);
|
||||
des_set_key_unchecked(&keyblock.key1,des_keyschedule[(int)offset].ks1);
|
||||
des_set_key_unchecked(&keyblock.key2,des_keyschedule[(int)offset].ks2);
|
||||
des_set_key_unchecked(&keyblock.key3,des_keyschedule[(int)offset].ks3);
|
||||
}
|
||||
offset=(char) (offset - '0');
|
||||
// Remove newline and possible other control characters
|
||||
for (start=buf+1 ; isspace(*start) ; start++) ;
|
||||
end=buf+length;
|
||||
for (end=strend(buf) ; end > start && iscntrl(end[-1]) ; end--) ;
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
// We make good 24-byte (168 bit) key from given plaintext key with MD5
|
||||
EVP_BytesToKey(EVP_des_ede3_cbc(),EVP_md5(),NULL,
|
||||
(uchar *) start, (int) (end-start),1,
|
||||
(uchar *) &keyblock,
|
||||
ivec);
|
||||
des_set_key_unchecked(&keyblock.key1,des_keyschedule[(int)offset].ks1);
|
||||
des_set_key_unchecked(&keyblock.key2,des_keyschedule[(int)offset].ks2);
|
||||
des_set_key_unchecked(&keyblock.key3,des_keyschedule[(int)offset].ks3);
|
||||
if (default_des_key == 15)
|
||||
default_des_key= (uint) offset; // use first as def.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("des",("wrong offset: %d",offset));
|
||||
DBUG_PRINT("des",("wrong offset: %c",offset));
|
||||
}
|
||||
}
|
||||
error_close:
|
||||
(void) my_fclose(file,MYF(MY_WME));
|
||||
error_noclose:
|
||||
|
||||
error:
|
||||
if (file >= 0)
|
||||
{
|
||||
my_close(file,MYF(0));
|
||||
end_io_cache(&io);
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
/* if (ret)
|
||||
do something; */
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/*
|
||||
This function is used to load right key with DES_ENCRYPT(text,integer)
|
||||
*/
|
||||
st_des_keyschedule *
|
||||
des_key(int key)
|
||||
{
|
||||
DBUG_ENTER("des_key");
|
||||
DBUG_PRINT("exit",("return: %x",&des_keyschedule[key]));
|
||||
DBUG_RETURN(&des_keyschedule[key]);
|
||||
}
|
||||
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue