Ericsson / exchangecalendar

Exchange 2007/2010/2013 Calendar, Tasks, Contacts and GAL Provider.
GNU General Public License v3.0
925 stars 112 forks source link

3.4-beta7: Cannot convert string to ByteString #325

Closed Trim closed 9 years ago

Trim commented 9 years ago

Hello,

With the latest beta (3.4-beta7), I've tried to configure my Address books and now I see this error in my logs:

1st-setup:2015-7-4 13:43:58.775:22087433-8a33-46a7-8062-bdf9c0d9796c: : ERROR on ExchangeRequest.sendRequest to URL:https://autodiscover.collaborationhost.net/ews/exchange.asmx. err:TypeError: Cannot convert string to ByteString because the character at index 28 has value 9679 which is greater than 255.

I'm a bit surprised, because the 28^th char of the URL is a simple 'o'. Do you thnik this error is related to another string ? I thought about my user name, but it is my email address and it has only 26 chars.

Thanks, Adrien

PS: I'm sure this error come with the Address Books, because my calendar works well and because my AddressBooks has never received synchronisation (they are empty).

bavincen commented 9 years ago

Your thunderbird/seamonkey version? Lightning version?

bavincen commented 9 years ago

i see this https://bugzilla.mozilla.org/show_bug.cgi?id=796850

Trim commented 9 years ago

I have: Exchange EWS 3.4.0~beta7 Lightening 4.0.2 Thunderbird 38.2.0 And I know that my Exchange Server is the 2007 version.

I've looked a bit more to the logs and I've found that the Addressbooks part tries this:

1st-setup:2015-7-5 12:41:40.7:c203e733-dbbd-42cb-a23c-288f0e267713: : 1 ExchangeRequest.sendRequest : user=\adrien.dorsaz@an-example.com, url=https://autodiscover.collaborationhost.net/ews/exchange.asmx 1st-setup:2015-7-5 12:41:40.10:c203e733-dbbd-42cb-a23c-288f0e267713: We have a prePassword: *** 1st-setup:2015-7-5 12:41:40.14:c203e733-dbbd-42cb-a23c-288f0e267713: : ERROR on ExchangeRequest.sendRequest to URL:https://autodiscover.collaborationhost.net/ews/exchange.asmx. err:TypeError: Cannot convert string to ByteString because the character at index 28 has value 9679 which is greater than 255. 1st-setup:2015-7-5 12:41:40.17:c203e733-dbbd-42cb-a23c-288f0e267713: exchangeRequest.tryNextURL 1st-setup:2015-7-5 12:41:40.20:c203e733-dbbd-42cb-a23c-288f0e267713: ecExchangeRequest.fail: aCode:-100, aMsg:Could not connect to specified host:TypeError: Cannot convert string to ByteString because the character at index 28 has value 9679 which is greater than 255. 1st-setup:2015-7-5 12:41:40.24:[contacts] exchangeAbFolderDirectory: syncFolderError: aCode:-100, aMsg:Could not connect to specified host:TypeError: Cannot convert string to ByteString because the character at index 28 has value 9679 which is greater than 255. (_syncFolderError in exchangeAbFolderDirectory.js:1474)

And Calendar par of the extension uses this:

1st-setup:2015-7-5 12:52:41.425:[MLS Disco] removeExchCalDbCache Found item in offline Cache. (_removeExchCalDbCache in mivExchangeCalendar.js:8766) 1st-setup:2015-7-5 12:52:41.857:mivExchangeAuthPrompt2: getPassword: A realm was specified:Exchange Web Service (_getPassword in mivExchangeAuthPrompt2.js:122) 1st-setup:2015-7-5 12:52:41.862:mivExchangeAuthPrompt2: getPassword: There is no password in the passwordCache[adrien.dorsaz@an-example.com|https://autodiscover.collaborationhost.net/ews/exchange.asmx|Exchange Web Service](_getPassword in mivExchangeAuthPrompt2.js:140) 1st-setup:2015-7-5 12:52:41.866:mivExchangeAuthPrompt2: getPassword: password(1)=**** (_getPassword in mivExchangeAuthPrompt2.js:146) 1st-setup:2015-7-5 12:52:41.870:mivExchangeAuthPrompt2: getPassword: There is no password in the cache. Going to see if there is one in the passwordManager. (_getPassword in mivExchangeAuthPrompt2.js:151) 1st-setup:2015-7-5 12:52:41.874:mivExchangeAuthPrompt2: passwordManagerGet: username=adrien.dorsaz@an-example.com, aURL=https://autodiscover.collaborationhost.net/ews/exchange.asmx, aRealm=Exchange Web Service (_passwordManagerGet in mivExchangeAuthPrompt2.js:621) 1st-setup:2015-7-5 12:52:41.890:mivExchangeAuthPrompt2: passwordManagerGet found password for: username=adrien.dorsaz@an-example.com, aURL=https://autodiscover.collaborationhost.net/ews/exchange.asmx, aRealm=Exchange Web Service (_passwordManagerGet in mivExchangeAuthPrompt2.js:630) 1st-setup:2015-7-5 12:52:41.894:mivExchangeAuthPrompt2: getPassword: There is a password stored in the passwordManager. (_getPassword in mivExchangeAuthPrompt2.js:154) 1st-setup:2015-7-5 12:52:41.898:mivExchangeAuthPrompt2: getPassword: password(2)=**** (_getPassword in mivExchangeAuthPrompt2.js:166) 1st-setup:2015-7-5 12:52:41.901:mivExchangeAuthPrompt2: getPassword: We have a password:**** (_getPassword in mivExchangeAuthPrompt2.js:254) 1st-setup:2015-7-5 12:52:41.905:beb9d6cc-6787-48a9-97c1-9e5eed6ffdfc: : 1 ExchangeRequest.sendRequest : user=adrien.dorsaz@an-example.com, url=https://autodiscover.collaborationhost.net/ews/exchange.asmx 1st-setup:2015-7-5 12:52:41.909:beb9d6cc-6787-48a9-97c1-9e5eed6ffdfc: We have a prePassword: *** 1st-setup:2015-7-5 12:52:41.913:93bd9480-199f-4eab-85b2-f7a283ff48a5: ecnsIAuthPrompt2.getInterface: Ci.nsILoadContext 1st-setup:2015-7-5 12:52:41.917:93bd9480-199f-4eab-85b2-f7a283ff48a5: ecnsIAuthPrompt2.getInterface: Ci.nsILoadContext 1st-setup:2015-7-5 12:52:41.921:93bd9480-199f-4eab-85b2-f7a283ff48a5: ecnsIAuthPrompt2.getInterface: Ci.nsILoadContext 1st-setup:2015-7-5 12:52:41.924:beb9d6cc-6787-48a9-97c1-9e5eed6ffdfc: : sendRequest Sending: <?xml version="1.0" encoding="utf-8"?>

nsSoap:HeadernsTypes:TimeZoneContext/nsTypes:TimeZoneContext/nsSoap:HeadernsSoap:BodynsTypes:BaseShapeAllProperties/nsTypes:BaseShape/nsMessages:FolderShapensTypes:EmailAddressadrien.dorsaz@an-example.com/nsTypes:EmailAddress/nsTypes:Mailbox/nsTypes:DistinguishedFolderId/nsMessages:FolderIds/nsMessages:GetFolder/nsSoap:Body/nsSoap:Envelope

I'm a bit surprised that for with Addressbooks we send a request with ExchangeRequest.sendRequest : user=\adrien.dorsaz@an-example.com and for Calendar ExchangeRequest.sendRequest : user=adrien.dorsaz@an-example.com (and I've checked that in my Addressbook configuration I've well setted my user name).

As I didn't had a password loop, I thought that #290 were fixed, but maybe finally not.

Thanks for the support, Adrien

bavincen commented 9 years ago

I want to see this kind in log, please post log snip

"user=\adrien.dorsaz@an-example.com"

Thanks for hhelp

Trim commented 9 years ago

I've tried at home on Debian Stretch with Thunderbird 38.2.0, exchangecalendar 3.4~beta07 and Lightening 4.0.2. I've tried with a brand new thundebird profile to be sure to not have some issue with past testings. I was surprised to see the loop password appear again (maybe that's because of Debian instead of Windows, I don't know), so I wasn't able to reproduce exactly this bug (so I have to wait Monday to have the Windows logs).

As it was a new profile, I've logged the creation of the first address book (called 'agenda' [sorry, it's a mistake a bit confusing]): you'll see in this file at top, that the setting window was able to connect to my exchange server provider to find the folder tree with user=adrien.dorsaz@an-example.com, url=https://autodiscover.collaborationhost.net/ews/exchange.asmx (line 11) .

Since line 59 (at 13:47:59.666), it seems that I've saved the settings and the first synchronization began, but this time with username=\adrien.dorsaz@an-example.com, aURL=https://autodiscover.collaborationhost.net/ews/exchange.asmx (line 100).

I've seen an interesting thing at line 211:

asyncPromptAuthNotifyCallback: authInfo{ password:***, username:\adrien.dorsaz@an-example.com, domain:} (_asyncPromptAuthNotifyCallback in mivExchangeAuthPrompt2.js:396)

It's like my username wasn't correctly decoded.

Hope that help, Adrien

Trim commented 9 years ago

Hello,

I've found and fixed the issue (I had exactly same logs on my windows machine): it's located in file interfaces/exchangeAddressBook/exchangeAbFolderDirectory/exchangeAbFolderDirectory.js on line 1129 and in file interfaces/exchangeAddressBook/exchangeAbDistListDirectory/exchangeAbDistListDirectory.js on line 1002.

The bug comes from this function (same in both files):

    get user() {
        return this.domain+"\\"+exchWebService.commonFunctions.safeGetCharPref(this.prefs, "user", "");
    },

I've fixed ugly them by:

    get user() {
        var tmpUser = "";
        if(this.domain){
            tmpUser = this.domain+"\\"+exchWebService.commonFunctions.safeGetCharPref(this.prefs, "user", "")
        }else{
            tmpUser = exchWebService.commonFunctions.safeGetCharPref(this.prefs, "user", "")
        }
        return tmpUser;
    },

That's why I had an extra \ before my username. I'll make a PR to fix it.