Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goatherd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arw
goatherd
Commits
fac1a692
"public/init.te" did not exist on "6cb2c893b12db00c73009f6ab1f6c69426b0cc05"
Commit
fac1a692
authored
8 years ago
by
Lukas Braun
Browse files
Options
Downloads
Patches
Plain Diff
pam: check received length before comparing response
parent
7247ffbe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pam_goatherd.c
+8
-4
8 additions, 4 deletions
pam_goatherd.c
with
8 additions
and
4 deletions
pam_goatherd.c
+
8
−
4
View file @
fac1a692
...
...
@@ -28,6 +28,9 @@ static const char arg_server[] = "server=";
static
const
char
arg_port
[]
=
"port="
;
static
const
char
arg_certs
[]
=
"certs="
;
static
const
char
str_ok
[]
=
"OK
\n
"
;
static
const
char
str_fail
[]
=
"FAIL
\n
"
;
#define dbgp(msg) do { \
if (cfg.debug) fprintf(stderr, "[%s:%s:%i] %s\n", __FILE__, __FUNCTION__, __LINE__, msg); \
} while(0)
...
...
@@ -194,18 +197,19 @@ static int check_hotp(struct cfg cfg, const char *user, const char *hotp)
}
char
buf
[
5
];
if
((
err
=
gnutls_record_recv
(
session
,
&
buf
,
sizeof
(
buf
)
-
1
))
<
0
)
ssize_t
recvd
;
if
((
recvd
=
gnutls_record_recv
(
session
,
&
buf
,
sizeof
(
buf
)
-
1
))
<
0
)
{
dbgp2
(
"error in send"
,
gnutls_strerror
(
err
));
dbgp2
(
"error in send"
,
gnutls_strerror
(
(
int
)
recvd
));
err
=
PAM_AUTHINFO_UNAVAIL
;
goto
bye
;
}
// auth succeeded?
if
(
!
strncmp
(
buf
,
"OK"
,
2
))
{
if
(
recvd
>=
strlen
(
str_ok
)
&&
!
strncmp
(
buf
,
str_ok
,
strlen
(
str_ok
)
))
{
dbgp
(
"OK"
);
err
=
PAM_SUCCESS
;
}
else
if
(
!
strncmp
(
buf
,
"FAIL"
,
4
))
{
}
else
if
(
recvd
>=
strlen
(
str_fail
)
&&
!
strncmp
(
buf
,
str_fail
,
strlen
(
str_fail
)
))
{
dbgp
(
"FAIL"
);
err
=
PAM_AUTH_ERR
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment