Only allow the account mailbox to attempt provisioning

* We were allowing all sync services to attempt provisioning, but this
  could potentially lead to a race condition in which two different
  policy keys are created on the server (this is speculative)
* Change to allow only the account mailbox to attempt provisioning
* Log policy keys when verbose exchange logging is enabled
* We'll see if this solves the referenced bug

Bug: 2569162
Change-Id: I36c60098a4866882a8f9f4c288da54ea378d9aee
This commit is contained in:
Marc Blank 2010-04-10 19:43:56 -07:00
parent 6a4eae5f41
commit 3b19278a24

View File

@ -1020,6 +1020,9 @@ public class EasSyncService extends AbstractSyncService {
String key = mAccount.mSecuritySyncKey;
if (key == null || key.length() == 0) {
return;
}
if (Eas.PARSER_LOG) {
userLog("Policy key: " , key);
}
method.setHeader("X-MS-PolicyKey", key);
}
@ -1385,7 +1388,10 @@ public class EasSyncService extends AbstractSyncService {
}
} else if (isProvisionError(code)) {
// If the sync error is a provisioning failure (perhaps the policies changed),
// let's try the provisining procedure
// let's try the provisioning procedure
// Provisioning must only be attempted for the account mailbox - trying to
// provision any other mailbox may result in race conditions and the creation
// of multiple policy keys.
if (!tryProvision()) {
// Set the appropriate failure status
mExitStatus = EXIT_SECURITY_FAILURE;
@ -1918,10 +1924,7 @@ public class EasSyncService extends AbstractSyncService {
} else {
userLog("Sync response error: ", code);
if (isProvisionError(code)) {
if (!tryProvision()) {
mExitStatus = EXIT_SECURITY_FAILURE;
return;
}
mExitStatus = EXIT_SECURITY_FAILURE;
} else if (isAuthError(code)) {
mExitStatus = EXIT_LOGIN_FAILURE;
} else {