On Thu, Apr 17, 2014 at 01:08:11PM -0400, Wietse Venema wrote: > For example, "dc=%{labels:d,}" produces a comma-separated list of > "dc=example, dc=com" given an email address of u...@example.com.
This specific example works poorly, because the construct in question is part of a larger single string template, and there is no way to know how back or forward to go in repeating prefixes and suffixes. search_base = OU=People,dc=%{labels:d,},o=Acme Inc Unlike the pipe(8) case, the output is a single string, not an argv vector. So the "dc=" would have to go inside the construct in something plausibly less verbose than: %{labels:d;prefix=dc=;separator=,} which is all fine and good, but I still have no plausible use-case for any such generalization. The Dovecot trick of leaving out the first prefix, is cute, it is far from clear why one would expect a fixed strategy of a different RDN type for just the first domain component to work generally for multiple domains, and especially because the first domain component is in fact a domain component, and NOT some other kind of name. So while I understand Wietse's point, no sensible generalization comes to mind that is not just mere code and complexity with no plausible application. I'd like to see a reasonable use-case for doing something else with domain components in LDAP, and perhaps also MySQL, PgSQL, ... tables, that generalizes "dc=example,dc=com" with input "example.com", before writing more general code that may never get used. I realize this leaves "%," deadlocked for now between opposite poles of "too specialized" and "needlessly over-generalized". Resolving this requires either new insight to find the more general use-cases, or sufficient evidence to conclude that nothing more general is likely to emerge. -- Viktor.