Looks like nobody actually ran the trivial "-k parse" test using 3.HEAD or the initial quoted strings code.

Attached is a patch which adds a secondary form of undo for handling incorrectly identified ConfigParser::FunctionNameToken elements. Instead of aborting Squid on any non-function token containing a '(' we take the wrongly identified assumed function name element and reform it with the '(' delimiter and trailing element. The resulting aggregate token which should have been identified initially is then sent to the upper parser layer.

Amos

=== modified file 'src/ConfigParser.cc'
--- src/ConfigParser.cc 2013-07-22 01:26:09 +0000
+++ src/ConfigParser.cc 2013-07-29 16:50:58 +0000
@@ -280,7 +280,8 @@
         if (!token)
             token = NextElement(LastTokenType);
 
-        if (token &&  LastTokenType == ConfigParser::FunctionNameToken && 
strcmp("parameters", token) == 0) {
+        if (token && LastTokenType == ConfigParser::FunctionNameToken) {
+          if (strcmp("parameters", token) == 0) {
             char *path = NextToken();
             if (LastTokenType != ConfigParser::QuotedToken) {
                 debugs(3, DBG_CRITICAL, "Quoted filename missing: " << token);
@@ -311,11 +312,19 @@
             }
             CfgFiles.push(wordfile);
             token = NULL;
-        } else if (token &&  LastTokenType == ConfigParser::FunctionNameToken) 
{
-            debugs(3, DBG_CRITICAL, "Unknown cfg function: " << token);
-            self_destruct();
-            return NULL;
+        } else {
+            debugs(3, 3, "Unknown cfg function: " << token);
+
+            // we have determined tha the whole of this token is not a 
built-in function() style token
+            // ignore any further '(' as well
+            // concatenate this token, the '('-delimiter which confused things 
and next token.
+            // send to the undo queue for better processing next time around
+            LOCAL_ARRAY(char, tbuf, CONFIG_LINE_LIMIT);
+            const char *temp = NextElement(LastTokenType, false);
+            snprintf(tbuf, sizeof(tbuf)-1, "%s(%s", token, temp);
+            return (LastToken = tbuf);
         }
+      }
     } while (token == NULL && !CfgFiles.empty());
 
     return (LastToken = token);

Reply via email to