[jitsi-dev] Problem with period in user nickname while using secure domain and LDAP


Hi everyone !

Firstly, thank you for your great work on Jitsi !

I'm using Jitsi-Meet with Openfire and OpenLDAP, but I can't join conference rooms with my usual LDAP nickname.
It seems that the room creation doesn't have any problem though.

I disabled anonymous login in Openfire, and set up secure domain in Jicofo with the following configurations :
Jicofo launched with "--user_domain=xmpp.mydomain --user_name=focus --user_password=FOCUS_PASSWORD"
Specified "org.jitsi.jicofo.auth.URL=XMPP:xmpp.mydomain" in sip-communicator.properties file.

Here is my Jitsi-Meet config.js file :
    hosts: {
        domain: 'xmpp.mydomain',
// anonymousdomain: 'xmpp.mydomain',
        muc: 'conference.xmpp.mydomain', // FIXME: use XEP-0030
        call_control: 'jigasi.xmpp.mydomain',
        focus: 'jicofo.xmpp.mydomain'
    useNicks: false,
    bosh: '//xmpp.mydomain:7443/http-bind/', // FIXME: use xep-0156 for that
    clientNode: 'https://web.mydomain', // The name of client node advertised in XEP-0115 'c' stanza
// focusUserJid: 'focus@xmpp.mydomain', // The real JID of focus participant - can be overridden here

In Openfire, my users are mapped on the 'uid' field of my LDAP directory.
This field follows a 'firstname.lastname' pattern.
The user authentification (using firstname.lastname@xmpp.mydomain) when trying to create/join a room works well, the problem occurs after.
I have this error in both users Chrome console when a second user try to join the room :

Strophe: error: Cannot read property 'appendChild' of undefined
TypeError: Cannot read property 'appendChild' of undefined
    at setDisplayName (https://web.mydomain/libs/app.bundle.js?v=63:7411:32)
    at Object.my.ensurePeerContainerExists (https://web.mydomain/libs/app.bundle.js?v=63:8300:13)
    at EventEmitter.onMucMemberJoined (https://web.mydomain/libs/app.bundle.js?v=63:2380:17)
    at EventEmitter.emit (https://web.mydomain/libs/app.bundle.js?v=63:100:20)
    at Object.Strophe.addConnectionPlugin.onPresence (https://web.mydomain/libs/app.bundle.js?v=63:16592:34)
    at Object.Strophe.Handler.run (https://web.mydomain/libs/strophe/strophe.min.js?v=1:1:19636)
    at https://web.mydomain/libs/strophe/strophe.min.js?v=1:1:27678
    at Object.Strophe.forEachChild (https://web.mydomain/libs/strophe/strophe.min.js?v=1:1:10525)
    at Object.Strophe.Connection._dataRecv (https://web.mydomain/libs/strophe/strophe.min.js?v=1:1:27466)
    at Object.Strophe.Bosh._onRequestStateChange (https://web.mydomain/libs/strophe/strophe.min.js?v=1:1:48024)
Strophe: Removing Strophe handlers due to uncaught exception: Cannot read property 'appendChild' of undefined
on jingle session-initiate from wiseknightscommunicateconstantly@conference.xmpp.mydomain/focus <iq xmlns="jabber:client" id="r41to-3695" to="wiseknightscommunicateconstantly@conference.xmpp.mydomain/alex.nodet" from="wiseknightscommunicateconstantly@conference.xmpp.mydomain/focus" type="set">…</iq>
setRemoteDescription when remote description is not null, should be pranswer RTCSessionDescription
emuc data for wiseknightscommunicateconstantly@conference.xmpp.mydomain/focus Object
REMOTE STREAM ADDED: [object MediaStream] - mixedmslabel
new ssrcs Array[2]
Have we encountered any srflx candidates? false
Have we encountered any relay candidates? false
sendIceCandidates Array[18]
No jid for ssrc: 2326070501
No jid for ssrc: 490298127
on jingle source-add from wiseknightscommunicateconstantly@conference.xmpp.mydomain/focus <iq xmlns="jabber:client" id="r41to-3704" to="wiseknightscommunicateconstantly@conference.xmpp.mydomain/alex.nodet" from="wiseknightscommunicateconstantly@conference.xmpp.mydomain/focus" type="set">…</iq>
addssrc 1431519541722
ice checking
REMOTE STREAM ADDED: [object MediaStream] - 69fa9144-07ed-48cb-b633-796dec6f5176
REMOTE STREAM ADDED: [object MediaStream] - 44661f59-cc27-471a-9237-779ece66940a
new ssrcs Array[2]
No jid for ssrc: 2326070501
No jid for ssrc: 490298127
Data channel opened by the Videobridge! RTCDataChannel
selected endpoint changed: alex.nodet
sending selected endpoint changed notification to the bridge: alex.nodet
Data channel new dominant speaker event: damien.delporte
Uncaught TypeError: Cannot read property 'appendChild' of undefined
No jid for ssrc: 2326070501
No jid for ssrc: 490298127
3519878114 not enough data
2524425431 not enough data
No jid for ssrc: 2326070501
No jid for ssrc: 490298127
No jid for ssrc: 3519878114
... (others "No jid for ssrc")

In setDisplayName() method, the faulting instruction is : $('#' + videoSpanId)[0].appendChild(nameSpan);
where videoSpanId value is 'participant_' + resourceJid, according to ensurePeerContainerExists() method.
So jitsi-meet is trying to access to $('#participant_firstname.lastname'), resulting in a id/class selector conflict.

I escaped the period using videoSpanId.replace('.', '\\.') and it partially resolved the problem but there should be a cleaner way to do that.
With my hotfix the 2nd user can join the conference, but there are 4 video thumbnails instead of 2.

Also I don't have any problem when I want to create or join a room using an other LDAP account if it doesn't have any period in the nickname.

How can I resolve this bug ?

Alex Nodet