Skip to content

Commit 39c0dae

Browse files
committed
Use zend_bool as return value for _match()
1 parent 674dd73 commit 39c0dae

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ext/openssl/openssl.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4829,7 +4829,7 @@ static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) /* {{{ */
48294829
}
48304830
/* }}} */
48314831

4832-
static int php_openssl_match_cn(const char *subjectname, const char *certname)
4832+
static zend_bool php_openssl_match_cn(const char *subjectname, const char *certname)
48334833
{
48344834
char *wildcard;
48354835
int prefix_len, suffix_len, subject_len;
@@ -4902,7 +4902,6 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stre
49024902
/* Does the common name match ? (used primarily for https://) */
49034903
GET_VER_OPT_STRING("CN_match", cnmatch);
49044904
if (cnmatch) {
4905-
int match = 0;
49064905
int name_len = X509_NAME_get_text_by_NID(name, NID_commonName, buf, sizeof(buf));
49074906

49084907
if (name_len == -1) {
@@ -4913,9 +4912,7 @@ int php_openssl_apply_verification_policy(SSL *ssl, X509 *peer, php_stream *stre
49134912
return FAILURE;
49144913
}
49154914

4916-
match = php_openssl_match_cn(cnmatch, buf);
4917-
4918-
if (!match) {
4915+
if (!php_openssl_match_cn(cnmatch, buf)) {
49194916
/* didn't match */
49204917
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Peer certificate CN=`%.*s' did not match expected CN=`%s'", name_len, buf, cnmatch);
49214918
return FAILURE;

0 commit comments

Comments
 (0)