@@ -35,6 +35,7 @@ int ssl_verify_certificate_validity(int s, X509_STORE_CTX *store) {
35
35
_cleanup_free_ char * pretty = NULL ;
36
36
union sockaddr_union sa ;
37
37
int r ;
38
+ long rc ;
38
39
39
40
assert (store );
40
41
@@ -57,26 +58,26 @@ int ssl_verify_certificate_validity(int s, X509_STORE_CTX *store) {
57
58
return 1 ;
58
59
}
59
60
60
- r = SSL_get_verify_result (ssl );
61
- if (r != X509_V_OK ) {
62
- switch (r ) {
61
+ rc = SSL_get_verify_result (ssl );
62
+ if (rc != X509_V_OK ) {
63
+ switch (rc ) {
63
64
case X509_V_ERR_CERT_HAS_EXPIRED : {
64
65
switch (m -> auth_mode ) {
65
66
case OPEN_SSL_CERTIFICATE_AUTH_MODE_DENY : {
66
67
log_error_errno (SYNTHETIC_ERRNO (EINVAL ),
67
- "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
68
+ "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
68
69
return 0 ;
69
70
}
70
71
break ;
71
72
case OPEN_SSL_CERTIFICATE_AUTH_MODE_WARN : {
72
73
log_warning_errno (SYNTHETIC_ERRNO (EINVAL ),
73
- "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
74
+ "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
74
75
75
76
return 1 ;
76
77
}
77
78
break ;
78
79
case OPEN_SSL_CERTIFICATE_AUTH_MODE_ALLOW : {
79
- log_debug ("TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
80
+ log_debug ("TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
80
81
return 1 ;
81
82
}
82
83
@@ -89,20 +90,20 @@ int ssl_verify_certificate_validity(int s, X509_STORE_CTX *store) {
89
90
switch (m -> auth_mode ) {
90
91
case OPEN_SSL_CERTIFICATE_AUTH_MODE_DENY : {
91
92
log_error_errno (SYNTHETIC_ERRNO (EINVAL ),
92
- "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
93
+ "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
93
94
return 0 ;
94
95
}
95
96
break ;
96
97
case OPEN_SSL_CERTIFICATE_AUTH_MODE_WARN : {
97
98
log_warning_errno (SYNTHETIC_ERRNO (EINVAL ),
98
- "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
99
+ "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
99
100
100
101
return 1 ;
101
102
}
102
103
break ;
103
104
case OPEN_SSL_CERTIFICATE_AUTH_MODE_ALLOW : {
104
105
log_debug_errno (SYNTHETIC_ERRNO (EINVAL ),
105
- "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
106
+ "TLS: Failed to verify certificate server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
106
107
return 1 ;
107
108
}
108
109
break ;
@@ -111,12 +112,12 @@ int ssl_verify_certificate_validity(int s, X509_STORE_CTX *store) {
111
112
}}
112
113
break ;
113
114
default :
114
- log_error ("TLS: Failed to validate remote certificate server=%s: %s. Aborting connection ..." , pretty , X509_verify_cert_error_string (r ));
115
+ log_error ("TLS: Failed to validate remote certificate server=%s: %s. Aborting connection ..." , pretty , X509_verify_cert_error_string (rc ));
115
116
return 0 ;
116
117
}
117
118
}
118
119
119
- log_debug ("TLS: SSL ceritificates verified server=%s: %s" , pretty , X509_verify_cert_error_string (r ));
120
+ log_debug ("TLS: SSL ceritificates verified server=%s: %s" , pretty , X509_verify_cert_error_string (rc ));
120
121
121
122
return 1 ;
122
123
}
0 commit comments