[Exim] Integration of quote_ldapdn?

Top Page
Delete this message
Reply to this message
Author: michael
Date:  
To: exim-users
Subject: [Exim] Integration of quote_ldapdn?
Hello,

I think the following function should do proper quoting of DN strings
as of RFC 1485. Note that the function would have to be used on the
entire attribute string. It won't work on a part of it.

uschar *
eldap_quotedn(uschar *unquoted)
{
register int c;
uschar *t;
uschar *quoted;
int quoteit = 0;

t = unquoted;
quoteit = 0;
while ((c = *t++) != 0)
  if (Ustrchr(",+=\"\r<>#; ", c) != NULL)
    {
    quoteit = 1;
    break;
    }


if (quoteit)
  {
  t = quoted = store_get(1 + Ustrlen(unquoted)*2 + 1);
  *t++ = '#';
  while ((c = *unquoted++) != 0)
    {
    sprintf(CS t, "%02X", c);
    t += 2;
    }
  return quoted;
  }
else
  return unquoted;
}


The code is not tested, because I wonder how to integrate it into
Exim. There may only be one lookup quoting function, but LDAP
requires the following:

quote_ldapdn
quote_ldapfilter (not yet written)
quote_url (similar to the current quote_ldap)

A single quote_ldap can not do the job. Any ideas how to integrate
this best?

Michael