return 0;
}
- if (!vps) return 0; /* silently fail */
-
/*
* The "format" string is the attribute name.
*/
return 0;
}
+ if (!vps) return 0; /* silently fail */
+
/*
* Convert the VP to a string, and return it.
*/
q += retlen;
/*
- * Regex-style %{1}, %{2}, etc.
+ * Look up the name, in order to get the correct
+ * debug message.
*/
+#ifndef NDEBUG
} else if (dict_attrbyname(attrname) == NULL) {
/*
* No attribute by that name, return an error.
*/
DEBUG2("WARNING: Attempt to use unknown xlat function, or non-existent attribute in string %%{%s}", attrname);
-
+#endif
} /* else the attribute is known, but not in the request */
/*
*/
if (found) {
while((*p != '\0') && (openbraces > 0)) {
+ /*
+ * Handle escapes outside of the loop.
+ */
+ if (*p == '\\') {
+ p++;
+ if (!*p) break;
+ p++; /* get & ignore next character */
+ continue;
+ }
+
switch (*p) {
default:
break;
/*
- * Ensure that escaped braces are allowed.
- */
- case '\\':
- p++; /* skip the escaped character */
- break;
-
- /*
* Bare brace
*/
case '{':
p++;
/*
- * Hmmm... ${User-Name} is a synonym for %{User-Name}
+ * Hmmm... ${User-Name} is a synonym for
+ * %{User-Name}.
+ *
* Why, exactly?
*/
} else if (c == '$') switch(*p) {