CRM-11160 - Set CURLOPT_SSL_VERIFYHOST based the system's general "verifySSL" option
authorTim Otten <totten@civicrm.org>
Wed, 3 Jul 2013 00:45:56 +0000 (17:45 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 3 Jul 2013 00:45:56 +0000 (17:45 -0700)
----------------------------------------
* CRM-11160:
  http://issues.civicrm.org/jira/browse/CRM-11160

CRM/Core/Payment/Elavon.php
CRM/Core/Payment/FirstData.php
CRM/Core/Payment/Google.php
CRM/Core/Payment/PayPalImpl.php
CRM/Core/Payment/PayflowPro.php
CRM/Core/Payment/PaymentExpressUtils.php

index 19fa8c997f5a51b0b4333bc8129ea4d2863c3b9f..b56ef330a7868b78a890cf4faceb1f0874c96bb2 100644 (file)
@@ -181,7 +181,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
       return self::errorExit(9004, 'Could not initiate connection to payment gateway');
     }
 
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
     // return the result on success, FALSE on failure
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
index 950f159b06c5ada037ad435133f52278642c333f..d816972f63bb103001f4272a967ff5fb35155e46 100644 (file)
@@ -216,7 +216,7 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment {
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $requestxml);
     curl_setopt($ch, CURLOPT_SSLCERT, $key);
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
     // return the result on success, FALSE on failure
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
index eb43f6a3af3e2f0d8fdb8fc6775c1770e32359c1..2bb507e323822bc3508b47a70204b6e1aaed6480 100644 (file)
@@ -301,7 +301,7 @@ class CRM_Core_Payment_Google extends CRM_Core_Payment {
 
     //turning off the server and peer verification(TrustManager Concept).
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
index d798b204402679b05c6ada9cf45008b31e18e204..edad3ee114d94488e19d794ed346718b1c7361cd 100644 (file)
@@ -680,7 +680,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
 
     //turning off the server and peer verification(TrustManager Concept).
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
index 5104ffc18f2bbe53b9a42a20b3a3283fa3502a51..442a61d7cae2b6fa3d33adf2bc2a0392efda2788 100644 (file)
@@ -489,7 +489,7 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
     // this line makes it work under https
     curl_setopt($ch, CURLOPT_POSTFIELDS, $payflow_query);
     //adding POST data
-    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
+    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
     //verifies ssl certificate
     curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
     //forces closure of connection when done
index 7f3ee8e0d8b963ffa35b82cf7f9a6e28c5be09af..617c6244cb4a288c69fe53a3ac5e99ff48766cbd 100644 (file)
@@ -73,7 +73,7 @@ function &_initCURL($query, $url) {
 
   if (strtoupper(substr(@php_uname('s'), 0, 3)) === 'WIN') {
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL'));
-    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'verifySSL') ? 2 : 0);
   }
   return $curl;
 }