trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject trafficserver git commit: TS-3393: fix records with missing validation expressions
Date Sat, 07 Mar 2015 20:11:23 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 2b48fd327 -> a639d04ed


TS-3393: fix records with missing validation expressions

If a configuration record has a validation check type, it must always
have a validation expression. Fix all records that have a missing
expression and add a fatal startup check so this doesn't happen in
the future.


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

Branch: refs/heads/master
Commit: a639d04edaac1ac604dac32b4b894b2b081178f4
Parents: 2b48fd3
Author: James Peach <jpeach@apache.org>
Authored: Mon Feb 23 14:13:00 2015 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Sat Mar 7 12:00:48 2015 -0800

----------------------------------------------------------------------
 CHANGES                    |  2 ++
 mgmt/RecordsConfig.cc      | 22 +++++++++++-----------
 mgmt/RecordsConfigUtils.cc |  6 ++++++
 3 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a639d04e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ae9a17e..320d0c6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3393] Fix records with missing validation expressions.
+
   *) [TS-3424] SSL Failed: decryption failed or bad record mac.
 
   *) [TS-3425] include conditional headers in origin request, on no cache store

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a639d04e/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 8e4eab5..03a32ec 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -104,7 +104,7 @@ static const RecordElement RecordsConfig[] =
   //# Traffic Server system settings
   //##############################################################################
   // The maximum number of chunks to allocate with mmap. Setting this to zero disables all
use of mmap. (Unix only)
-  {RECT_CONFIG, "proxy.config.system.mmap_max", RECD_INT, "2097152", RECU_RESTART_TS, RR_NULL,
RECC_INT, NULL, RECA_READ_ONLY}
+  {RECT_CONFIG, "proxy.config.system.mmap_max", RECD_INT, "2097152", RECU_RESTART_TS, RR_NULL,
RECC_NULL, NULL, RECA_READ_ONLY}
   ,
   // The percent of the /proc/sys/fs/file-max value to set the RLIMIT_NOFILE cur/max to
   {RECT_CONFIG, "proxy.config.system.file_max_pct", RECD_FLOAT, "0.9", RECU_RESTART_TS, RR_NULL,
RECC_NULL, NULL, RECA_READ_ONLY}
@@ -127,7 +127,7 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.user_name", RECD_STRING, "nobody", RECU_NULL, RR_NULL, RECC_NULL,
NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.restart.active_client_threshold", RECD_INT, "0", RECU_DYNAMIC,
RR_NULL, RECC_INT, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.restart.active_client_threshold", RECD_INT, "0", RECU_DYNAMIC,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
 
   //##############################################################################
@@ -978,9 +978,9 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.dns.nameservers", RECD_STRING, NULL, RECU_DYNAMIC, RR_NULL,
RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.dns.local_ipv6", RECD_STRING, NULL, RECU_RESTART_TS, RR_NULL,
RECC_STR, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.dns.local_ipv6", RECD_STRING, NULL, RECU_RESTART_TS, RR_NULL,
RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.dns.local_ipv4", RECD_STRING, NULL, RECU_RESTART_TS, RR_NULL,
RECC_STR, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.dns.local_ipv4", RECD_STRING, NULL, RECU_RESTART_TS, RR_NULL,
RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.dns.resolv_conf", RECD_STRING, "/etc/resolv.conf", RECU_RESTART_TS,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
@@ -988,7 +988,7 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.dns.dedicated_thread", RECD_INT, "0", RECU_RESTART_TS, RR_NULL,
RECC_NULL, "[0-1]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.hostdb.ip_resolve", RECD_STRING, NULL, RECU_RESTART_TS, RR_NULL,
RECC_STR, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.hostdb.ip_resolve", RECD_STRING, NULL, RECU_RESTART_TS, RR_NULL,
RECC_NULL, NULL, RECA_NULL}
   ,
 
   //##############################################################################
@@ -1042,7 +1042,7 @@ static const RecordElement RecordsConfig[] =
   //       # how often should the hostdb be synced (seconds)
   {RECT_CONFIG, "proxy.config.cache.hostdb.sync_frequency", RECD_INT, "120", RECU_DYNAMIC,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.hostdb.host_file.path", RECD_STRING, "/etc/hosts", RECU_DYNAMIC,
RR_NULL, RECC_STR, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.hostdb.host_file.path", RECD_STRING, "/etc/hosts", RECU_DYNAMIC,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.hostdb.host_file.interval", RECD_INT, "86400", RECU_DYNAMIC,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
@@ -1226,7 +1226,7 @@ static const RecordElement RecordsConfig[] =
   // # 2 - URL_REMAP_FOR_OS remap url's for requests to OS's only
   {RECT_CONFIG, "proxy.config.url_remap.url_remap_mode", RECD_INT, "1", RECU_RESTART_TS,
RR_NULL, RECC_INT, "[0-2]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.url_remap.handle_backdoor_urls", RECD_INT, "0", RECU_RESTART_TS,
RR_NULL, RECC_INT, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.url_remap.handle_backdoor_urls", RECD_INT, "0", RECU_RESTART_TS,
RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
   ,
 
   //##############################################################################
@@ -1276,7 +1276,7 @@ static const RecordElement RecordsConfig[] =
   ,
   {RECT_CONFIG, "proxy.config.ssl.server.cert.path", RECD_STRING, TS_BUILD_SYSCONFDIR, RECU_RESTART_TS,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.ssl.server.cert_chain.filename", RECD_STRING, NULL, RECU_RESTART_TS,
RR_NULL, RECC_STR, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.ssl.server.cert_chain.filename", RECD_STRING, NULL, RECU_RESTART_TS,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.ssl.server.multicert.filename", RECD_STRING, "ssl_multicert.config",
RECU_RESTART_TS, RR_NULL, RECC_NULL, NULL, RECA_NULL}
   ,
@@ -1350,7 +1350,7 @@ static const RecordElement RecordsConfig[] =
   //##############################################################################
   {RECT_CONFIG, "proxy.config.icp.enabled", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_INT,
"[0-2]", RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.icp.stale_icp_enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL,
RECC_INT, NULL, RECA_NULL}
+  {RECT_CONFIG, "proxy.config.icp.stale_icp_enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL,
RECC_INT, "[0-1]", RECA_NULL}
   ,
   {RECT_CONFIG, "proxy.config.icp.icp_interface", RECD_STRING, NULL, RECU_RESTART_TS, RR_REQUIRED,
RECC_NULL, NULL, RECA_NULL}
   ,
@@ -1376,9 +1376,9 @@ static const RecordElement RecordsConfig[] =
   //# WCCP
   //#
   //############################################################################
-  {RECT_LOCAL, "proxy.config.wccp.addr", RECD_STRING, "", RECU_RESTART_TM, RR_NULL, RECC_STR,
NULL, RECA_NULL}
+  {RECT_LOCAL, "proxy.config.wccp.addr", RECD_STRING, "", RECU_RESTART_TM, RR_NULL, RECC_NULL,
NULL, RECA_NULL}
   ,
-  {RECT_CONFIG, "proxy.config.wccp.services", RECD_STRING, "", RECU_RESTART_TM, RR_NULL,
RECC_STR, NULL, RECA_NULL }
+  {RECT_CONFIG, "proxy.config.wccp.services", RECD_STRING, "", RECU_RESTART_TM, RR_NULL,
RECC_NULL, NULL, RECA_NULL }
   ,
 
   //##############################################################################

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a639d04e/mgmt/RecordsConfigUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfigUtils.cc b/mgmt/RecordsConfigUtils.cc
index 52df061..b74759e 100644
--- a/mgmt/RecordsConfigUtils.cc
+++ b/mgmt/RecordsConfigUtils.cc
@@ -86,6 +86,12 @@ initialize_record(const RecordElement * record, void *)
     const char * value = RecConfigOverrideFromEnvironment(record->name, record->value);
     RecData data = {0};
 
+    // If you specify a consistency check, you have to specify a regex expression. We abort
here
+    // so that this breaks QA completely.
+    if (record->check != RECC_NULL && record->regex == NULL) {
+      ink_fatal("%s has a consistency check but no regular expression", record->name);
+    }
+
     RecDataSetFromString(record->value_type, &data, value);
 
     switch (record->value_type) {


Mime
View raw message