Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
James Lowden
OpenLDAP
Commits
3323f9d0
Commit
3323f9d0
authored
14 years ago
by
Quanah Gibson-Mount
Browse files
Options
Downloads
Patches
Plain Diff
ITS#6589
allow self-signed server certs
parent
60155076
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
libraries/libldap/tls_m.c
+31
-4
31 additions, 4 deletions
libraries/libldap/tls_m.c
with
31 additions
and
4 deletions
libraries/libldap/tls_m.c
+
31
−
4
View file @
3323f9d0
...
...
@@ -1491,11 +1491,38 @@ tlsm_find_and_verify_cert_key(tlsm_ctx *ctx, PRFileDesc *fd, const char *certnam
status
=
CERT_VerifyCertificateNow
(
ctx
->
tc_certdb
,
cert
,
checkSig
,
certUsage
,
pin_arg
,
NULL
);
if
(
status
!=
SECSuccess
)
{
if
(
status
!=
SECSuccess
)
{
/* NSS doesn't like self-signed CA certs that are also used for
TLS/SSL server certs (such as generated by openssl req -x509)
CERT_VerifyCertificateNow returns SEC_ERROR_UNTRUSTED_ISSUER in that case
so, see if the cert and issuer are the same cert
*/
PRErrorCode
errcode
=
PR_GetError
();
Debug
(
LDAP_DEBUG_ANY
,
"TLS: error: the certificate %s is not valid - error %d:%s
\n
"
,
certname
,
errcode
,
PR_ErrorToString
(
errcode
,
PR_LANGUAGE_I_DEFAULT
)
);
if
(
errcode
==
SEC_ERROR_UNTRUSTED_ISSUER
)
{
CERTCertificate
*
issuer
=
CERT_FindCertIssuer
(
cert
,
PR_Now
(),
certUsageSSLServer
);
if
(
NULL
==
issuer
)
{
/* no issuer - fail */
Debug
(
LDAP_DEBUG_ANY
,
"TLS: error: the server certificate %s has no issuer - "
"please check this certificate for validity
\n
"
,
certname
,
0
,
0
);
}
else
if
(
CERT_CompareCerts
(
cert
,
issuer
)
)
{
/* self signed - warn and allow */
status
=
SECSuccess
;
rc
=
0
;
Debug
(
LDAP_DEBUG_ANY
,
"TLS: warning: using self-signed server certificate %s
\n
"
,
certname
,
0
,
0
);
}
CERT_DestroyCertificate
(
issuer
);
}
if
(
status
!=
SECSuccess
)
{
Debug
(
LDAP_DEBUG_ANY
,
"TLS: error: the certificate %s is not valid - error %d:%s
\n
"
,
certname
,
errcode
,
PR_ErrorToString
(
errcode
,
PR_LANGUAGE_I_DEFAULT
)
);
}
}
else
{
rc
=
0
;
/* success */
}
...
...
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