diff --git a/chrome/content/exchangeSettingsOverlay.js b/chrome/content/exchangeSettingsOverlay.js index d9fb5417..65d00aff 100644 --- a/chrome/content/exchangeSettingsOverlay.js +++ b/chrome/content/exchangeSettingsOverlay.js @@ -63,6 +63,7 @@ var exchWebServicesgMailbox = ""; var exchWebServicesgDisplayName = ""; var exchWebServicesgUser = ""; var exchWebServicesgDomain = ""; +var exchWebServicesgUseKerberos = false; var exchWebServicesgFolderIdOfShare = ""; var exchWebServicesgFolderBase = "calendar"; var exchWebServicesgFolderPath = "/"; @@ -211,6 +212,13 @@ function exchWebServicesAutodiscoverCheckbox(aCheckBox) exchWebServicesCheckRequired(); } +function exchWebServicesUseKerberosCheckbox(aCheckBox) +{ + exchWebServicesgUseKerberos = aCheckBox.checked; + gexchWebServicesDetailsChecked = false; + exchWebServicesCheckRequired(); +} + function exchWebServicesInitMailbox(aNewValue) { exchWebServicesgMailbox = aNewValue; @@ -328,6 +336,7 @@ function exchWebServicesDoCheckServerAndMailbox() var tmpObject = new erConvertIDRequest( {user: exchWebServicesGetUsername(), mailbox: exchWebServicesgMailbox, + kerberos: exchWebServicesgUseKerberos, serverUrl: exchWebServicesgServer, folderId: folderIdOfShare}, exchWebServicesConvertIDOK, exchWebServicesConvertIDError); } @@ -335,6 +344,7 @@ function exchWebServicesDoCheckServerAndMailbox() var tmpObject = new erPrimarySMTPCheckRequest( {user: exchWebServicesGetUsername(), mailbox: exchWebServicesgMailbox, + kerberos: exchWebServicesgUseKerberos, serverUrl: exchWebServicesgServer, folderBase: "calendar"}, exchWebServicesCheckServerAndMailboxOK, exchWebServicesCheckServerAndMailboxError); } @@ -354,6 +364,7 @@ function exchWebServicesConvertIDOK(aFolderID, aMailbox) var tmpObject = new erGetFolderRequest( {user: exchWebServicesGetUsername(), mailbox: aMailbox, + kerberos: exchWebServicesgUseKerberos, serverUrl: exchWebServicesgServer, folderID: aFolderID}, exchWebServicesGetFolderOK, exchWebServicesGetFolderError); } @@ -529,7 +540,8 @@ function exchWebServicesDoAutodiscoverCheck() window.setCursor("wait"); var tmpObject = new erAutoDiscoverRequest( {user: exchWebServicesGetUsername(), - mailbox: exchWebServicesgMailbox}, + mailbox: exchWebServicesgMailbox, + kerberos: exchWebServicesgUseKerberos}, exchWebServicesAutodiscoveryOK, exchWebServicesAutodiscoveryError, null) } @@ -644,8 +656,9 @@ function exchWebServicesLoadExchangeSettingsByCalId(aCalId) document.getElementById("menuitem.label.ecfolderbase.publicfoldersroot").disabled = false; } + document.getElementById("exchWebService_usekerberos").checked = exchWebServicesCalPrefs.getBoolPref("ecUseKerberos"); - + exchWebServicesgUseKerberos = exchWebServicesCalPrefs.getBoolPref("ecUseKerberos"); exchWebServicesgServer = exchWebServicesCalPrefs.getCharPref("ecServer"); exchWebServicesgUser = exchWebServicesCalPrefs.getCharPref("ecUser"); exchWebServicesgDomain = exchWebServicesCalPrefs.getCharPref("ecDomain"); @@ -679,6 +692,7 @@ function exchWebServicesSaveExchangeSettingsByCalId(aCalId) if (exchWebServicesCalPrefs) { exchWebServicesCalPrefs.setCharPref("ecServer", exchWebServicesgServer); + exchWebServicesCalPrefs.setBoolPref("ecUseKerberos", exchWebServicesgUseKerberos); exchWebServicesCalPrefs.setCharPref("ecUser", exchWebServicesgUser); exchWebServicesCalPrefs.setCharPref("ecDomain", exchWebServicesgDomain); exchWebServicesCalPrefs.setCharPref("ecFolderpath", exchWebServicesgFolderPath); @@ -766,6 +780,7 @@ function exchWebServicesLoadExchangeSettingsByContactUUID(aUUID) exchWebServicesgServer = exchWebServicesCalPrefs.getCharPref("server"); exchWebServicesgUser = exchWebServicesCalPrefs.getCharPref("user"); exchWebServicesgDomain = exchWebServicesCalPrefs.getCharPref("domain"); + exchWebServicesgUseKerberos = exchWebServicesCalPrefs.getBoolPref("kerberos"); exchWebServicesgFolderBase = exchWebServicesCalPrefs.getCharPref("folderbase"); exchWebServicesgFolderPath = exchWebServicesCalPrefs.getCharPref("folderpath"); @@ -802,6 +817,7 @@ function exchWebServicesSaveExchangeSettingsByContactUUID(isNewDirectory, aUUID) exchWebServicesCalPrefs.setCharPref("server", exchWebServicesgServer); exchWebServicesCalPrefs.setCharPref("user", exchWebServicesgUser); exchWebServicesCalPrefs.setCharPref("domain", exchWebServicesgDomain); + exchWebServicesCalPrefs.setBoolPref("kerberos", exchWebServicesgUseKerberos); exchWebServicesCalPrefs.setCharPref("folderpath", exchWebServicesgFolderPath); exchWebService.commonFunctions.LOG("exchWebServicesSaveExchangeSettingsByContactUUID: folderbase:"+exchWebServicesgFolderBase); exchWebServicesCalPrefs.setCharPref("folderbase", exchWebServicesgFolderBase); @@ -824,6 +840,7 @@ function exchWebServicesSaveExchangeSettingsByContactUUID(isNewDirectory, aUUID) mailbox: exchWebServicesgMailbox, user: exchWebServicesgUser, domain: exchWebServicesgDomain, + kerberos: exchWebServicesgUseKerberos, serverUrl: exchWebServicesgServer, folderBase: exchWebServicesgFolderBase, folderPath: exchWebServicesgFolderPath, diff --git a/chrome/content/exchangeSettingsOverlay.xul b/chrome/content/exchangeSettingsOverlay.xul index b759ceff..b60d7c25 100644 --- a/chrome/content/exchangeSettingsOverlay.xul +++ b/chrome/content/exchangeSettingsOverlay.xul @@ -48,6 +48,7 @@ + diff --git a/chrome/content/manageEWSAccounts.js b/chrome/content/manageEWSAccounts.js index 5c70b713..7446f53c 100644 --- a/chrome/content/manageEWSAccounts.js +++ b/chrome/content/manageEWSAccounts.js @@ -120,6 +120,9 @@ exchWebService.manageEWSAccounts = { { document.getElementById("exchWebService_autodiscover").disabled = false; + document.getElementById("exchWebService_usekerberos").checked = aAccount.kerberos; + document.getElementById("exchWebService_usekerberos").disabled = false; + document.getElementById("exchWebService_manageEWSAccounts_account_name").value = aAccount.name; document.getElementById("exchWebService_manageEWSAccounts_account_name").disabled = false; @@ -137,6 +140,9 @@ exchWebService.manageEWSAccounts = { { document.getElementById("exchWebService_autodiscover").disabled = true; + document.getElementById("exchWebService_usekerberos").checked = false; + document.getElementById("exchWebService_usekerberos").disabled = true; + document.getElementById("exchWebService_manageEWSAccounts_account_name").value = ""; document.getElementById("exchWebService_manageEWSAccounts_account_name").disabled = true; @@ -186,7 +192,8 @@ exchWebService.manageEWSAccounts = { name: "new Account", server: "", user: "", - mailbox: "" }; + mailbox: "", + kerberos: false }; exchWebService.accountFunctions.saveAccount(this.selectedAccount); var listbox = document.getElementById("exchWebService-manageEWSAccounts-accounts-listbox"); if (listbox) { @@ -278,6 +285,13 @@ exchWebService.manageEWSAccounts = { this.selectedAccount.user = aTextBox.value; }, + doUseKerberosChanged: function _doUseKerberosChanged(aCheckBox) + { + this.detailsChecked = false; + this.detailsChanged = true; + this.selectedAccount.kerberos = aCheckBox.checked; + }, + doAutodiscoverCheck: function _doAutodiscoverCheck() { document.getElementById("exchWebService_autodiscovercheckbutton").disabled = true; @@ -286,9 +300,11 @@ exchWebService.manageEWSAccounts = { window.setCursor("wait"); var user = document.getElementById("exchWebService_windowsuser").value; var mailbox = document.getElementById("exchWebService_mailbox").value; + var kerberos = document.getElementById("exchWebService_usekerberos").checked; var tmpObject = new erAutoDiscoverRequest( {user: user, - mailbox: mailbox}, + mailbox: mailbox, + kerberos: kerberos}, this.autodiscoveryOK, this.autodiscoveryError, null); } diff --git a/chrome/content/manageEWSAccounts.xul b/chrome/content/manageEWSAccounts.xul index 0fec7fe0..f018510c 100644 --- a/chrome/content/manageEWSAccounts.xul +++ b/chrome/content/manageEWSAccounts.xul @@ -52,6 +52,7 @@ oninput="exchWebService.manageEWSAccounts.doNameChanged(this)"/> + diff --git a/components/accountFunctions.js b/components/accountFunctions.js index aec741c4..89903a36 100644 --- a/components/accountFunctions.js +++ b/components/accountFunctions.js @@ -118,6 +118,9 @@ exchWebService.accountFunctions = { case "number": this.prefs.setIntPref(aAccount.id+"."+index, aAccount[index]); break; + case "boolean": + this.prefs.setBoolPref(aAccount.id+"."+index, aAccount[index]); + break; default: this.logInfo("Unknown object index:"+index); } diff --git a/components/ecExchangeRequest.js b/components/ecExchangeRequest.js index fb0f8df5..182b1e33 100644 --- a/components/ecExchangeRequest.js +++ b/components/ecExchangeRequest.js @@ -84,8 +84,6 @@ function ExchangeRequest(aArgument, aCbOk, aCbError, aListener) this.prePassword = ""; - this.kerberos = true; - this.prefB = Cc["@mozilla.org/preferences-service;1"] .getService(Ci.nsIPrefBranch); @@ -95,6 +93,19 @@ function ExchangeRequest(aArgument, aCbOk, aCbError, aListener) this.exchangeBadCertListener2 = Cc["@1st-setup.nl/exchange/badcertlistener2;1"] .getService(Ci.mivExchangeBadCertListener2); + + if (typeof(aArgument.kerberos)!=='undefined') { + // autodiscover / check server requests - no prefs stored yet. + this.kerberos = aArgument.kerberos; + } else { + // all others - calendar has it in prefs. + // this will slighty change the logic on extension upgrade: + // one should go and click 'Use Kerberos authentication' in settings to use Kerberos again + this.kerberos = exchWebService.commonFunctions.safeGetBoolPref(this.prefB, + "extensions.exchangecalendar@extensions.1st-setup.nl."+aArgument["calendar"]["id"]+".ecUseKerberos", + false, false); + } + } ExchangeRequest.prototype = { @@ -216,23 +227,26 @@ ExchangeRequest.prototype = { openUser = openUser.substr(openUser.indexOf("\\")+1); }*/ - var myAuthPrompt2 = Cc["@1st-setup.nl/exchange/authprompt2;1"].getService(Ci.mivExchangeAuthPrompt2); - if (myAuthPrompt2.getUserCanceled(this.currentUrl)) { - - this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request."); - return; - } + if(!this.kerberos) { + var myAuthPrompt2 = Cc["@1st-setup.nl/exchange/authprompt2;1"].getService(Ci.mivExchangeAuthPrompt2); + if (myAuthPrompt2.getUserCanceled(this.currentUrl)) { + + this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request."); + return; + } - try { - var password = myAuthPrompt2.getPassword(null, openUser, this.currentUrl); -// var password = myAuthPrompt2.getPassword(null, this.mArgument.user, this.currentUrl); - } - catch(err) { - this.logInfo(err); - this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request."); - return; - } + try { + var password = myAuthPrompt2.getPassword(null, openUser, this.currentUrl); + +// var password = myAuthPrompt2.getPassword(null, this.mArgument.user, this.currentUrl); + } + catch(err) { + this.logInfo(err); + this.fail(this.ER_ERROR_USER_ABORT_AUTHENTICATION, "User canceled providing a valid password for url="+this.currentUrl+". Aborting this request."); + return; + } + } this.xmlReq = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); this.mXmlReq = this.xmlReq; @@ -250,12 +264,15 @@ ExchangeRequest.prototype = { if (this.debug) this.logInfo(": 1 ExchangeRequest.sendRequest : user="+this.mArgument.user+", url="+this.currentUrl); - this._notificationCallbacks = new ecnsIAuthPrompt2(this); + if(!this.kerberos) { + this._notificationCallbacks = new ecnsIAuthPrompt2(this); + } try { // this.xmlReq.open("POST", this.currentUrl, true); - if (password) { + if(!this.kerberos) { +// if (password) { if (this.debug) this.logInfo("We have a prePassword: *******"); this.xmlReq.open("POST", this.currentUrl, true, openUser, password); //this.xmlReq.open("POST", this.currentUrl, true, this.mArgument.user, password); diff --git a/interfaces/exchangeAuthPrompt2/mivExchangeAuthPrompt2.js b/interfaces/exchangeAuthPrompt2/mivExchangeAuthPrompt2.js index 50b36ee2..a72896e3 100644 --- a/interfaces/exchangeAuthPrompt2/mivExchangeAuthPrompt2.js +++ b/interfaces/exchangeAuthPrompt2/mivExchangeAuthPrompt2.js @@ -164,22 +164,17 @@ mivExchangeAuthPrompt2.prototype = { try { if (!password) { - - if (!this.details[aURL]) { - this.logInfo("getPassword: First request for a password. Not going to ask user for it because we want to see if we need a password. For Kerberos for example we do not need a password."); - return null; - } - -/* if (!this.details[aURL]) this.details[aURL] = { + if (!this.details[aURL]) this.details[aURL] = { showing: true, canceled: false, queue: new Array(), ntlmCount: 0 - };*/ + }; this.logInfo("getPassword: Going to ask user to provide a new password."); - + this.details[aURL].ntlmCount = 0; + var answer = this.getCredentials(username, aURL); if (answer.result) { diff --git a/locale/exchangecalendar/de/exchangeSettingsOverlay.dtd b/locale/exchangecalendar/de/exchangeSettingsOverlay.dtd index ab4a66c6..012c17bc 100644 --- a/locale/exchangecalendar/de/exchangeSettingsOverlay.dtd +++ b/locale/exchangecalendar/de/exchangeSettingsOverlay.dtd @@ -1,4 +1,5 @@ + diff --git a/locale/exchangecalendar/de/manageEWSAccounts.dtd b/locale/exchangecalendar/de/manageEWSAccounts.dtd index 3c147dac..6be4fe80 100644 --- a/locale/exchangecalendar/de/manageEWSAccounts.dtd +++ b/locale/exchangecalendar/de/manageEWSAccounts.dtd @@ -5,6 +5,7 @@ + diff --git a/locale/exchangecalendar/en-US/exchangeSettingsOverlay.dtd b/locale/exchangecalendar/en-US/exchangeSettingsOverlay.dtd index 71786f4a..d9a881e2 100644 --- a/locale/exchangecalendar/en-US/exchangeSettingsOverlay.dtd +++ b/locale/exchangecalendar/en-US/exchangeSettingsOverlay.dtd @@ -1,4 +1,5 @@ + diff --git a/locale/exchangecalendar/en-US/manageEWSAccounts.dtd b/locale/exchangecalendar/en-US/manageEWSAccounts.dtd index 33f3b49a..8c13307e 100644 --- a/locale/exchangecalendar/en-US/manageEWSAccounts.dtd +++ b/locale/exchangecalendar/en-US/manageEWSAccounts.dtd @@ -5,6 +5,7 @@ + diff --git a/locale/exchangecalendar/fr-FR/exchangeSettingsOverlay.dtd b/locale/exchangecalendar/fr-FR/exchangeSettingsOverlay.dtd index 55de4c43..c4beed31 100644 --- a/locale/exchangecalendar/fr-FR/exchangeSettingsOverlay.dtd +++ b/locale/exchangecalendar/fr-FR/exchangeSettingsOverlay.dtd @@ -1,4 +1,5 @@ + diff --git a/locale/exchangecalendar/fr-FR/manageEWSAccounts.dtd b/locale/exchangecalendar/fr-FR/manageEWSAccounts.dtd index 023be13d..c113c73f 100644 --- a/locale/exchangecalendar/fr-FR/manageEWSAccounts.dtd +++ b/locale/exchangecalendar/fr-FR/manageEWSAccounts.dtd @@ -5,6 +5,7 @@ + diff --git a/locale/exchangecalendar/ja-JP/exchangeSettingsOverlay.dtd b/locale/exchangecalendar/ja-JP/exchangeSettingsOverlay.dtd index 71786f4a..d9a881e2 100644 --- a/locale/exchangecalendar/ja-JP/exchangeSettingsOverlay.dtd +++ b/locale/exchangecalendar/ja-JP/exchangeSettingsOverlay.dtd @@ -1,4 +1,5 @@ + diff --git a/locale/exchangecalendar/ja-JP/manageEWSAccounts.dtd b/locale/exchangecalendar/ja-JP/manageEWSAccounts.dtd index 33f3b49a..8c13307e 100644 --- a/locale/exchangecalendar/ja-JP/manageEWSAccounts.dtd +++ b/locale/exchangecalendar/ja-JP/manageEWSAccounts.dtd @@ -5,6 +5,7 @@ + diff --git a/locale/exchangecalendar/nl/exchangeSettingsOverlay.dtd b/locale/exchangecalendar/nl/exchangeSettingsOverlay.dtd index 9504ca42..0c9ecbf1 100644 --- a/locale/exchangecalendar/nl/exchangeSettingsOverlay.dtd +++ b/locale/exchangecalendar/nl/exchangeSettingsOverlay.dtd @@ -1,4 +1,5 @@ + diff --git a/locale/exchangecalendar/nl/manageEWSAccounts.dtd b/locale/exchangecalendar/nl/manageEWSAccounts.dtd index 6303d7b7..1cbebab8 100644 --- a/locale/exchangecalendar/nl/manageEWSAccounts.dtd +++ b/locale/exchangecalendar/nl/manageEWSAccounts.dtd @@ -5,6 +5,7 @@ + diff --git a/locale/exchangecalendar/sv/exchangeSettingsOverlay.dtd b/locale/exchangecalendar/sv/exchangeSettingsOverlay.dtd index b55130dd..83ab68f4 100644 --- a/locale/exchangecalendar/sv/exchangeSettingsOverlay.dtd +++ b/locale/exchangecalendar/sv/exchangeSettingsOverlay.dtd @@ -1,4 +1,5 @@ + diff --git a/locale/exchangecalendar/sv/manageEWSAccounts.dtd b/locale/exchangecalendar/sv/manageEWSAccounts.dtd index 3d15a525..a861d4ac 100644 --- a/locale/exchangecalendar/sv/manageEWSAccounts.dtd +++ b/locale/exchangecalendar/sv/manageEWSAccounts.dtd @@ -5,6 +5,7 @@ +