=== modified file 'src/cf.data.pre' --- src/cf.data.pre 2011-11-08 13:40:26 +0000 +++ src/cf.data.pre 2011-11-09 14:58:06 +0000 @@ -521,7 +521,7 @@ This option defines external acl classes using a helper program to look up the status - external_acl_type name [options] FORMAT.. /path/to/helper [helper arguments..] + external_acl_type name [options] [FORMAT..] /path/to/helper [helper arguments..] Options: @@ -593,7 +593,8 @@ character. %% The percent sign. Useful for helpers which need - an unchanging input format. + an unchanging but not blank input format. + %%{..} Staic text In addition to the above, any string specified in the referencing acl will also be included in the helper request line, after the === modified file 'src/external_acl.cc' --- src/external_acl.cc 2011-11-06 22:52:18 +0000 +++ src/external_acl.cc 2011-11-09 15:16:47 +0000 @@ -190,7 +190,7 @@ #endif EXT_ACL_EXT_LOG, EXT_ACL_TAG, - EXT_ACL_PERCENT, + EXT_ACL_STATIC, EXT_ACL_END } type; external_acl_format *next; @@ -247,7 +247,7 @@ \param type - format enum identifier for this element, pulled from identifying prefix \param format - structure to contain all the info about this format element. */ -void +static void parse_header_token(external_acl_format *format, char *header, const _external_acl_format::format_type type) { /* header format */ @@ -299,6 +299,27 @@ } } +/** + * Parse the External ACL format %%{.*} static token + * + \param header - the token being parsed (without the identifying prefix) + \param type - format enum identifier for this element, pulled from identifying prefix + \param format - structure to contain all the info about this format element. + */ +static void +parse_static_token(external_acl_format *format, char *header, const _external_acl_format::format_type type) +{ + /** Cut away the closing brace */ + char *end = strchr(header, '}'); + if (end && strlen(end) == 1) + *end = '\0'; + else + self_destruct(); + + format->type = type; + format->header = xstrdup(header); +} + void parse_externalAclHelper(external_acl ** list) { @@ -473,7 +494,9 @@ else if (strcmp(token, "%TAG") == 0) format->type = _external_acl_format::EXT_ACL_TAG; else if (strcmp(token, "%%") == 0) - format->type = _external_acl_format::EXT_ACL_PERCENT; + format->type = _external_acl_format::EXT_ACL_STATIC; + else if (strncmp(token, "%%{", 3) == 0) + parse_static_token(format, (token+3), _external_acl_format::EXT_ACL_STATIC); else { debugs(0,0, "ERROR: Unknown Format token " << token); self_destruct(); @@ -484,10 +507,6 @@ token = strtok(NULL, w_space); } - /* There must be at least one format token */ - if (!a->format) - self_destruct(); - /* helper */ if (!token) self_destruct(); @@ -1099,8 +1118,10 @@ case _external_acl_format::EXT_ACL_TAG: str = request->tag.termedBuf(); break; - case _external_acl_format::EXT_ACL_PERCENT: + case _external_acl_format::EXT_ACL_STATIC: str = "%"; + if (format->header) + str = format->header; break; case _external_acl_format::EXT_ACL_UNKNOWN: