Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
95837043
Commit
95837043
authored
23 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Patrick Bihan-Faou introduced CURLOPT_SSL_VERIFYHOST and code to deal with
it.
parent
dcfb10fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/ssluse.c
+29
-3
29 additions, 3 deletions
lib/ssluse.c
lib/url.c
+6
-0
6 additions, 0 deletions
lib/url.c
lib/urldata.h
+1
-0
1 addition, 0 deletions
lib/urldata.h
with
36 additions
and
3 deletions
lib/ssluse.c
+
29
−
3
View file @
95837043
...
...
@@ -374,15 +374,39 @@ Curl_SSLConnect(struct connectdata *conn)
NULL
,
0
);
if
(
!
str
)
{
failf
(
data
,
"SSL: couldn't get X509-subject!"
);
X509_free
(
conn
->
ssl
.
server_cert
);
return
CURLE_SSL_CONNECT_ERROR
;
}
infof
(
data
,
"
\t
subject: %s
\n
"
,
str
);
CRYPTO_free
(
str
);
if
(
data
->
ssl
.
verifyhost
)
{
char
peer_CN
[
257
];
if
(
X509_NAME_get_text_by_NID
(
X509_get_subject_name
(
conn
->
ssl
.
server_cert
),
NID_commonName
,
peer_CN
,
sizeof
(
peer_CN
))
<
0
)
{
failf
(
data
,
"SSL: unable to obtain common name from peer certificate"
);
X509_free
(
conn
->
ssl
.
server_cert
);
return
CURLE_SSL_PEER_CERTIFICATE
;
}
if
(
strcasecmp
(
peer_CN
,
conn
->
hostname
)
!=
0
)
{
if
(
data
->
ssl
.
verifyhost
>
1
)
{
failf
(
data
,
"SSL: certificate subject name '%s' does not match target host name '%s'"
,
peer_CN
,
conn
->
hostname
);
X509_free
(
conn
->
ssl
.
server_cert
);
return
CURLE_SSL_PEER_CERTIFICATE
;
}
else
infof
(
data
,
"
\t
common name: %s (does not match '%s')
\n
"
,
peer_CN
,
conn
->
hostname
);
}
else
infof
(
data
,
"
\t
common name: %s (matched)
\n
"
,
peer_CN
);
}
str
=
X509_NAME_oneline
(
X509_get_issuer_name
(
conn
->
ssl
.
server_cert
),
NULL
,
0
);
if
(
!
str
)
{
failf
(
data
,
"SSL: couldn't get X509-issuer name!"
);
X509_free
(
conn
->
ssl
.
server_cert
);
return
CURLE_SSL_CONNECT_ERROR
;
}
infof
(
data
,
"
\t
issuer: %s
\n
"
,
str
);
...
...
@@ -393,9 +417,11 @@ Curl_SSLConnect(struct connectdata *conn)
if
(
data
->
ssl
.
verifypeer
)
{
data
->
ssl
.
certverifyresult
=
SSL_get_verify_result
(
conn
->
ssl
.
handle
);
failf
(
data
,
"SSL certificate verify result: %d
\n
"
,
data
->
ssl
.
certverifyresult
);
retcode
=
CURLE_SSL_PEER_CERTIFICATE
;
if
(
data
->
ssl
.
certverifyresult
!=
X509_V_OK
)
{
failf
(
data
,
"SSL certificate verify result: %d
\n
"
,
data
->
ssl
.
certverifyresult
);
retcode
=
CURLE_SSL_PEER_CERTIFICATE
;
}
}
else
data
->
ssl
.
certverifyresult
=
0
;
...
...
This diff is collapsed.
Click to expand it.
lib/url.c
+
6
−
0
View file @
95837043
...
...
@@ -792,6 +792,12 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
*/
data
->
ssl
.
verifypeer
=
va_arg
(
param
,
long
);
break
;
case
CURLOPT_SSL_VERIFYHOST
:
/*
* Enable verification of the CN contained in the peer certificate
*/
data
->
ssl
.
verifyhost
=
va_arg
(
param
,
long
);
break
;
case
CURLOPT_CAINFO
:
/*
* Set CA info for SSL connection. Specify file name of the CA certificate
...
...
This diff is collapsed.
Click to expand it.
lib/urldata.h
+
1
−
0
View file @
95837043
...
...
@@ -129,6 +129,7 @@ struct ssl_config_data {
long
version
;
/* what version the client wants to use */
long
certverifyresult
;
/* result from the certificate verification */
long
verifypeer
;
/* set TRUE if this is desired */
long
verifyhost
;
/* 0: no verif, 1: check that CN exists, 2: CN must match hostname */
char
*
CApath
;
/* DOES NOT WORK ON WINDOWS */
char
*
CAfile
;
/* cerficate to verify peer against */
char
*
random_file
;
/* path to file containing "random" data */
...
...
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