You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by us...@apache.org on 2015/05/16 16:51:57 UTC

trafficserver git commit: Fix compilation failures on CentOS -- replace nullptr with NULL

Repository: trafficserver
Updated Branches:
  refs/heads/master 1649abc30 -> ada83bb24


Fix compilation failures on CentOS -- replace nullptr with NULL


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/ada83bb2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/ada83bb2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/ada83bb2

Branch: refs/heads/master
Commit: ada83bb24f78eb461e9c43a9c020e3277fd7a44f
Parents: 1649abc
Author: Uri Shachar <us...@apache.org>
Authored: Sat May 16 17:50:47 2015 +0300
Committer: Uri Shachar <us...@apache.org>
Committed: Sat May 16 17:50:47 2015 +0300

----------------------------------------------------------------------
 iocore/net/SSLClientUtils.cc         |  8 ++++----
 lib/ts/X509HostnameValidator.cc      |  8 ++++----
 lib/ts/test_X509HostnameValidator.cc | 18 +++++++++---------
 3 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ada83bb2/iocore/net/SSLClientUtils.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLClientUtils.cc b/iocore/net/SSLClientUtils.cc
index 0ab741c..6c22946 100644
--- a/iocore/net/SSLClientUtils.cc
+++ b/iocore/net/SSLClientUtils.cc
@@ -71,10 +71,10 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
    */
   ssl = static_cast<SSL *>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()));
   SSLNetVConnection *netvc = static_cast<SSLNetVConnection *>(SSL_get_ex_data(ssl, ssl_client_data_index));
-  if (netvc != nullptr) {
+  if (netvc != NULL) {
     // Match SNI if present
     if (netvc->options.sni_servername) {
-      char *matched_name = nullptr;
+      char *matched_name = NULL;
       if (validate_hostname(cert, reinterpret_cast<unsigned char *>(netvc->options.sni_servername.get()), false, &matched_name)) {
         SSLDebug("Hostname %s verified OK, matched %s", netvc->options.sni_servername.get(), matched_name);
         ats_free(matched_name);
@@ -86,7 +86,7 @@ verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
     else {
       char buff[INET6_ADDRSTRLEN];
       ats_ip_ntop(netvc->server_addr, buff, INET6_ADDRSTRLEN);
-      if (validate_hostname(cert, reinterpret_cast<unsigned char *>(buff), true, nullptr)) {
+      if (validate_hostname(cert, reinterpret_cast<unsigned char *>(buff), true, NULL)) {
         SSLDebug("IP %s verified OK", buff);
         return preverify_ok;
       }
@@ -172,7 +172,7 @@ SSLInitClientContext(const SSLConfigParams *params)
 
   // Reserve an application data index for SSL verify callback. Since it's always called within the NetVC
   // context there's no need for allocating - we can simply save a ptr to the NetVC
-  ssl_client_data_index = SSL_get_ex_new_index(0, (void *)"NetVC index", nullptr, nullptr, nullptr);
+  ssl_client_data_index = SSL_get_ex_new_index(0, (void *)"NetVC index", NULL, NULL, NULL);
 
   if (SSLConfigParams::init_ssl_ctx_cb) {
     SSLConfigParams::init_ssl_ctx_cb(client_ctx, false);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ada83bb2/lib/ts/X509HostnameValidator.cc
----------------------------------------------------------------------
diff --git a/lib/ts/X509HostnameValidator.cc b/lib/ts/X509HostnameValidator.cc
index 71e51d8..9ab01d8 100644
--- a/lib/ts/X509HostnameValidator.cc
+++ b/lib/ts/X509HostnameValidator.cc
@@ -47,7 +47,7 @@ find_wildcard_in_hostname(const unsigned char *p, size_t len, bool idna_subject)
   size_t i = 0;
   // Minimum wildcard length *.a.b
   if (len < 5) {
-    return nullptr;
+    return NULL;
   }
 
   int wildcard_pos = -1;
@@ -61,7 +61,7 @@ find_wildcard_in_hostname(const unsigned char *p, size_t len, bool idna_subject)
   }
   // Final dot minimal pos is a.b.xxxxxx
   if (final_dot_pos < 3)
-    return nullptr;
+    return NULL;
 
   for (i = 0; i < final_dot_pos; i++) {
     /*
@@ -92,7 +92,7 @@ find_wildcard_in_hostname(const unsigned char *p, size_t len, bool idna_subject)
       break;
     }
   }
-  return nullptr;
+  return NULL;
 }
 
 
@@ -176,7 +176,7 @@ equal_wildcard(const unsigned char *pattern, size_t pattern_len, const unsigned
   if (subject_len > 5 && subject[0] != '.')
     wildcard = find_wildcard_in_hostname(pattern, pattern_len, is_idna);
 
-  if (wildcard == nullptr)
+  if (wildcard == NULL)
     return equal_nocase(pattern, pattern_len, subject, subject_len);
   return wildcard_match(pattern, wildcard - pattern, wildcard + 1, (pattern + pattern_len) - wildcard - 1, subject, subject_len);
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ada83bb2/lib/ts/test_X509HostnameValidator.cc
----------------------------------------------------------------------
diff --git a/lib/ts/test_X509HostnameValidator.cc b/lib/ts/test_X509HostnameValidator.cc
index 7cf94fc..cfc1674 100644
--- a/lib/ts/test_X509HostnameValidator.cc
+++ b/lib/ts/test_X509HostnameValidator.cc
@@ -99,7 +99,7 @@ REGRESSION_TEST(CN_match)(RegressionTest *t, int /* atype ATS_UNUSED */, int *ps
   box.check(x != NULL, "failed to load the test certificate");
   box.check(validate_hostname(x, (unsigned char *)test_certificate_cn_name, false, &matching) == true, "Hostname should match");
   box.check(strcmp(test_certificate_cn_name, matching) == 0, "Return hostname doesn't match lookup");
-  box.check(validate_hostname(x, (unsigned char *)test_certificate_cn_name + 1, false, nullptr) == false,
+  box.check(validate_hostname(x, (unsigned char *)test_certificate_cn_name + 1, false, NULL) == false,
             "Hostname shouldn't match");
 }
 
@@ -110,11 +110,11 @@ REGRESSION_TEST(bad_wildcard_SANs)(RegressionTest *t, int /* atype ATS_UNUSED */
   box = REGRESSION_TEST_PASSED;
   X509 *x = load_cert_from_string(test_certificate_bad_sans);
   box.check(x != NULL, "failed to load the test certificate");
-  box.check(validate_hostname(x, (unsigned char *)"something.or.other", false, nullptr) == false, "Hostname shouldn't match");
-  box.check(validate_hostname(x, (unsigned char *)"a.b.c", false, nullptr) == false, "Hostname shouldn't match");
-  box.check(validate_hostname(x, (unsigned char *)"0.0.0.0", true, nullptr) == false, "Hostname shouldn't match");
-  box.check(validate_hostname(x, (unsigned char *)"......", true, nullptr) == false, "Hostname shouldn't match");
-  box.check(validate_hostname(x, (unsigned char *)"a.b", true, nullptr) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"something.or.other", false, NULL) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"a.b.c", false, NULL) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"0.0.0.0", true, NULL) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"......", true, NULL) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"a.b", true, NULL) == false, "Hostname shouldn't match");
 }
 
 REGRESSION_TEST(wildcard_SAN_and_CN)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
@@ -131,7 +131,7 @@ REGRESSION_TEST(wildcard_SAN_and_CN)(RegressionTest *t, int /* atype ATS_UNUSED
   box.check(validate_hostname(x, (unsigned char *)"a.trafficserver.org", false, &matching) == true, "Hostname should match");
   box.check(strcmp("*.trafficserver.org", matching) == 0, "Return hostname doesn't match lookup");
 
-  box.check(validate_hostname(x, (unsigned char *)"a.*.trafficserver.org", false, nullptr) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"a.*.trafficserver.org", false, NULL) == false, "Hostname shouldn't match");
 }
 
 REGRESSION_TEST(IDNA_hostnames)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
@@ -164,8 +164,8 @@ REGRESSION_TEST(middle_label_match)(RegressionTest *t, int /* atype ATS_UNUSED *
             "Hostname should match");
   box.check(strcmp("*bar.trafficserver.net", matching) == 0, "Return hostname doesn't match lookup");
 
-  box.check(validate_hostname(x, (unsigned char *)"a.bar.trafficserver.net", false, nullptr) == false, "Hostname shouldn't match");
-  box.check(validate_hostname(x, (unsigned char *)"foo.bar.trafficserver.net", false, nullptr) == false,
+  box.check(validate_hostname(x, (unsigned char *)"a.bar.trafficserver.net", false, NULL) == false, "Hostname shouldn't match");
+  box.check(validate_hostname(x, (unsigned char *)"foo.bar.trafficserver.net", false, NULL) == false,
             "Hostname shouldn't match");
 }