virtual hosting + jids from ldap

For virtual hosting with ldap, you have to configure a uid attribute. Is it possible to specify an attribute that contains the entire jid instead? I have a server that hosts several email addresses on several domains and it uses ldap for user authentication and mailbox location. I would like to give each email user a jid. Here is a made up example of part of my ldap:

cn:Bob Abc
uid:bob
mail:bob@abc.com
password:secret

cn:Bob Xyz
uid:bobx
mail:bob@xyz.com
password:secret

Is it possible to have those two accounts be seperate and use the value of "mail" as their jid?

I need this as well

I also want to clarify that I'm looking to host each realm locally. That means that the virtual host for xyz.com and abc.com will both be configured. I'm *not* trying to create JIDs like (user@abc.com@xyz.com).

I have so far been unable to find a way to do this with ejabberd but I'm still looking. Any suggestions or pointers are welcome.

/BAK/
--
Ben Klang
bklang@alkaloid.net
404.475.4850
http://projects.alkaloid.net

Here's a patch to do that

I found a way to do what we want, but it required modifying the ejabberd_auth_ldap module. This patch hard-codes the userid part of the DN to be "userid@server" before sending to to LDAP for a match. This code works for me, but of course your mileage may vary.

I'm working on a better version of this that will allow a configuration option in ejabberd.cfg which I'll submit to the ejabberd maintainers.
----------- SNIP

--- ejabberd-1.1.1/src/ejabberd_auth_ldap.erl.orig      2006-02-27 10:09:07.000000000 -0500
+++ ejabberd-1.1.1/src/ejabberd_auth_ldap.erl   2006-07-04 16:59:46.000000000 -0400
@@ -132,7 +132,7 @@
 find_user_dn(User, Server) ->
     LServer = jlib:nameprep(Server),
     Attr = ejabberd_config:get_local_option({ldap_uidattr, LServer}),
-    Filter = eldap:equalityMatch(Attr, User),
+    Filter = eldap:equalityMatch(Attr, lists:append([User, [64], Server])),
     Base = ejabberd_config:get_local_option({ldap_base, LServer}),
     case eldap:search(get_eldap_id(LServer, ejabberd),
                      [{base, Base},

-----------SNIP

This literally appends "@" and the Virtual Host domain to the User ID (node) part of the JID.

/BAK/
--
Ben Klang
bklang@alkaloid.net
404.475.4850
http://projects.alkaloid.net

Syndicate content