strncpy(undoToken, undo.front().c_str(), sizeof(undoToken));
undoToken[sizeof(undoToken) - 1] = '\0';
undo.pop();
- return undoToken;
+ return lastToken = undoToken;
}
- // XXX: add file:name support to the quoted string-aware parser
+ if (RecognizeQuotedValues)
+ return lastToken = ConfigParser::NextToken();
+
lastToken = NULL;
do {
strtok(s-1, "\""); /*Reset the strtok to point after the " */
*s = '\0';
- var->reset(token+1);
+ return (token+1);
}
- // TODO: support file:name syntax to auto-include files, but think how
- // admins will be able to disable that interpretation w/o disabling
- // macros and other special value processing. The "file:" prefix or
- // any similar key construct would probably have to go outside the
- // optionally quoted string for that to work: file:"name with $macros".
+ char *
+ ConfigParser::NextToken()
+ {
+ return NextElement(NULL);
+ }
+
+
const char *
-ConfigParser::QuoteString(String &var)
+ConfigParser::QuoteString(const String &var)
{
static String quotedStr;
const char *s = var.termedBuf();
int parseConfigFile(const char *file_name);
-/// XXX: Used for temporary hacks to allow old code to handle quoted values
++/// Used for temporary hacks to allow old code to handle quoted values
+ /// without replacing every strtok() call.
+ extern char *xstrtok(char *str, const char *delimiters);
+
+
#endif /* SQUID_CONFIGPARSER_H */
{
debugs(28, 3, "ACL::~ACL: '" << cfgline << "'");
safe_free(cfgline);
+ AclMatchedName = NULL; // in case it was pointing to our name
}
-/* to be split into separate files in the future */
-
-CBDATA_CLASS_INIT(acl_access);
-
-void *
-acl_access::operator new (size_t)
-{
- CBDATA_INIT_TYPE(acl_access);
- acl_access *result = cbdataAlloc(acl_access);
- return result;
-}
-
-void
-acl_access::operator delete (void *address)
-{
- acl_access *t = static_cast<acl_access *>(address);
- cbdataFree(t);
-}
-
-/// XXX: Temporary hack to allow old ACL code to handle quoted values without
++/// Temporary hack to allow old ACL code to handle quoted values without
+ /// replacing every strtok() call.
+ char *
+ ACL::strtok(char *str, const char *delimiters)
+ {
+ return xstrtok(str, delimiters);
+ }
+
ACL::Prototype::Prototype() : prototype (NULL), typeString (NULL) {}
ACL::Prototype::Prototype (ACL const *aPrototype, char const *aType) : prototype (aPrototype), typeString (aType)
void registerMe();
};
+private:
+ /// Matches the actual data in checklist against this ACL.
+ virtual int match(ACLChecklist *checklist) = 0; // XXX: missing const
+
+ /// whether our (i.e. shallow) match() requires checklist to have a request
+ virtual bool requiresRequest() const;
+ /// whether our (i.e. shallow) match() requires checklist to have a reply
+ virtual bool requiresReply() const;
++
+ protected:
+ static char *strtok(char *str, const char *delimiters);
};
/// \ingroup ACLAPI
*****************************************************************************/
static void
-dump_acl(StoreEntry * entry, const char *name, ACL * ae)
+dump_wordlist(StoreEntry * entry, wordlist *words)
{
- wordlist *w;
- wordlist *v;
+ for (wordlist *word = words; word; word = word->next)
++ // XXX: use something like ConfigParser::QuoteString() here
+ storeAppendPrintf(entry, "%s ", word->key);
+}
+static void
+dump_acl(StoreEntry * entry, const char *name, ACL * ae)
+{
while (ae != NULL) {
debugs(3, 3, "dump_acl: " << name << " " << ae->name);
storeAppendPrintf(entry, "%s %s %s %s ",
configuration files.
- XXX: Document escaping and macro substitution rules inside quoted
- strings.
+ Values with spaces, quotes, and other special characters
+
+ Squid supports directive parameters with spaces, quotes, and other
+ special characters. Surround such parameters with "double quotes". Use
+ the configuration_includes_quoted_values directive to enable or
+ disable that support.
+
- XXX: Support single-quoted strings that prevent macro substitution.
++ For example;
+
++ configuration_includes_quoted_values on
++ acl group external groupCheck Administrators "Internet Users" Guest
++ configuration_includes_quoted_values off
+
+
Conditional configuration
If-statements can be used to make configuration directives
-----------------------------------------------------------------------------
COMMENT_END
-DEFAULT: on
+ NAME: configuration_includes_quoted_values
+ COMMENT: on|off
+ TYPE: onoff
- If set, Squid will recognize each "quoted string" as a single
- configuration directive parameter. The quotes are stripped before the
- parameter value is interpreted or used. XXX: Give more details.
++DEFAULT: off
+ LOC: ConfigParser::RecognizeQuotedValues
+ DOC_START
++ Previous Squid versions have defined "quoted/string" as syntax for
++ ACL to signifiy the value is an included file containing values and
++ has treated the " characters in other places of the configuration file
++ as part of the parameter value it was used for.
++
++ For compatibility with existing installations that behaviour
++ remains the default.
++
++ If this directive is set to 'on', Squid will start parsing each
++ "quoted string" as a single configuration directive parameter. The
++ quotes are stripped before the parameter value is interpreted or use.
++
++ That will continue for all lines until this directive is set to 'off',
++ where Squid will return to the default configuration parsing.
++
++ For example;
++
++ configuration_includes_quoted_values on
++ acl group external groupCheck Administrators "Internet Users" Guest
++ configuration_includes_quoted_values off
++
+ DOC_END
+
NAME: memory_pools
COMMENT: on|off
TYPE: onoff