Bug 721758 - Ability to configure updater to accept multiple MAR IDs. r=rstrong

This commit is contained in:
Brian R. Bondy 2012-02-24 16:29:42 -05:00
parent 277ff09cb5
commit ff1d6465d0
8 changed files with 29 additions and 7 deletions

View File

@ -59,6 +59,11 @@ MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
MOZ_BRANDING_DIRECTORY=browser/branding/nightly
MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# This should usually be the same as the value MAR_CHANNEL_ID.
# If more than one ID is needed, then you should use a comma separated list
# of values.
ACCEPTED_MAR_CHANNEL_IDS=firefox-mozilla-central
# The MAR_CHANNEL_ID must not contain the following 3 characters: ",\t "
MAR_CHANNEL_ID=firefox-mozilla-central
MOZ_PROFILE_MIGRATOR=1
MOZ_EXTENSION_MANAGER=1

View File

@ -104,6 +104,7 @@ DEFINES += \
-DMOZ_APP_VENDOR="$(MOZ_APP_VENDOR)" \
-DMOZ_APP_ID="$(MOZ_APP_ID)" \
-DMAR_CHANNEL_ID="$(MAR_CHANNEL_ID)" \
-DACCEPTED_MAR_CHANNEL_IDS="$(ACCEPTED_MAR_CHANNEL_IDS)" \
$(NULL)
ifdef MOZ_APP_PROFILE

View File

@ -41,4 +41,4 @@
#filter substitution
[Settings]
MAR_CHANNEL_ID=@MAR_CHANNEL_ID@
ACCEPTED_MAR_CHANNEL_IDS=@ACCEPTED_MAR_CHANNEL_IDS@

View File

@ -54,6 +54,7 @@ MOZ_APP_VENDOR = @MOZ_APP_VENDOR@
MOZ_APP_PROFILE = @MOZ_APP_PROFILE@
MOZ_APP_ID = @MOZ_APP_ID@
MAR_CHANNEL_ID = @MAR_CHANNEL_ID@
ACCEPTED_MAR_CHANNEL_IDS = @ACCEPTED_MAR_CHANNEL_IDS@
MOZ_PROFILE_MIGRATOR = @MOZ_PROFILE_MIGRATOR@
MOZ_EXTENSION_MANAGER = @MOZ_EXTENSION_MANAGER@
MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@

View File

@ -8695,6 +8695,7 @@ AC_SUBST(MOZ_APP_VENDOR)
AC_SUBST(MOZ_APP_PROFILE)
AC_SUBST(MOZ_APP_ID)
AC_SUBST(MAR_CHANNEL_ID)
AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
AC_SUBST(MOZ_PROFILE_MIGRATOR)
AC_SUBST(MOZ_EXTENSION_MANAGER)
AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")

View File

@ -574,8 +574,8 @@ WaitForServiceStop(LPCWSTR serviceName, DWORD maxWaitSeconds)
*
* @param process The process to check for existance
* @return ERROR_NOT_FOUND if the process was not found
* @ ERROR_SUCCESS if the process was found and there were no errors
* @ Other Win32 system error code for other errors
* ERROR_SUCCESS if the process was found and there were no errors
* Other Win32 system error code for other errors
**/
DWORD
IsProcessRunning(LPCWSTR filename)

View File

@ -168,6 +168,8 @@ ArchiveReader::VerifySignature()
* with a matching MAR channel name will succeed.
* If an empty string is passed, no check will be done
* for the channel name in the product information block.
* If a comma separated list of values is passed then
* one value must match.
* @param appVersion The application version to use, only MARs with an
* application version >= to appVersion will be applied.
* @return OK on success
@ -198,8 +200,20 @@ ArchiveReader::VerifyProductInformation(const char *MARChannelID,
// Only check the MAR channel name if specified, it should be passed in from
// the update-settings.ini file.
if (MARChannelID && strlen(MARChannelID)) {
if (rv == OK && strcmp(MARChannelID, productInfoBlock.MARChannelID)) {
rv = MAR_CHANNEL_MISMATCH_ERROR;
// Check for at least one match in the comma separated list of values.
const char *delimiter = " ,\t";
// Make a copy of the string in case a read only memory buffer
// was specified. strtok modifies the input buffer.
char channelCopy[512] = { 0 };
strncpy(channelCopy, MARChannelID, sizeof(channelCopy) - 1);
char *channel = strtok(channelCopy, delimiter);
rv = MAR_CHANNEL_MISMATCH_ERROR;
while(channel) {
if (!strcmp(channel, productInfoBlock.MARChannelID)) {
rv = OK;
break;
}
channel = strtok(NULL, delimiter);
}
}

View File

@ -1541,7 +1541,7 @@ WaitForServiceFinishThread(void *param)
#endif
/**
* This function reads in the MAR_CHANNEL_ID from update-settings.ini
* This function reads in the ACCEPTED_MAR_CHANNEL_IDS from update-settings.ini
*
* @param path The path to the ini file that is to be read
* @param results A pointer to the location to store the read strings
@ -1551,7 +1551,7 @@ static int
ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results)
{
const unsigned int kNumStrings = 1;
const char *kUpdaterKeys = "MAR_CHANNEL_ID\0";
const char *kUpdaterKeys = "ACCEPTED_MAR_CHANNEL_IDS\0";
char updater_strings[kNumStrings][MAX_TEXT_LEN];
int result = ReadStrings(path, kUpdaterKeys, kNumStrings,