зеркало из https://github.com/mozilla/gecko-dev.git
Bug 711834 - Clear out env variable after getting value from unelevated updater.exe. r=rstrong.
This commit is contained in:
Родитель
b5dfde2fac
Коммит
610969450a
|
@ -1387,7 +1387,10 @@ PatchIfFile::Finish(int status)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
LaunchCallbackApp(const NS_tchar *workingDir, int argc, NS_tchar **argv)
|
LaunchCallbackApp(const NS_tchar *workingDir,
|
||||||
|
int argc,
|
||||||
|
NS_tchar **argv,
|
||||||
|
bool usingService)
|
||||||
{
|
{
|
||||||
putenv(const_cast<char*>("NO_EM_RESTART="));
|
putenv(const_cast<char*>("NO_EM_RESTART="));
|
||||||
putenv(const_cast<char*>("MOZ_LAUNCHED_CHILD=1"));
|
putenv(const_cast<char*>("MOZ_LAUNCHED_CHILD=1"));
|
||||||
|
@ -1406,7 +1409,6 @@ LaunchCallbackApp(const NS_tchar *workingDir, int argc, NS_tchar **argv)
|
||||||
#elif defined(XP_WIN)
|
#elif defined(XP_WIN)
|
||||||
// Do not allow the callback to run when running an update through the
|
// Do not allow the callback to run when running an update through the
|
||||||
// service as session 0. The unelevated updater.exe will do the launching.
|
// service as session 0. The unelevated updater.exe will do the launching.
|
||||||
LPCWSTR usingService = _wgetenv(L"MOZ_USING_SERVICE");
|
|
||||||
if (!usingService) {
|
if (!usingService) {
|
||||||
WinLaunchChild(argv[0], argc, argv, NULL);
|
WinLaunchChild(argv[0], argc, argv, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1603,7 +1605,8 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
|
|
||||||
bool useService = false;
|
bool useService = false;
|
||||||
bool testOnlyFallbackKeyExists = false;
|
bool testOnlyFallbackKeyExists = false;
|
||||||
LPCWSTR runningAsTest = _wgetenv(L"MOZ_NO_SERVICE_FALLBACK");
|
bool noServiceFallback = _wgetenv(L"MOZ_NO_SERVICE_FALLBACK") != NULL;
|
||||||
|
_wputenv(L"MOZ_NO_SERVICE_FALLBACK=");
|
||||||
|
|
||||||
// We never want the service to be used unless we build with
|
// We never want the service to be used unless we build with
|
||||||
// the maintenance service.
|
// the maintenance service.
|
||||||
|
@ -1678,7 +1681,8 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
const int callbackIndex = 5;
|
const int callbackIndex = 5;
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
LPCWSTR usingService = _wgetenv(L"MOZ_USING_SERVICE");
|
bool usingService = _wgetenv(L"MOZ_USING_SERVICE") != NULL;
|
||||||
|
_wputenv(L"MOZ_USING_SERVICE=");
|
||||||
// lastFallbackError keeps track of the last error for the service not being
|
// 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
|
// used, in case of an error when fallback is not enabled we write the
|
||||||
// error to the update.status file.
|
// error to the update.status file.
|
||||||
|
@ -1718,7 +1722,7 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
NS_T("%s/update_elevated.lock"), argv[1]);
|
NS_T("%s/update_elevated.lock"), argv[1]);
|
||||||
|
|
||||||
if (updateLockFileHandle == INVALID_HANDLE_VALUE ||
|
if (updateLockFileHandle == INVALID_HANDLE_VALUE ||
|
||||||
(useService && testOnlyFallbackKeyExists && runningAsTest)) {
|
(useService && testOnlyFallbackKeyExists && noServiceFallback)) {
|
||||||
if (!_waccess(elevatedLockFilePath, F_OK) &&
|
if (!_waccess(elevatedLockFilePath, F_OK) &&
|
||||||
NS_tremove(elevatedLockFilePath) != 0) {
|
NS_tremove(elevatedLockFilePath) != 0) {
|
||||||
fprintf(stderr, "Update already elevated! Exiting\n");
|
fprintf(stderr, "Update already elevated! Exiting\n");
|
||||||
|
@ -1829,7 +1833,8 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
// We don't launch the elevated updater in the case that we did have
|
// We don't launch the elevated updater in the case that we did have
|
||||||
// write access all along because in that case the only reason we're
|
// write access all along because in that case the only reason we're
|
||||||
// using the service is because we are testing.
|
// using the service is because we are testing.
|
||||||
if (!useService && updateLockFileHandle == INVALID_HANDLE_VALUE) {
|
if (!useService && !noServiceFallback &&
|
||||||
|
updateLockFileHandle == INVALID_HANDLE_VALUE) {
|
||||||
SHELLEXECUTEINFO sinfo;
|
SHELLEXECUTEINFO sinfo;
|
||||||
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO));
|
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO));
|
||||||
sinfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
sinfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||||
|
@ -1853,9 +1858,9 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > callbackIndex) {
|
// We are already contained in a condition where argc > callbackIndex
|
||||||
LaunchCallbackApp(argv[4], argc - callbackIndex, argv + callbackIndex);
|
LaunchCallbackApp(argv[4], argc - callbackIndex,
|
||||||
}
|
argv + callbackIndex, usingService);
|
||||||
|
|
||||||
CloseHandle(elevatedFileHandle);
|
CloseHandle(elevatedFileHandle);
|
||||||
|
|
||||||
|
@ -1920,7 +1925,10 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
LogFinish();
|
LogFinish();
|
||||||
WriteStatusFile(WRITE_ERROR);
|
WriteStatusFile(WRITE_ERROR);
|
||||||
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
|
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
|
||||||
LaunchCallbackApp(argv[4], argc - callbackIndex, argv + callbackIndex);
|
LaunchCallbackApp(argv[4],
|
||||||
|
argc - callbackIndex,
|
||||||
|
argv + callbackIndex,
|
||||||
|
usingService);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1931,7 +1939,10 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
LogFinish();
|
LogFinish();
|
||||||
WriteStatusFile(WRITE_ERROR);
|
WriteStatusFile(WRITE_ERROR);
|
||||||
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
|
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
|
||||||
LaunchCallbackApp(argv[4], argc - callbackIndex, argv + callbackIndex);
|
LaunchCallbackApp(argv[4],
|
||||||
|
argc - callbackIndex,
|
||||||
|
argv + callbackIndex,
|
||||||
|
usingService);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1992,7 +2003,10 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
WriteStatusFile(WRITE_ERROR);
|
WriteStatusFile(WRITE_ERROR);
|
||||||
NS_tremove(gCallbackBackupPath);
|
NS_tremove(gCallbackBackupPath);
|
||||||
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
|
EXIT_WHEN_ELEVATED(elevatedLockFilePath, updateLockFileHandle, 1);
|
||||||
LaunchCallbackApp(argv[4], argc - callbackIndex, argv + callbackIndex);
|
LaunchCallbackApp(argv[4],
|
||||||
|
argc - callbackIndex,
|
||||||
|
argv + callbackIndex,
|
||||||
|
usingService);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2069,7 +2083,10 @@ int NS_main(int argc, NS_tchar **argv)
|
||||||
LaunchMacPostProcess(argv[callbackIndex]);
|
LaunchMacPostProcess(argv[callbackIndex]);
|
||||||
}
|
}
|
||||||
#endif /* XP_MACOSX */
|
#endif /* XP_MACOSX */
|
||||||
LaunchCallbackApp(argv[4], argc - callbackIndex, argv + callbackIndex);
|
LaunchCallbackApp(argv[4],
|
||||||
|
argc - callbackIndex,
|
||||||
|
argv + callbackIndex,
|
||||||
|
usingService);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче