| 590 | |
| 591 | |
| 592 | Option<Error> validateUpdate( |
| 593 | const FrameworkInfo& oldInfo, |
| 594 | const FrameworkInfo& newInfo) |
| 595 | { |
| 596 | Option<string> oldPrincipal = None(); |
| 597 | if (oldInfo.has_principal()) { |
| 598 | oldPrincipal = oldInfo.principal(); |
| 599 | } |
| 600 | |
| 601 | Option<string> newPrincipal = None(); |
| 602 | if (newInfo.has_principal()) { |
| 603 | newPrincipal = newInfo.principal(); |
| 604 | } |
| 605 | |
| 606 | if (oldPrincipal != newPrincipal) { |
| 607 | // We should not expose the old principal to the 'scheduler' which tries |
| 608 | // to subscribe with a known framework ID but another principal. |
| 609 | // However, it still should be possible for the people having access to |
| 610 | // the master to understand what is going on, hence the log message. |
| 611 | LOG(WARNING) |
| 612 | << "Framework " << oldInfo.id() << " which had a principal " |
| 613 | << " '" << oldPrincipal.getOrElse("<NONE>") << "'" |
| 614 | << " tried to (re)subscribe with a new principal " |
| 615 | << " '" << newPrincipal.getOrElse("<NONE>") << "'"; |
| 616 | |
| 617 | return Error("Changing framework's principal is not allowed."); |
| 618 | } |
| 619 | |
| 620 | if (newInfo.user() != oldInfo.user()) { |
| 621 | return Error( |
| 622 | "Updating 'FrameworkInfo.user' is unsupported" |
| 623 | "; attempted to update from '" + oldInfo.user() + "'" |
| 624 | " to '" + newInfo.user() + "'"); |
| 625 | } |
| 626 | |
| 627 | if (newInfo.checkpoint() != oldInfo.checkpoint()) { |
| 628 | return Error( |
| 629 | "Updating 'FrameworkInfo.checkpoint' is unsupported" |
| 630 | "; attempted to update" |
| 631 | " from '" + stringify(oldInfo.checkpoint()) + "'" |
| 632 | " to '" + stringify(newInfo.checkpoint()) + "'"); |
| 633 | } |
| 634 | |
| 635 | return None(); |
| 636 | } |
| 637 | |
| 638 | |
| 639 | void preserveImmutableFields( |