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
4f87ad19
Commit
4f87ad19
authored
Jun 30, 2019
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19879 server can send empty error message to client with pam_use_cleartext_plugin
fixed in MDEV-19878, here just adding tests
parent
3914a792
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
15 deletions
+42
-15
mysql-test/suite/plugins/r/pam_cleartext.result
mysql-test/suite/plugins/r/pam_cleartext.result
+8
-0
mysql-test/suite/plugins/t/pam_cleartext.test
mysql-test/suite/plugins/t/pam_cleartext.test
+13
-0
plugin/auth_pam/testing/pam_mariadb_mtr.c
plugin/auth_pam/testing/pam_mariadb_mtr.c
+21
-15
No files found.
mysql-test/suite/plugins/r/pam_cleartext.result
View file @
4f87ad19
...
...
@@ -8,6 +8,14 @@ pam_use_cleartext_plugin ON
#
# same test as in pam.test now fails
#
#
# success
#
user() current_user() database()
test_pam@localhost pam_test@% NULL
#
# failure
#
drop user test_pam;
drop user pam_test;
uninstall plugin pam;
mysql-test/suite/plugins/t/pam_cleartext.test
View file @
4f87ad19
...
...
@@ -14,9 +14,22 @@ EOF
--
echo
#
--
error
1
--
exec
$MYSQL_TEST
-
u
test_pam
--
plugin
-
dir
=
$plugindir
<
$MYSQLTEST_VARDIR
/
tmp
/
pam_good
.
txt
--
error
1
--
exec
$MYSQL_TEST
-
u
test_pam
--
plugin
-
dir
=
$plugindir
-
p
'something'
<
$MYSQLTEST_VARDIR
/
tmp
/
pam_good
.
txt
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
pam_good
.
txt
--
echo
#
--
echo
# success
--
echo
#
--
exec
$MYSQL
-
u
test_pam
--
plugin
-
dir
=
$plugindir
-
p
'cleartext good'
-
e
'select user(), current_user(), database()'
--
echo
#
--
echo
# failure
--
echo
#
--
error
1
--
exec
$MYSQL
-
u
test_pam
--
plugin
-
dir
=
$plugindir
-
p
'cleartext bad'
-
e
'select user(), current_user(), database()'
drop
user
test_pam
;
drop
user
pam_test
;
let
$count_sessions
=
1
;
...
...
plugin/auth_pam/testing/pam_mariadb_mtr.c
View file @
4f87ad19
...
...
@@ -38,23 +38,29 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
if
(
pam_err
!=
PAM_SUCCESS
||
!
resp
||
!
((
r1
=
resp
[
1
].
resp
)))
goto
ret
;
free
(
resp
);
msg
[
0
].
msg_style
=
PAM_PROMPT_ECHO_ON
;
msg
[
0
].
msg
=
"PIN:"
;
pam_err
=
(
*
conv
->
conv
)(
1
,
msgp
,
&
resp
,
conv
->
appdata_ptr
);
if
(
pam_err
!=
PAM_SUCCESS
||
!
resp
||
!
((
r2
=
resp
[
0
].
resp
)))
goto
ret
;
/* Produce the crash for testing purposes. */
if
(
strcmp
(
r1
,
"crash pam module"
)
==
0
&&
atoi
(
r2
)
==
616
)
abort
();
if
(
strlen
(
r1
)
==
(
uint
)
atoi
(
r2
)
%
100
)
if
(
strcmp
(
r1
,
"cleartext good"
)
==
0
)
retval
=
PAM_SUCCESS
;
else
else
if
(
strcmp
(
r1
,
"cleartext bad"
)
==
0
)
retval
=
PAM_AUTH_ERR
;
else
{
free
(
resp
);
msg
[
0
].
msg_style
=
PAM_PROMPT_ECHO_ON
;
msg
[
0
].
msg
=
"PIN:"
;
pam_err
=
(
*
conv
->
conv
)(
1
,
msgp
,
&
resp
,
conv
->
appdata_ptr
);
if
(
pam_err
!=
PAM_SUCCESS
||
!
resp
||
!
((
r2
=
resp
[
0
].
resp
)))
goto
ret
;
/* Produce the crash for testing purposes. */
if
(
strcmp
(
r1
,
"crash pam module"
)
==
0
&&
atoi
(
r2
)
==
616
)
abort
();
if
(
strlen
(
r1
)
==
(
uint
)
atoi
(
r2
)
%
100
)
retval
=
PAM_SUCCESS
;
else
retval
=
PAM_AUTH_ERR
;
}
if
(
argc
>
0
&&
argv
[
0
])
pam_set_item
(
pamh
,
PAM_USER
,
argv
[
0
]);
...
...
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