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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f3c51eec
Commit
f3c51eec
authored
Oct 03, 2002
by
peter@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
One more commit required to merge second pack of Monty's patches
parent
0dc8dc2d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
sql/item_strfunc.cc
sql/item_strfunc.cc
+0
-2
sql/mysql_priv.h
sql/mysql_priv.h
+2
-1
sql/mysqld.cc
sql/mysqld.cc
+6
-2
sql/password.c
sql/password.c
+14
-17
No files found.
sql/item_strfunc.cc
View file @
f3c51eec
...
@@ -1267,9 +1267,7 @@ String *Item_func_password::val_str(String *str)
...
@@ -1267,9 +1267,7 @@ String *Item_func_password::val_str(String *str)
if
(
res
->
length
()
==
0
)
if
(
res
->
length
()
==
0
)
return
&
empty_string
;
return
&
empty_string
;
make_scrambled_password
(
tmp_value
,
res
->
c_ptr
());
make_scrambled_password
(
tmp_value
,
res
->
c_ptr
());
printf
(
"Returned to the function
\n
"
);
str
->
set
(
tmp_value
,
get_password_length
(),
res
->
charset
());
str
->
set
(
tmp_value
,
get_password_length
(),
res
->
charset
());
printf
(
"At the exit
\n
"
);
return
str
;
return
str
;
}
}
...
...
sql/mysql_priv.h
View file @
f3c51eec
...
@@ -66,7 +66,8 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
...
@@ -66,7 +66,8 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
****************************************************************************/
****************************************************************************/
#define ACL_CACHE_SIZE 256
#define ACL_CACHE_SIZE 256
#define HASH_PASSWORD_LENGTH 16
/* Password lengh for 4.1 version previous versions had 16 bytes password hash */
#define HASH_PASSWORD_LENGTH 45
#define HOST_CACHE_SIZE 128
#define HOST_CACHE_SIZE 128
#define MAX_ACCEPT_RETRY 10 // Test accept this many times
#define MAX_ACCEPT_RETRY 10 // Test accept this many times
#define MAX_FIELDS_BEFORE_HASH 32
#define MAX_FIELDS_BEFORE_HASH 32
...
...
sql/mysqld.cc
View file @
f3c51eec
...
@@ -278,7 +278,7 @@ static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
...
@@ -278,7 +278,7 @@ static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
my_bool
opt_safe_user_create
=
0
,
opt_no_mix_types
=
0
;
my_bool
opt_safe_user_create
=
0
,
opt_no_mix_types
=
0
;
my_bool
opt_safe_show_db
=
0
,
lower_case_table_names
,
opt_old_rpl_compat
;
my_bool
opt_safe_show_db
=
0
,
lower_case_table_names
,
opt_old_rpl_compat
;
my_bool
opt_show_slave_auth_info
,
opt_sql_bin_update
=
0
;
my_bool
opt_show_slave_auth_info
,
opt_sql_bin_update
=
0
;
my_bool
opt_log_slave_updates
=
0
;
my_bool
opt_log_slave_updates
=
0
,
opt_old_passwords
=
0
;
volatile
bool
mqh_used
=
0
;
volatile
bool
mqh_used
=
0
;
FILE
*
bootstrap_file
=
0
;
FILE
*
bootstrap_file
=
0
;
...
@@ -396,6 +396,7 @@ const char *myisam_recover_options_str="OFF";
...
@@ -396,6 +396,7 @@ const char *myisam_recover_options_str="OFF";
const
char
*
sql_mode_str
=
"OFF"
;
const
char
*
sql_mode_str
=
"OFF"
;
ulong
rpl_recovery_rank
=
0
;
ulong
rpl_recovery_rank
=
0
;
my_string
mysql_unix_port
=
NULL
,
opt_mysql_tmpdir
=
NULL
,
mysql_tmpdir
=
NULL
;
my_string
mysql_unix_port
=
NULL
,
opt_mysql_tmpdir
=
NULL
,
mysql_tmpdir
=
NULL
;
ulong
my_bind_addr
;
/* the address we bind to */
ulong
my_bind_addr
;
/* the address we bind to */
DATE_FORMAT
dayord
;
DATE_FORMAT
dayord
;
...
@@ -2914,7 +2915,8 @@ enum options {
...
@@ -2914,7 +2915,8 @@ enum options {
OPT_INNODB_FORCE_RECOVERY
,
OPT_INNODB_FORCE_RECOVERY
,
OPT_BDB_CACHE_SIZE
,
OPT_BDB_CACHE_SIZE
,
OPT_BDB_LOG_BUFFER_SIZE
,
OPT_BDB_LOG_BUFFER_SIZE
,
OPT_BDB_MAX_LOCK
OPT_BDB_MAX_LOCK
,
OPT_OLD_PASSWORDS
};
};
...
@@ -3245,6 +3247,8 @@ struct my_option my_long_options[] =
...
@@ -3245,6 +3247,8 @@ struct my_option my_long_options[] =
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"safe-mode"
,
OPT_SAFE
,
"Skip some optimize stages (for testing)."
,
{
"safe-mode"
,
OPT_SAFE
,
"Skip some optimize stages (for testing)."
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"old-passwords"
,
OPT_OLD_PASSWORDS
,
"Use old password encryption method (needed for old clients)"
,
(
gptr
*
)
&
opt_old_passwords
,
(
gptr
*
)
&
opt_old_passwords
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
#ifndef TO_BE_DELETED
#ifndef TO_BE_DELETED
{
"safe-show-database"
,
OPT_SAFE_SHOW_DB
,
{
"safe-show-database"
,
OPT_SAFE_SHOW_DB
,
"Depricated option; One should use GRANT SHOW DATABASES instead..."
,
"Depricated option; One should use GRANT SHOW DATABASES instead..."
,
...
...
sql/password.c
View file @
f3c51eec
...
@@ -37,8 +37,7 @@
...
@@ -37,8 +37,7 @@
#include <my_global.h>
#include <my_global.h>
#include <my_sys.h>
#include <my_sys.h>
#include <m_string.h>
#include <m_string.h>
/* To be replaced by SHA1 as Monty will do the Merge */
#include <sha1.h>
#include <md5.h>
#include "mysql.h"
#include "mysql.h"
...
@@ -47,7 +46,7 @@
...
@@ -47,7 +46,7 @@
#define PVERSION41_CHAR '*'
#define PVERSION41_CHAR '*'
extern
uint
old_passwords
;
/* If prior 4.1 functions to be used */
extern
my_bool
opt_
old_passwords
;
/* If prior 4.1 functions to be used */
...
@@ -101,9 +100,9 @@ void make_scrambled_password(char *to,const char *password)
...
@@ -101,9 +100,9 @@ void make_scrambled_password(char *to,const char *password)
ulong
hash_res
[
2
];
/* Used for pre 4.1 password hashing */
ulong
hash_res
[
2
];
/* Used for pre 4.1 password hashing */
static
uint
salt
=
0
;
/* Salt for 4.1 version password */
static
uint
salt
=
0
;
/* Salt for 4.1 version password */
unsigned
char
*
slt
=
(
unsigned
char
*
)
&
salt
;
unsigned
char
*
slt
=
(
unsigned
char
*
)
&
salt
;
my_MD5_CTX
context
;
SHA1_CONTEXT
context
;
u
nsigned
char
digest
[
16
];
u
int8
digest
[
SHA1_HASH_SIZE
];
if
(
old_passwords
)
/* Pre 4.1 password encryption */
if
(
o
pt_o
ld_passwords
)
/* Pre 4.1 password encryption */
{
{
hash_password
(
hash_res
,
password
);
hash_password
(
hash_res
,
password
);
sprintf
(
to
,
"%08lx%08lx"
,
hash_res
[
0
],
hash_res
[
1
]);
sprintf
(
to
,
"%08lx%08lx"
,
hash_res
[
0
],
hash_res
[
1
]);
...
@@ -115,34 +114,32 @@ void make_scrambled_password(char *to,const char *password)
...
@@ -115,34 +114,32 @@ void make_scrambled_password(char *to,const char *password)
salt
+=
getpid
()
+
time
(
NULL
)
+
0x01010101
;
salt
+=
getpid
()
+
time
(
NULL
)
+
0x01010101
;
/* Use only 2 first bytes from it */
/* Use only 2 first bytes from it */
sprintf
(
&
(
to
[
1
]),
"%02x%02x"
,
slt
[
0
],
slt
[
1
]);
sprintf
(
&
(
to
[
1
]),
"%02x%02x"
,
slt
[
0
],
slt
[
1
]);
/* Waiting for Monty to do the merge */
sha1_reset
(
&
context
);
my_MD5Init
(
&
context
);
/* Use Salt for Hash */
/* Use Salt for Hash */
my_MD5Update
(
&
context
,(
unsigned
char
*
)
&
salt
,
2
);
sha1_input
(
&
context
,(
uint8
*
)
&
salt
,
2
);
for
(;
*
password
;
password
++
)
for
(;
*
password
;
password
++
)
{
{
if
(
*
password
==
' '
||
*
password
==
'\t'
)
if
(
*
password
==
' '
||
*
password
==
'\t'
)
continue
;
/* skip space in password */
continue
;
/* skip space in password */
my_MD5Update
(
&
context
,(
unsigned
char
*
)
&
password
[
0
],
1
);
sha1_input
(
&
context
,(
int8
*
)
&
password
[
0
],
1
);
}
}
my_MD5Final
(
digest
,
&
contex
t
);
sha1_result
(
&
context
,
diges
t
);
/* Print resulting hash into the password*/
/* Print resulting hash into the password*/
/*
sprintf(&(to[5]),
sprintf
(
&
(
to
[
5
]),
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x
%02x%02x%02x%02x
"
,
digest
[
0
],
digest
[
1
],
digest
[
2
],
digest
[
3
],
digest
[
4
],
digest
[
5
],
digest
[
6
],
digest
[
0
],
digest
[
1
],
digest
[
2
],
digest
[
3
],
digest
[
4
],
digest
[
5
],
digest
[
6
],
digest
[
7
],
digest
[
8
],
digest
[
9
],
digest
[
10
],
digest
[
11
],
digest
[
12
],
digest
[
13
],
digest
[
7
],
digest
[
8
],
digest
[
9
],
digest
[
10
],
digest
[
11
],
digest
[
12
],
digest
[
13
],
digest[14],digest[15]); */
digest
[
14
],
digest
[
15
],
digest
[
16
],
digest
[
17
],
digest
[
18
],
digest
[
19
]);
sprintf
(
&
to
[
5
],
"1234567890123456789012345"
);
}
}
}
}
uint
get_password_length
()
uint
get_password_length
()
{
{
if
(
old_passwords
)
if
(
o
pt_o
ld_passwords
)
return
16
;
return
16
;
else
return
37
;
else
return
SHA1_HASH_SIZE
*
2
+
4
+
1
;
}
}
...
...
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