Replace api.getmails with API endpoint for socketmap
I added the api.getmails
endpoint with the assumption that we would use LDAP for Postfix integration. Socketmap turned out to be the better solution for this. However, the way Postfix does lookups with LDAP differs from the way it uses socketmaps: With LDAP it performs a number of requests (first "user@domain", then "user", finally "@domain") until one returns some results. With socketmap it only performs a single request with the full mail address. I started emulating the LDAP behaviour in the socketmap proxy, but I believe uffd is the better place for this.
The API endpoint gets a single mail address and should return a list of alias mail addresses. It should probably differenciate between empty list and not found (i.e. 404). For compatability with current mail alias data, it should emulate the LDAP behaviour as much as it makes sense.
Postfix lookup order with LDAP:
- "user@domain"
- "user"
- "@domain"
If the address contains an optional address extension (user+extention@domain) Postfix does:
- "user+extention@domain"
- "user@domain"
- "user+extention"
- "user"
- "@domain"
Also, the LDAP attributes used for Postfix integration are IA5Strings with caseIgnoreIA5Match, i.e. ASCII strings with case-insensitive matching. LDAP string matching also does it's version of stringprep (normalizing sequences of spaces, stripping "mapped to nothing characters", ...). Limiting the alias addresses to a sane alphabet and then handling that correctly is probably the way to go.