Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
5a7943fe
...
5a7943fe15f700caef1019b531841877b6c97ff0
authored
2005-02-25 16:33:49 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mu_check_mysql_scrambled_password): New function.
1 parent
de6599e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
sql/mysql.c
sql/mysql.c
View file @
5a7943f
...
...
@@ -194,6 +194,36 @@ errstr (mu_sql_connection_t conn)
return
mysql_error
(
mp
->
mysql
);
}
/* Check whether a plaintext password MESSAGE matches MySQL scrambled password
PASSWORD */
int
mu_check_mysql_scrambled_password
(
const
char
*
scrambled
,
const
char
*
message
)
{
unsigned
long
hash_pass
[
2
],
hash_message
[
2
];
char
buf
[
17
];
if
(
strlen
(
scrambled
)
<
16
)
return
1
;
if
(
strlen
(
scrambled
)
>
16
)
{
const
char
*
p
;
/* Try to normalize it by cutting off trailing whitespace */
for
(
p
=
scrambled
+
strlen
(
scrambled
)
-
1
;
p
>
scrambled
&&
isspace
(
*
p
);
p
--
)
;
if
(
p
-
scrambled
!=
15
)
return
1
;
memcpy
(
buf
,
scrambled
,
16
);
buf
[
17
]
=
0
;
scrambled
=
buf
;
}
get_salt_from_password
(
hash_pass
,
scrambled
);
hash_password
(
hash_message
,
message
);
return
!
(
hash_message
[
0
]
==
hash_pass
[
0
]
&&
hash_message
[
1
]
==
hash_pass
[
1
]);
}
MU_DECL_SQL_DISPATCH_T
(
mysql
)
=
{
"mysql"
,
3306
,
...
...
Please
register
or
sign in
to post a comment