Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Ng
OpenLDAP
Commits
79994bad
Commit
79994bad
authored
21 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
Clean up Bind ppolicy diagnostics
parent
75325bee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
clients/tools/common.c
+15
-8
15 additions, 8 deletions
clients/tools/common.c
with
15 additions
and
8 deletions
clients/tools/common.c
+
15
−
8
View file @
79994bad
...
...
@@ -790,6 +790,9 @@ tool_bind( LDAP *ld )
int
msgid
,
err
;
LDAPMessage
*
result
;
LDAPControl
**
ctrls
;
char
msgbuf
[
256
];
msgbuf
[
0
]
=
0
;
if
((
msgid
=
ldap_bind
(
ld
,
binddn
,
passwd
.
bv_val
,
authmethod
))
==
-
1
)
{
...
...
@@ -811,25 +814,29 @@ tool_bind( LDAP *ld )
#ifdef LDAP_CONTROL_PASSWORDPOLICYREQUEST
if
(
ctrls
&&
ppolicy
)
{
LDAPControl
*
ctrl
;
int
expire
,
grace
;
int
expire
,
grace
,
len
=
0
;
LDAPPasswordPolicyError
pErr
=
-
1
;
ctrl
=
ldap_find_control
(
LDAP_CONTROL_PASSWORDPOLICYRESPONSE
,
ctrls
);
if
(
ctrl
&&
ldap_parse_passwordpolicy_control
(
ld
,
ctrl
,
&
expire
,
&
grace
,
&
pErr
)
==
LDAP_SUCCESS
)
{
if
(
pErr
!=
PP_noError
){
msgbuf
[
0
]
=
';'
;
msgbuf
[
1
]
=
' '
;
strcpy
(
msgbuf
+
2
,
ldap_passwordpolicy_err2txt
(
pErr
));
len
=
strlen
(
msgbuf
);
}
if
(
expire
>=
0
)
{
f
printf
(
stderr
,
"Password expires in %d seconds
\n
"
,
expire
);
s
printf
(
msgbuf
+
len
,
"
(
Password expires in %d seconds
)
"
,
expire
);
}
else
if
(
grace
>=
0
)
{
fprintf
(
stderr
,
"Password expired, %d grace logins remain
\n
"
,
grace
);
}
if
(
pErr
!=
PP_noError
){
fprintf
(
stderr
,
"%s
\n
"
,
ldap_passwordpolicy_err2txt
(
pErr
)
);
sprintf
(
msgbuf
+
len
,
" (Password expired, %d grace logins remain)"
,
grace
);
}
}
}
#endif
if
(
err
!=
LDAP_SUCCESS
)
{
fprintf
(
stderr
,
"ldap_bind: %s
\n
"
,
ldap_err2string
(
err
));
if
(
err
!=
LDAP_SUCCESS
||
msgbuf
[
0
]
)
{
fprintf
(
stderr
,
"ldap_bind: %s%s
\n
"
,
ldap_err2string
(
err
),
msgbuf
);
exit
(
EXIT_FAILURE
);
}
}
...
...
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