зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1158866 - Enable MAR verification on linux via NSS. r=rstrong
This commit is contained in:
Родитель
e4389169ce
Коммит
812f6fd595
|
@ -51,7 +51,7 @@ elif CONFIG['OS_ARCH'] == 'Linux' and CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
|
|||
'signmar',
|
||||
'updatecommon',
|
||||
]
|
||||
OS_LIBS += CONFIG['nspr']
|
||||
OS_LIBS += CONFIG['NSPR_LIBS']
|
||||
else:
|
||||
USE_LIBS += [
|
||||
'updatecommon',
|
||||
|
|
|
@ -399,6 +399,36 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
|||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified path to the library path.
|
||||
* This is used so that updater can find libmozsqlite3.so and other shared libs.
|
||||
*
|
||||
* @param pathToAppend A new library path to prepend to LD_LIBRARY_PATH
|
||||
*/
|
||||
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && !defined(XP_MACOSX)
|
||||
#include "prprf.h"
|
||||
#define PATH_SEPARATOR ":"
|
||||
#define LD_LIBRARY_PATH_ENVVAR_NAME "LD_LIBRARY_PATH"
|
||||
static void
|
||||
AppendToLibPath(const char *pathToAppend)
|
||||
{
|
||||
char *s = nullptr;
|
||||
char *pathValue = getenv(LD_LIBRARY_PATH_ENVVAR_NAME);
|
||||
if (nullptr == pathValue || '\0' == *pathValue) {
|
||||
s = PR_smprintf("%s=%s", LD_LIBRARY_PATH_ENVVAR_NAME, pathToAppend);
|
||||
} else {
|
||||
s = PR_smprintf("%s=%s" PATH_SEPARATOR "%s",
|
||||
LD_LIBRARY_PATH_ENVVAR_NAME, pathToAppend, pathValue);
|
||||
}
|
||||
|
||||
// The memory used by PR_SetEnv is not copied to the environment on all
|
||||
// platform, it can be used by reference directly. So we purposely do not
|
||||
// call PR_smprintf_free on s. Subsequent calls to PR_SetEnv will free
|
||||
// the old memory first.
|
||||
PR_SetEnv(s);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Switch an existing application directory to an updated version that has been
|
||||
* staged.
|
||||
|
@ -585,6 +615,9 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
|
|||
if (gSafeMode) {
|
||||
PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
|
||||
}
|
||||
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && !defined(XP_MACOSX)
|
||||
AppendToLibPath(installDirPath.get());
|
||||
#endif
|
||||
|
||||
LOG(("spawning updater process for replacing [%s]\n", updaterPath.get()));
|
||||
|
||||
|
@ -850,6 +883,9 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
|
|||
if (gSafeMode) {
|
||||
PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
|
||||
}
|
||||
#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(XP_WIN) && !defined(XP_MACOSX)
|
||||
AppendToLibPath(installDirPath.get());
|
||||
#endif
|
||||
|
||||
if (isOSUpdate) {
|
||||
PR_SetEnv("MOZ_OS_UPDATE=1");
|
||||
|
|
Загрузка…
Ссылка в новой задаче