vcard conflict in ejabberd

I'm hosting an Ejabberd v17.11 instance in my datacenter that serve about 20 domains at once and we use a MySQL v5.6 with Ejabberd MySQL default schema as our database because we want to use our previous clients database (yeah, LDAP should be a better solution, I tried to suggest it before). A few days ago me and my coworkers tried to figure out a way to display the user first and last names in our frontend client (JSXC) so users can identify each other in their contacts list (or roster group) in a more friendly way.

After a few research we found the mod_vcard from Ejabberd that we've already put to work. Since we're serving about 20 domains, our mysql ejabberd.vcard table has a big chance to carry duplicate usernames because this specific field references the username and ignore its domain.

To clarify, take this example of the vcard table that contains only users from domain 1. In there, we don't have two users with the same username so we don't have conflicts and the users can login normally and have their vcards displayed.

+----------+-------+------------+  
| username | vcard | created_at |  
+----------+-------+------------+  
| john.doe | (...) | (...)      | (this John is from domain 1)  
+----------+-------+------------+

When we try to create vcards of users from domain 2 and we have an example conflict of two users (one at each domain) named John Doe, we faced our first problem.

+----------+-------+------------+  
| username | vcard | created_at |  
+----------+-------+------------+  
| john.doe | (...) | (...)      | (this John is from domain 1)  
| john.doe | (...) | (...)      | (this John is from domain 2)  
+----------+-------+------------+  

When we tried to login in our frontend client, we realized that vcards stopped working for everyone and our suspects rely on the fact that without the domain, ejabberd doesn't know how to handle these conflicts. Anyone have ever had this problem? We thought about having one Ejabberd instance having its own db for each domain but this is kinda stupid, so we don't know what to do.

Upvotes: 0

Views: 174

Answers (1)

Maryna Shabalina
Maryna Shabalina

Reputation: 449

One database for one domain should be used

You can use virtual hosting:

    host_config:
  "example.net":
    auth_method: sql
    sql_type: odbc
    sql_server: "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"
  "example.com":
    auth_method: ldap
    ldap_servers:
      - "localhost"
      - "otherhost"
    ldap_uids:
      - "uid"
    ldap_rootdn: "dc=localdomain"
    ldap_rootdn: "dc=example,dc=com"
    ldap_password: ""

Upvotes: 0

Related Questions