Loading ...
Sorry, an error occurred while loading the content.

Re: Problem with relay_domains lookups

Expand Messages
  • Wietse Venema
    ... That was the mistake. As documented in ldap_table(5): %d When the input key is an address of the form user@domain, %d is replaced by the (RFC 2253)
    Message 1 of 6 , Feb 20, 2013
    • 0 Attachment
      Geoff Shang:
      > On Wed, 20 Feb 2013, Noel Jones wrote:
      >
      > > Postfix uses the domain as the lookup key, not the whole address.
      > > Test with:
      > >
      > > $ postmap -q example.com ldap:/etc/postfix/ldap-domains.cf
      >
      > I was initially doing this but it didn't work.
      >
      > In ldap-domains.cf, I use %d as the key to look for. Should I be using %s

      That was the mistake. As documented in ldap_table(5):

      %d When the input key is an address of the form user@domain,
      %d is replaced by the (RFC 2253) quoted domain part of
      the address. Otherwise, the search is suppressed and
      returns no results.

      You probably want this:

      %s This is replaced by the input key. RFC 2253 quoting is
      used to make sure that the input key does not add unex-
      pected metacharacters.


      But, like Noel. I have no LDAP experience.

      Wietse
    • Geoff Shang
      ... You re right. This was the problem. My initial mistake was taking a postgresql example of a relay_domains lookup which I assumed to be functional, and
      Message 2 of 6 , Feb 21, 2013
      • 0 Attachment
        On Wed, 20 Feb 2013, Wietse Venema wrote:

        >> In ldap-domains.cf, I use %d as the key to look for. Should I be using %s
        >
        > That was the mistake. As documented in ldap_table(5):
        >
        > %d When the input key is an address of the form user@domain,
        > %d is replaced by the (RFC 2253) quoted domain part of
        > the address. Otherwise, the search is suppressed and
        > returns no results.
        >
        > You probably want this:
        >
        > %s This is replaced by the input key. RFC 2253 quoting is
        > used to make sure that the input key does not add unex-
        > pected metacharacters.

        You're right. This was the problem.

        My initial mistake was taking a postgresql example of a relay_domains
        lookup which I assumed to be functional, and applying it to my situation.
        When using %d didn't work, I wrongly guessed that the lookup used the full
        address as key. I can see where I went wrong with this, as a static file
        will of course only have the domain.

        It now appears to work as documented. Thanks everyone for your help.

        Cheers,
        Geoff.
      Your message has been successfully submitted and would be delivered to recipients shortly.