Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: remoting/protocol/jingle_session_manager.cc

Issue 6649005: Fix handling of invalid certificates in JingleSessionManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits> 5 #include <limits>
6 6
7 #include "remoting/protocol/jingle_session_manager.h" 7 #include "remoting/protocol/jingle_session_manager.h"
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 child = element->FirstNamed(QName(kChromotingXmlNamespace, 437 child = element->FirstNamed(QName(kChromotingXmlNamespace,
438 kAuthenticationTag)); 438 kAuthenticationTag));
439 if (child) 439 if (child)
440 child = child->FirstNamed(QName(kChromotingXmlNamespace, 440 child = child->FirstNamed(QName(kChromotingXmlNamespace,
441 kCertificateTag)); 441 kCertificateTag));
442 442
443 if (child) { 443 if (child) {
444 std::string base64_cert = child->BodyText(); 444 std::string base64_cert = child->BodyText();
445 std::string der_cert; 445 std::string der_cert;
446 bool ret = base::Base64Decode(base64_cert, &der_cert); 446 bool ret = base::Base64Decode(base64_cert, &der_cert);
447 DCHECK(ret) << "Failed to decode certificate"; 447 if (!ret) {
448 LOG(ERROR) << "Failed to decode certificate received from the peer.";
449 return false;
450 }
448 certificate = net::X509Certificate::CreateFromBytes(der_cert.data(), 451 certificate = net::X509Certificate::CreateFromBytes(der_cert.data(),
449 der_cert.length()); 452 der_cert.length());
450 } 453 }
451 454
452 *content = new ContentDescription(config.release(), auth_token, 455 *content = new ContentDescription(config.release(), auth_token,
453 certificate); 456 certificate);
454 return true; 457 return true;
455 } 458 }
456 LOG(ERROR) << "Invalid description: " << element->Str(); 459 LOG(ERROR) << "Invalid description: " << element->Str();
457 return false; 460 return false;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 scoped_refptr<net::X509Certificate> certificate) { 540 scoped_refptr<net::X509Certificate> certificate) {
538 cricket::SessionDescription* desc = new cricket::SessionDescription(); 541 cricket::SessionDescription* desc = new cricket::SessionDescription();
539 desc->AddContent(JingleSession::kChromotingContentName, 542 desc->AddContent(JingleSession::kChromotingContentName,
540 kChromotingXmlNamespace, 543 kChromotingXmlNamespace,
541 new ContentDescription(config, auth_token, certificate)); 544 new ContentDescription(config, auth_token, certificate));
542 return desc; 545 return desc;
543 } 546 }
544 547
545 } // namespace protocol 548 } // namespace protocol
546 } // namespace remoting 549 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698