JS error (TypeError: match[1] is undefined) when parsing a JID without a node part.

RESOLVED FIXED in Thunderbird 18.0

Status

Thunderbird
Instant Messaging
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Igor Mackeev, Assigned: florian)

Tracking

15 Branch
Thunderbird 18.0

Thunderbird Tracking Flags

(thunderbird17 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
When I try to connect to the xmpp server talk37.ru, Thunderbird won't connect to the server with the following error:
Timestamp: 8/29/2012 17:33:26
Error: NS_ERROR_XPC_JS_THREW_JS_OBJECT: 'TypeError: match[1] is undefined' when calling method: [prplIAccount::connect]
Source File: resource:///components/imAccounts.js
Line: 620

Comment 1

5 years ago
Same problem: unable to connect to a Beehive server using XMPP protocole.

Pidgin works fine on same server with same credentials.
(Assignee)

Comment 2

5 years ago
(In reply to Igor Mackeev from comment #0)
> When I try to connect to the xmpp server talk37.ru, Thunderbird won't
> connect to the server with the following error:
> Timestamp: 8/29/2012 17:33:26
> Error: NS_ERROR_XPC_JS_THREW_JS_OBJECT: 'TypeError: match[1] is undefined'
> when calling method: [prplIAccount::connect]
> Source File: resource:///components/imAccounts.js
> Line: 620

The error seems to be from http://hg.mozilla.org/comm-central/annotate/a38652ab6c4d/chat/protocols/xmpp/xmpp.jsm#l952 so likely a regression from http://hg.mozilla.org/comm-central/rev/b162ce0f8d14

Have you entered a username before the hostname when you configured your xmpp account?

What does the name of your XMPP account look like in the "Show Accounts" dialog of the Chat tab?
(Assignee)

Comment 3

5 years ago
(In reply to didierg-linux from comment #1)
> Same problem: unable to connect to a Beehive server using XMPP protocole.
> 
> Pidgin works fine on same server with same credentials.

Do you also see the exact error that's been pasted by Igor? If not, the problem you have is not the same.

Comment 4

5 years ago
I get the same error with Thunderbird 15.0 in a GNU/Linux installation.

I'm trying to connect to jabber.org (and that works for Empathy).

Hora: 29-08-2012 15:50:08
Erro: NS_ERROR_XPC_JS_THREW_JS_OBJECT: 'TypeError: match[1] is undefined' when calling method: [prplIAccount::connect]
Arquivo-fonte: resource:///components/imAccounts.js
Linha: 620

Comment 5

5 years ago
After more tests, it appears it is necessary to provide full qualified username in Thunderbird: username@domainname

In Pidgin, username without domainename is enough.

This problem is now fixed for me.
(Reporter)

Comment 6

5 years ago
(In reply to Florian Quèze [:florian] [:flo] from comment #2)
> 
> Have you entered a username before the hostname when you configured your
> xmpp account?
> 
> What does the name of your XMPP account look like in the "Show Accounts"
> dialog of the Chat tab?

I tried both ways: just username and username@talk37.ru (that's what I see in "Show Accounts", respectively)

In the first case, it throws the above error.
In the second case, I get no error (in Error Console), but there is a message: Error. The sever closed the connection...

Comment 7

5 years ago
Getting some similar issues with an in-house instance of OpenFire.

If I use just "paul.black" as the username, Thunderbird doesn't try to connect.

If I use "paul.black@<host>", it connects but after doing some SSL stuff says "Server closed the connection". Wireshark shows that Thunderbird initiated the closing of the connection.

The SSL certificate for the server is unsigned so perhaps this might be the problem. Adding the cert to Thunderbird doesn't seem to have an effect.

I then used "socat" to remove the SSL interactions. The last response received from the server is some XML starting "<success xmlns...." before Thunderbird disconnects. The message from Thunderbird is "authentication failure". The KDE Instant Messaging client proceeds beyond this point.
(Assignee)

Comment 8

5 years ago
(In reply to Paul Black from comment #7)
> Getting some similar issues with an in-house instance of OpenFire.
> 
> If I use just "paul.black" as the username, Thunderbird doesn't try to
> connect.

The hostname should look like an email address.

> If I use "paul.black@<host>", it connects but after doing some SSL stuff
> says "Server closed the connection". Wireshark shows that Thunderbird
> initiated the closing of the connection.
> 
> The SSL certificate for the server is unsigned so perhaps this might be the
> problem. Adding the cert to Thunderbird doesn't seem to have an effect.

You need to add the certificate *and* trust it (the certificate UI is a bit confusing). 


> I then used "socat" to remove the SSL interactions. The last response
> received from the server is some XML starting "<success xmlns...." before
> Thunderbird disconnects. The message from Thunderbird is "authentication
> failure".

Do you have a log of these interactions? If so, could you please send it to me? (florian@mozilla.com)

Was there any error in the Error Console before the "authentication failure" message appeared?

Comment 9

5 years ago
(In reply to Paul Black from comment #7)
I experience the same behaviour Paul reports with "UID@server.domain" instead of simply "UID".

Error console displays:
Erreur : [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIPrefService.savePrefFile]"  nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"  location: "JS frame :: resource:///components/imAccounts.js :: <TOP_LEVEL> :: line 41"  data: no]
Fichier Source : resource:///components/imAccounts.js
Ligne : 41

The IM connexion window displays "Error: the server closed the connexion"

Our intranet jabberd uses encryption and IM clients like Pidgin and Spark work fine against it.
(Assignee)

Comment 10

5 years ago
(In reply to Laurent Bauvens from comment #9)
> (In reply to Paul Black from comment #7)
> I experience the same behaviour Paul reports with "UID@server.domain"
> instead of simply "UID".
> 
> Error console displays:
> Erreur : [Exception... "Component returned failure code: 0x80520015
> (NS_ERROR_FILE_ACCESS_DENIED) [nsIPrefService.savePrefFile]"  nsresult:
> "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"  location: "JS frame ::
> resource:///components/imAccounts.js :: <TOP_LEVEL> :: line 41"  data: no]
> Fichier Source : resource:///components/imAccounts.js
> Ligne : 41

This error message seems to indicate that Thunderbird can't write to your profile folder.
(Assignee)

Comment 11

5 years ago
(In reply to Igor Mackeev from comment #0)
> When I try to connect to the xmpp server talk37.ru, Thunderbird won't
> connect to the server with the following error:
> Timestamp: 8/29/2012 17:33:26
> Error: NS_ERROR_XPC_JS_THREW_JS_OBJECT: 'TypeError: match[1] is undefined'
> when calling method: [prplIAccount::connect]
> Source File: resource:///components/imAccounts.js
> Line: 620

I'm rephrasing the summary of this bug to only cover this JS error that happens when attempting to connect an XMPP account with a username that doesn't contain the '@' character.

It's not completely clear to me what we should do in this case as the XMPP specification clearly says that the JID format is [node@]domain[/resource], so technically a username without a node part is valid, but I suspect users who write "foo" in the username box expect it to be the "node", not the domain.

In any case, I think the current JS error is the worst we can do in this case, so I'm going to fix the JID parsing to match the spec (that doesn't require string changes, so it can be fixed for Tb17).
This will make us attempt to connect, and then the server will reject us because the settings are invalid.

I tested with jabber.org:
- if I enter "testib" as username, and "jabber.org" as "Connect Server" in the advanced option, the error message in the account manager is "Error: Received unexpected data." (The jabber.org is actually sending us some invalid XML in that case, with an error message before opening the stream)
- if I use "jabber.org" as the username (ie only specifying a domain, which is valid per the XMPP spec). Then the error message I have is "Error: Not authorized (Did you enter the wrong password?)" because the server dislike what we sent.
The auth request that was actually sent used "undefined" as username.

I think if we don't have a node part on the username JID, we shouldn't even attempt to connect, so I'll attach a patch that errors out with a better error message instead of connecting with the string "undefined" as the username.
Assignee: nobody → florian
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: x86 → All
Summary: Tbird 15 won't connect to an xmpp server → JS error (TypeError: match[1] is undefined) when parsing a JID without a node part.
(Assignee)

Comment 12

5 years ago
Created attachment 666541 [details] [diff] [review]
Patch (no string change)

This only fixes the JS error.
No string change included in this patch. This will cause an error to appear in the account manager, but the error will likely be slightly confusing. I think this is better than no error at all, so I think we could take this for Thunderbird 17.
Attachment #666541 - Flags: review?(clokep)
(Assignee)

Comment 13

5 years ago
Created attachment 666542 [details] [diff] [review]
Patch (with better error message)

With this patch (targeting comm-central only as it contains a new localizable string), an XMPP account with a username lacking the node part will refuse to connect, and the account manager will display "Error: Invalid username (your username should contain an '@' character)".
Attachment #666542 - Flags: review?(clokep)
(Assignee)

Updated

5 years ago
Blocks: 795959
Attachment #666541 - Flags: review?(clokep) → review+
Attachment #666542 - Flags: review?(clokep) → review+
(Assignee)

Comment 14

5 years ago
https://hg.mozilla.org/comm-central/rev/04fbdd5e847a
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 18.0
(Assignee)

Comment 15

5 years ago
Comment on attachment 666541 [details] [diff] [review]
Patch (no string change)

[Approval Request Comment]
This bug caused a lot of confusion in support requests for misconfigured XMPP accounts, I think we will want to fix it for Thunderbird 17.
Attachment #666541 - Flags: approval-comm-aurora?
(Assignee)

Comment 16

5 years ago
http://hg.instantbird.org/instantbird/rev/b3f6ddac5ac0
Attachment #666541 - Flags: approval-comm-aurora? → approval-comm-aurora+
(Assignee)

Comment 17

5 years ago
https://hg.mozilla.org/releases/comm-aurora/rev/db898f602809
status-thunderbird17: --- → fixed
You need to log in before you can comment on or make changes to this bug.