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
ea91bb68
Commit
ea91bb68
authored
Jul 26, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10361 Crash in pam_securid.so with auth_pam connecting from SQLyog
auth_pam: debug output
parent
d0d99dec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
2 deletions
+34
-2
mysql-test/include/default_mysqld.cnf
mysql-test/include/default_mysqld.cnf
+2
-0
mysql-test/suite/plugins/r/pam_cleartext.result
mysql-test/suite/plugins/r/pam_cleartext.result
+1
-1
mysql-test/suite/plugins/t/pam_cleartext.test
mysql-test/suite/plugins/t/pam_cleartext.test
+1
-1
plugin/auth_pam/auth_pam.c
plugin/auth_pam/auth_pam.c
+30
-0
No files found.
mysql-test/include/default_mysqld.cnf
View file @
ea91bb68
...
...
@@ -45,6 +45,8 @@ loose-feedback-debug-startup-interval=20
loose-feedback-debug-first-interval=60
loose-feedback-debug-interval=60
loose-pam-debug
loose-innodb_data_file_path= ibdata1:12M:autoextend
loose-innodb_buffer_pool_size= 8M
loose-innodb_lru_scan_depth= 100
...
...
mysql-test/suite/plugins/r/pam_cleartext.result
View file @
ea91bb68
...
...
@@ -2,7 +2,7 @@ install plugin pam soname 'auth_pam.so';
create user test_pam identified via pam using 'mariadb_mtr';
create user pam_test;
grant proxy on pam_test to test_pam;
show variables like 'pam%';
show variables like 'pam
_use_
%';
Variable_name Value
pam_use_cleartext_plugin ON
drop user test_pam;
...
...
mysql-test/suite/plugins/t/pam_cleartext.test
View file @
ea91bb68
--
source
pam_init
.
inc
show
variables
like
'pam%'
;
show
variables
like
'pam
_use_
%'
;
--
error
1
--
exec
echo
FAIL
|
$MYSQL_TEST
-
u
test_pam
--
plugin
-
dir
=
$plugindir
...
...
plugin/auth_pam/auth_pam.c
View file @
ea91bb68
...
...
@@ -17,6 +17,7 @@
#define _GNU_SOURCE 1
/* for strndup */
#include <mysql/plugin_auth.h>
#include <stdio.h>
#include <string.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
...
...
@@ -44,6 +45,13 @@ char *strndup(const char *from, size_t length)
}
#endif
#ifndef DBUG_OFF
static
char
pam_debug
=
0
;
#define PAM_DEBUG(X) do { if (pam_debug) { fprintf X; } } while(0)
#else
#define PAM_DEBUG(X)
/* no-op */
#endif
static
int
conv
(
int
n
,
const
struct
pam_message
**
msg
,
struct
pam_response
**
resp
,
void
*
data
)
{
...
...
@@ -91,12 +99,17 @@ static int conv(int n, const struct pam_message **msg,
4 means "password-like input, echo disabled"
C'est la vie. */
param
->
buf
[
0
]
=
msg
[
i
]
->
msg_style
==
PAM_PROMPT_ECHO_ON
?
2
:
4
;
PAM_DEBUG
((
stderr
,
"PAM: conv: send(%.*s)
\n
"
,
(
int
)(
param
->
ptr
-
param
->
buf
-
1
),
param
->
buf
));
if
(
param
->
vio
->
write_packet
(
param
->
vio
,
param
->
buf
,
param
->
ptr
-
param
->
buf
-
1
))
return
PAM_CONV_ERR
;
pkt_len
=
param
->
vio
->
read_packet
(
param
->
vio
,
&
pkt
);
if
(
pkt_len
<
0
)
{
PAM_DEBUG
((
stderr
,
"PAM: conv: recv() ERROR
\n
"
));
return
PAM_CONV_ERR
;
}
PAM_DEBUG
((
stderr
,
"PAM: conv: recv(%.*s)
\n
"
,
pkt_len
,
pkt
));
/* allocate and copy the reply to the response array */
if
(
!
((
*
resp
)[
i
].
resp
=
strndup
((
char
*
)
pkt
,
pkt_len
)))
return
PAM_CONV_ERR
;
...
...
@@ -134,9 +147,16 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
param
.
ptr
=
param
.
buf
+
1
;
param
.
vio
=
vio
;
PAM_DEBUG
((
stderr
,
"PAM: pam_start(%s, %s)
\n
"
,
service
,
info
->
user_name
));
DO
(
pam_start
(
service
,
info
->
user_name
,
&
pam_start_arg
,
&
pamh
)
);
PAM_DEBUG
((
stderr
,
"PAM: pam_authenticate(0)
\n
"
));
DO
(
pam_authenticate
(
pamh
,
0
)
);
PAM_DEBUG
((
stderr
,
"PAM: pam_acct_mgmt(0)
\n
"
));
DO
(
pam_acct_mgmt
(
pamh
,
0
)
);
PAM_DEBUG
((
stderr
,
"PAM: pam_get_item(PAM_USER)
\n
"
));
DO
(
pam_get_item
(
pamh
,
PAM_USER
,
(
pam_get_item_3_arg
)
&
new_username
)
);
if
(
new_username
&&
strcmp
(
new_username
,
info
->
user_name
))
...
...
@@ -145,6 +165,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
end:
pam_end
(
pamh
,
status
);
PAM_DEBUG
((
stderr
,
"PAM: status = %d user = %s
\n
"
,
status
,
new_username
));
return
status
==
PAM_SUCCESS
?
CR_OK
:
CR_ERROR
;
}
...
...
@@ -163,8 +184,17 @@ static MYSQL_SYSVAR_BOOL(use_cleartext_plugin, use_cleartext_plugin,
"supports simple PAM policies that don't require anything besides "
"a password"
,
NULL
,
NULL
,
0
);
#ifndef DBUG_OFF
static
MYSQL_SYSVAR_BOOL
(
debug
,
pam_debug
,
PLUGIN_VAR_OPCMDARG
,
"Log all PAM activity"
,
NULL
,
NULL
,
0
);
#endif
static
struct
st_mysql_sys_var
*
vars
[]
=
{
MYSQL_SYSVAR
(
use_cleartext_plugin
),
#ifndef DBUG_OFF
MYSQL_SYSVAR
(
debug
),
#endif
NULL
};
...
...
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