[Dovecot] ldap auth (with user and domain a different places)

Timo Boettcher spida at gmx.net
Tue Jan 11 01:54:44 EET 2005


Hi Timo,


* Timo Sirainen <tss at iki.fi>, Monday, January 10, 2005, 7:09:38 PM:

> On Mon, 2005-01-10 at 18:28 +0100, Timo Boettcher wrote:

>> As I read the sourcecode, thats not possible just now. But unless I am
>> wrong (which I could quite possible be) the change to make this
>> possible would be about one line to do variable expansion on the
>> search-base.

> I guess this would fall into same category with authentication binds.
> When they are supported, supporting %d in base is simple. I don't have
> plans to do auth binds anytime soon though. pam_ldap might help you.

I am not sure if it works the way I intended, but from the first look of
it, the following patch [c|w|sh]ould do the trick.

diff -ur dovecot-0.99.11/src/auth/userdb-ldap.c dovecot-0.99.11-patched/src/auth/userdb-ldap.c
--- dovecot-0.99.11/src/auth/userdb-ldap.c      2003-11-08 16:31:22.000000000 +0100
+++ dovecot-0.99.11-patched/src/auth/userdb-ldap.c      2005-01-10 22:26:49.868212864 +0100
@@ -167,6 +167,10 @@
                filter = str_c(str);
        }

+       str = t_str_new(512);
+       var_expand(str, conn->set.base, user, NULL);
+       conn->set.base = str_c(str);
+
        request = i_new(struct userdb_ldap_request, 1);
        request->request.callback = handle_request;
        request->request.context = context

Please correct me if I am wrong, if I delivered total **** or forgot
something. Sorry for using the old version (but a patch of this size
should port forward easily).

 Timo Boettcher




More information about the dovecot mailing list