You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by su...@apache.org on 2015/05/01 23:41:25 UTC

[1/2] trafficserver git commit: [TS-3531]: Ignore blank lines in the plugin config file

Repository: trafficserver
Updated Branches:
  refs/heads/master 4a4507216 -> 3eb7c1e7e


[TS-3531]: Ignore blank lines in the plugin config file


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

Branch: refs/heads/master
Commit: f39aaba197a4f4d6559a94aa5b8ffa5dcfc3c3b6
Parents: 4a45072
Author: Sudheer Vinukonda <su...@yahoo-inc.com>
Authored: Fri May 1 21:40:27 2015 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Fri May 1 21:40:27 2015 +0000

----------------------------------------------------------------------
 plugins/cacheurl/cacheurl.cc | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f39aaba1/plugins/cacheurl/cacheurl.cc
----------------------------------------------------------------------
diff --git a/plugins/cacheurl/cacheurl.cc b/plugins/cacheurl/cacheurl.cc
index e01407d..5f03598 100644
--- a/plugins/cacheurl/cacheurl.cc
+++ b/plugins/cacheurl/cacheurl.cc
@@ -236,17 +236,23 @@ load_config_file(const char *config_file)
 
   while (TSfgets(fh, buffer, sizeof(buffer) - 1)) {
     lineno++;
-    if (*buffer == '#') {
-      /* # Comments, only at line beginning */
+
+    // make sure line was not bigger than buffer
+    if ((eol = strchr(buffer, '\n')) == NULL && (eol = strstr(buffer, "\r\n")) == NULL) {
+      // Malformed line - skip
+      TSError("%s: config line too long, did not get a good line in cfg, skipping, line: %s", PLUGIN_NAME, buffer);
+      memset(buffer, 0, sizeof(buffer));
       continue;
-    }
-    eol = strstr(buffer, "\n");
-    if (eol) {
-      *eol = 0; /* Terminate string at newline */
     } else {
-      /* Malformed line - skip */
+      *eol = 0;
+    }
+    // make sure line has something useful on it
+    // or allow # Comments, only at line beginning
+    if (eol - buffer < 2 || buffer[0] == '#') {
+      memset(buffer, 0, sizeof(buffer));
       continue;
     }
+
     /* Split line into two parts based on whitespace */
     /* Find first whitespace */
     spstart = strstr(buffer, " ");
@@ -434,6 +440,7 @@ TSPluginInit(int argc, const char *argv[])
   info.support_email = (char *)"dev@trafficserver.apache.org";
 
   if (TSPluginRegister(TS_SDK_VERSION_3_0, &info) != TS_SUCCESS) {
+    TSDebug(PLUGIN_NAME, "ERROR, Plugin registration failed");
     initialization_error("Plugin registration failed.");
     return;
   }
@@ -444,5 +451,9 @@ TSPluginInit(int argc, const char *argv[])
     /* Store the pattern replacement list in the continuation */
     TSContDataSet(contp, prl);
     TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, contp);
+  } else {
+    TSDebug(PLUGIN_NAME, "ERROR, Plugin config load failed.");
+    initialization_error("Plugin config load failed.");
+    return;
   }
 }


[2/2] trafficserver git commit: update CHANGES

Posted by su...@apache.org.
update CHANGES


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

Branch: refs/heads/master
Commit: 3eb7c1e7e5cbccb70990c0f7fbbee6c39442cb72
Parents: f39aaba
Author: Sudheer Vinukonda <su...@yahoo-inc.com>
Authored: Fri May 1 21:41:14 2015 +0000
Committer: Sudheer Vinukonda <su...@yahoo-inc.com>
Committed: Fri May 1 21:41:14 2015 +0000

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3eb7c1e7/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 6c88873..7ca2390 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3531] Ignore blank lines in the plugin config file
+
   *) [TS-3539] Close excess file descriptors in crash log helper.
 
   *) [TS-3576] Remove the need for FIPS locking for OpenSSL