diff options
Diffstat (limited to 'toolkit/mozapps/update')
-rw-r--r-- | toolkit/mozapps/update/common/moz.build | 5 | ||||
-rw-r--r-- | toolkit/mozapps/update/common/sources.mozbuild | 9 | ||||
-rw-r--r-- | toolkit/mozapps/update/nsUpdateService.js | 111 | ||||
-rw-r--r-- | toolkit/mozapps/update/tests/TestAUSHelper.cpp | 10 | ||||
-rw-r--r-- | toolkit/mozapps/update/tests/moz.build | 6 | ||||
-rw-r--r-- | toolkit/mozapps/update/updater/updater.cpp | 62 |
6 files changed, 1 insertions, 202 deletions
diff --git a/toolkit/mozapps/update/common/moz.build b/toolkit/mozapps/update/common/moz.build index cacb0bad2..ca7c4c307 100644 --- a/toolkit/mozapps/update/common/moz.build +++ b/toolkit/mozapps/update/common/moz.build @@ -17,11 +17,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': 'updatehelper.cpp', 'updatehelper.h', ] - if CONFIG['MOZ_MAINTENANCE_SERVICE']: - EXPORTS += [ - 'certificatecheck.h', - 'registrycertificates.h', - ] Library('updatecommon') diff --git a/toolkit/mozapps/update/common/sources.mozbuild b/toolkit/mozapps/update/common/sources.mozbuild index cde51e09b..339944640 100644 --- a/toolkit/mozapps/update/common/sources.mozbuild +++ b/toolkit/mozapps/update/common/sources.mozbuild @@ -10,15 +10,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': 'uachelper.cpp', 'updatehelper.cpp', ] - if CONFIG['MOZ_MAINTENANCE_SERVICE']: - sources += [ - 'certificatecheck.cpp', - 'registrycertificates.cpp', - ] - OS_LIBS += [ - 'crypt32', - 'wintrust', - ] sources += [ 'readstrings.cpp', diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index e5c81aa19..3e15d654a 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -791,79 +791,6 @@ function shouldUseService() { // 2) The maintenance service is installed // 3) The pref for using the service is enabled // 4) The Windows version is XP Service Pack 3 or above (for SHA-2 support) - // The maintenance service requires SHA-2 support because we sign our binaries - // with a SHA-2 certificate and the certificate is verified before the binary - // is launched. - if (!AppConstants.MOZ_MAINTENANCE_SERVICE || !isServiceInstalled() || - !getPref("getBoolPref", PREF_APP_UPDATE_SERVICE_ENABLED, false) || - !AppConstants.isPlatformAndVersionAtLeast("win", "5.1") /* WinXP */) { - return false; - } - - // If it's newer than XP, then the service pack doesn't matter. - if (Services.sysinfo.getProperty("version") != "5.1") { - return true; - } - - // If the Windows version is XP, we also need to check the service pack. - // We'll return false if only < SP3 is installed, or if we can't tell. - // Check the service pack level by calling GetVersionEx via ctypes. - const BYTE = ctypes.uint8_t; - const WORD = ctypes.uint16_t; - const DWORD = ctypes.uint32_t; - const WCHAR = ctypes.char16_t; - const BOOL = ctypes.int; - // This structure is described at: - // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx - const SZCSDVERSIONLENGTH = 128; - const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW', - [ - {dwOSVersionInfoSize: DWORD}, - {dwMajorVersion: DWORD}, - {dwMinorVersion: DWORD}, - {dwBuildNumber: DWORD}, - {dwPlatformId: DWORD}, - {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)}, - {wServicePackMajor: WORD}, - {wServicePackMinor: WORD}, - {wSuiteMask: WORD}, - {wProductType: BYTE}, - {wReserved: BYTE} - ]); - - let kernel32 = false; - try { - kernel32 = ctypes.open("Kernel32"); - } catch (e) { - Cu.reportError("Unable to open kernel32! " + e); - return false; - } - - if (kernel32) { - try { - try { - let GetVersionEx = kernel32.declare("GetVersionExW", - ctypes.default_abi, - BOOL, - OSVERSIONINFOEXW.ptr); - let winVer = OSVERSIONINFOEXW(); - winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size; - - if (0 !== GetVersionEx(winVer.address())) { - return winVer.wServicePackMajor >= 3; - } - Cu.reportError("Unknown failure in GetVersionEX (returned 0)"); - return false; - } catch (e) { - Cu.reportError("Error getting service pack information. Exception: " + e); - return false; - } - } finally { - kernel32.close(); - } - } - - // If the service pack check couldn't be done, assume we can't use the service. return false; } @@ -873,22 +800,6 @@ function shouldUseService() { * @return true if the service is installed. */ function isServiceInstalled() { - if (AppConstants.MOZ_MAINTENANCE_SERVICE && AppConstants.platform == "win") { - let installed = 0; - try { - let wrk = Cc["@mozilla.org/windows-registry-key;1"]. - createInstance(Ci.nsIWindowsRegKey); - wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE, - "SOFTWARE\\Mozilla\\MaintenanceService", - wrk.ACCESS_READ | wrk.WOW64_64); - installed = wrk.readIntValue("Installed"); - wrk.close(); - } catch (e) { - } - installed = installed == 1; // convert to bool - LOG("isServiceInstalled = " + installed); - return installed; - } return false; } @@ -2122,28 +2033,6 @@ UpdateService.prototype = { this._pingSuffix, PREF_APP_UPDATE_CANCELATIONS_OSX, 0, 0); } - if (AppConstants.MOZ_MAINTENANCE_SERVICE) { - // Histogram IDs: - // UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_EXTERNAL - // UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_NOTIFY - AUSTLMY.pingBoolPref("UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_" + - this._pingSuffix, - PREF_APP_UPDATE_SERVICE_ENABLED, true); - // Histogram IDs: - // UPDATE_PREF_SERVICE_ERRORS_EXTERNAL - // UPDATE_PREF_SERVICE_ERRORS_NOTIFY - AUSTLMY.pingIntPref("UPDATE_PREF_SERVICE_ERRORS_" + this._pingSuffix, - PREF_APP_UPDATE_SERVICE_ERRORS, 0, 0); - if (AppConstants.platform == "win") { - // Histogram IDs: - // UPDATE_SERVICE_INSTALLED_EXTERNAL - // UPDATE_SERVICE_INSTALLED_NOTIFY - // UPDATE_SERVICE_MANUALLY_UNINSTALLED_EXTERNAL - // UPDATE_SERVICE_MANUALLY_UNINSTALLED_NOTIFY - AUSTLMY.pingServiceInstallStatus(this._pingSuffix, isServiceInstalled()); - } - } - let prefType = Services.prefs.getPrefType(PREF_APP_UPDATE_URL_OVERRIDE); let overridePrefHasValue = prefType != Ci.nsIPrefBranch.PREF_INVALID; // Histogram IDs: diff --git a/toolkit/mozapps/update/tests/TestAUSHelper.cpp b/toolkit/mozapps/update/tests/TestAUSHelper.cpp index f71103b7a..a20c4a79a 100644 --- a/toolkit/mozapps/update/tests/TestAUSHelper.cpp +++ b/toolkit/mozapps/update/tests/TestAUSHelper.cpp @@ -217,16 +217,8 @@ int NS_main(int argc, NS_tchar **argv) } if (!NS_tstrcmp(argv[1], NS_T("check-signature"))) { -#if defined(XP_WIN) && defined(MOZ_MAINTENANCE_SERVICE) - if (ERROR_SUCCESS == VerifyCertificateTrustForFile(argv[2])) { - return 0; - } else { - return 1; - } -#else - // Not implemented on non-Windows platforms + // Not implemented return 1; -#endif } if (!NS_tstrcmp(argv[1], NS_T("setup-symlink"))) { diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build index 842ec7f90..94949b17f 100644 --- a/toolkit/mozapps/update/tests/moz.build +++ b/toolkit/mozapps/update/tests/moz.build @@ -15,9 +15,6 @@ XPCSHELL_TESTS_MANIFESTS += [ 'unit_base_updater/xpcshell.ini' ] -if CONFIG['MOZ_MAINTENANCE_SERVICE']: - XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini'] - SimplePrograms([ 'TestAUSHelper', 'TestAUSReadStrings', @@ -47,9 +44,6 @@ for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME', 'MOZ_APP_DISPLAYNAME', DEFINES['NS_NO_XPCOM'] = True -if CONFIG['MOZ_MAINTENANCE_SERVICE']: - DEFINES['MOZ_MAINTENANCE_SERVICE'] = CONFIG['MOZ_MAINTENANCE_SERVICE'] - # For debugging purposes only #DEFINES['DISABLE_UPDATER_AUTHENTICODE_CHECK'] = True diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp index dbf50329c..2af973868 100644 --- a/toolkit/mozapps/update/updater/updater.cpp +++ b/toolkit/mozapps/update/updater/updater.cpp @@ -119,9 +119,6 @@ struct UpdateServerThreadArgs #endif #ifdef XP_WIN -#ifdef MOZ_MAINTENANCE_SERVICE -#include "registrycertificates.h" -#endif BOOL PathAppendSafe(LPWSTR base, LPCWSTR extra); BOOL PathGetSiblingFilePath(LPWSTR destinationBuffer, LPCWSTR siblingFilePath, @@ -2024,13 +2021,6 @@ LaunchWinPostProcess(const WCHAR *installationDir, return false; } -#if !defined(TEST_UPDATER) && defined(MOZ_MAINTENANCE_SERVICE) - if (sUsingService && - !DoesBinaryMatchAllowedCertificates(installationDir, exefullpath)) { - return false; - } -#endif - WCHAR dlogFile[MAX_PATH + 1]; if (!PathGetSiblingFilePath(dlogFile, exefullpath, L"uninstall.update")) { return false; @@ -2188,40 +2178,6 @@ WriteStatusFile(int status) WriteStatusFile(text); } -#ifdef MOZ_MAINTENANCE_SERVICE -/* - * Read the update.status file and sets isPendingService to true if - * the status is set to pending-service. - * - * @param isPendingService Out parameter for specifying if the status - * is set to pending-service or not. - * @return true if the information was retrieved and it is pending - * or pending-service. -*/ -static bool -IsUpdateStatusPendingService() -{ - NS_tchar filename[MAXPATHLEN]; - NS_tsnprintf(filename, sizeof(filename)/sizeof(filename[0]), - NS_T("%s/update.status"), gPatchDirPath); - - AutoFile file(NS_tfopen(filename, NS_T("rb"))); - if (file == nullptr) - return false; - - char buf[32] = { 0 }; - fread(buf, sizeof(buf), 1, file); - - const char kPendingService[] = "pending-service"; - const char kAppliedService[] = "applied-service"; - - return (strncmp(buf, kPendingService, - sizeof(kPendingService) - 1) == 0) || - (strncmp(buf, kAppliedService, - sizeof(kAppliedService) - 1) == 0); -} -#endif - #ifdef XP_WIN /* * Read the update.status file and sets isSuccess to true if @@ -2813,20 +2769,6 @@ int NS_main(int argc, NS_tchar **argv) bool testOnlyFallbackKeyExists = false; bool noServiceFallback = false; - // We never want the service to be used unless we build with - // the maintenance service. -#ifdef MOZ_MAINTENANCE_SERVICE - useService = IsUpdateStatusPendingService(); -#ifdef TEST_UPDATER - noServiceFallback = EnvHasValue("MOZ_NO_SERVICE_FALLBACK"); - putenv(const_cast<char*>("MOZ_NO_SERVICE_FALLBACK=")); - // Our tests run with a different apply directory for each test. - // We use this registry key on our test slaves to store the - // allowed name/issuers. - testOnlyFallbackKeyExists = DoesFallbackKeyExist(); -#endif -#endif - // Remove everything except close window from the context menu { HKEY hkApp = nullptr; @@ -3030,10 +2972,6 @@ int NS_main(int argc, NS_tchar **argv) #endif #ifdef XP_WIN -#ifdef MOZ_MAINTENANCE_SERVICE - sUsingService = EnvHasValue("MOZ_USING_SERVICE"); - putenv(const_cast<char*>("MOZ_USING_SERVICE=")); -#endif // lastFallbackError keeps track of the last error for the service not being // used, in case of an error when fallback is not enabled we write the // error to the update.status file. |