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
3742f6f9
Commit
3742f6f9
authored
Jan 12, 2019
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: use only one callback in PAM plugin, not two
parent
3ab44581
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
24 deletions
+10
-24
plugin/auth_pam/auth_pam_base.c
plugin/auth_pam/auth_pam_base.c
+2
-7
plugin/auth_pam/auth_pam_tool.c
plugin/auth_pam/auth_pam_tool.c
+4
-10
plugin/auth_pam/auth_pam_v1.c
plugin/auth_pam/auth_pam_v1.c
+4
-7
No files found.
plugin/auth_pam/auth_pam_base.c
View file @
3742f6f9
...
...
@@ -109,15 +109,10 @@ static int conv(int n, const struct pam_message **msg,
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
(
write_packet
(
param
,
param
->
buf
,
param
->
ptr
-
param
->
buf
-
1
))
return
PAM_CONV_ERR
;
pkt_len
=
read_packet
(
param
,
&
pkt
);
pkt_len
=
roundtrip
(
param
,
param
->
buf
,
param
->
ptr
-
param
->
buf
-
1
,
&
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
)))
...
...
plugin/auth_pam/auth_pam_tool.c
View file @
3742f6f9
...
...
@@ -26,22 +26,16 @@ struct param {
#include "auth_pam_tool.h"
static
int
write_packet
(
struct
param
*
param
__attribute__
((
unused
))
,
const
unsigned
char
*
buf
,
int
buf_len
)
static
int
roundtrip
(
struct
param
*
param
,
const
unsigned
char
*
buf
,
int
buf_len
,
unsigned
char
**
pkt
)
{
unsigned
char
b
=
AP_CONV
;
return
write
(
1
,
&
b
,
1
)
<
1
||
write_string
(
1
,
buf
,
buf_len
);
}
static
int
read_packet
(
struct
param
*
param
,
unsigned
char
**
pkt
)
{
if
(
write
(
1
,
&
b
,
1
)
<
1
||
write_string
(
1
,
buf
,
buf_len
))
return
-
1
;
*
pkt
=
(
unsigned
char
*
)
param
->
buf
;
return
read_string
(
0
,
(
char
*
)
param
->
buf
,
(
int
)
sizeof
(
param
->
buf
))
-
1
;
}
typedef
struct
st_mysql_server_auth_info
{
/**
...
...
plugin/auth_pam/auth_pam_v1.c
View file @
3742f6f9
...
...
@@ -21,14 +21,11 @@ struct param {
MYSQL_PLUGIN_VIO
*
vio
;
};
static
int
write_packet
(
struct
param
*
param
,
const
unsigned
char
*
buf
,
int
buf_len
)
{
return
param
->
vio
->
write_packet
(
param
->
vio
,
buf
,
buf_len
);
}
static
int
read_packet
(
struct
param
*
param
,
unsigned
char
**
pkt
)
static
int
roundtrip
(
struct
param
*
param
,
const
unsigned
char
*
buf
,
int
buf_len
,
unsigned
char
**
pkt
)
{
if
(
param
->
vio
->
write_packet
(
param
->
vio
,
buf
,
buf_len
))
return
-
1
;
return
param
->
vio
->
read_packet
(
param
->
vio
,
pkt
);
}
...
...
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