Fixed unsafe hashmap.at calls in regsitry client.

Review: https://reviews.apache.org/r/39882


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/3a9de5a6
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/3a9de5a6
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/3a9de5a6

Branch: refs/heads/master
Commit: 3a9de5a6c2e9d0e2a3807a4fc4c3ae7f3f231599
Parents: f2f4e4f
Author: Jojy Varghese <[email protected]>
Authored: Thu Nov 5 18:48:36 2015 -0800
Committer: Timothy Chen <[email protected]>
Committed: Thu Nov 5 22:28:05 2015 -0800

----------------------------------------------------------------------
 .../mesos/provisioner/docker/registry_client.cpp        | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3a9de5a6/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
----------------------------------------------------------------------
diff --git 
a/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp 
b/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
index 6164fa9..e9fb776 100644
--- a/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
+++ b/src/slave/containerizer/mesos/provisioner/docker/registry_client.cpp
@@ -339,6 +339,18 @@ Future<http::Response> RegistryClientProcess::doHttpGet(
               authAttributes.error());
         }
 
+        if (!authAttributes.get().contains("service")) {
+          return Failure(
+              "Failed to find authentication attribute \"service\" in response"
+              "from authorization server");
+        }
+
+        if (!authAttributes.get().contains("scope")) {
+          return Failure(
+              "Failed to find authentication attribute \"scope\" in response"
+              "from authorization server");
+        }
+
         // TODO(jojy): Currently only handling TLS/cert authentication.
         Future<Token> tokenResponse = tokenManager_->getToken(
           authAttributes.get().at("service"),

Reply via email to