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

Side by Side Diff: remoting/host/register_support_host_request.cc

Issue 1131653002: Use lower-case JIDs when generating signatures for messages sent to CRD bot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/register_support_host_request.h" 5 #include "remoting/host/register_support_host_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "remoting/base/constants.h" 13 #include "remoting/base/constants.h"
14 #include "remoting/host/host_config.h" 14 #include "remoting/host/host_config.h"
15 #include "remoting/signaling/iq_sender.h" 15 #include "remoting/signaling/iq_sender.h"
16 #include "remoting/signaling/jid_util.h"
16 #include "remoting/signaling/signal_strategy.h" 17 #include "remoting/signaling/signal_strategy.h"
17 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" 18 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h"
18 #include "third_party/webrtc/libjingle/xmpp/constants.h" 19 #include "third_party/webrtc/libjingle/xmpp/constants.h"
19 20
20 using buzz::QName; 21 using buzz::QName;
21 using buzz::XmlElement; 22 using buzz::XmlElement;
22 23
23 namespace remoting { 24 namespace remoting {
24 25
25 namespace { 26 namespace {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 scoped_ptr<XmlElement> RegisterSupportHostRequest::CreateSignature( 92 scoped_ptr<XmlElement> RegisterSupportHostRequest::CreateSignature(
92 const std::string& jid) { 93 const std::string& jid) {
93 scoped_ptr<XmlElement> signature_tag(new XmlElement( 94 scoped_ptr<XmlElement> signature_tag(new XmlElement(
94 QName(kChromotingXmlNamespace, kSignatureTag))); 95 QName(kChromotingXmlNamespace, kSignatureTag)));
95 96
96 int64 time = static_cast<int64>(base::Time::Now().ToDoubleT()); 97 int64 time = static_cast<int64>(base::Time::Now().ToDoubleT());
97 std::string time_str(base::Int64ToString(time)); 98 std::string time_str(base::Int64ToString(time));
98 signature_tag->AddAttr( 99 signature_tag->AddAttr(
99 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); 100 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str);
100 101
101 std::string message = jid + ' ' + time_str; 102 std::string message = NormalizeJid(jid) + ' ' + time_str;
102 std::string signature(key_pair_->SignMessage(message)); 103 std::string signature(key_pair_->SignMessage(message));
103 signature_tag->AddText(signature); 104 signature_tag->AddText(signature);
104 105
105 return signature_tag.Pass(); 106 return signature_tag.Pass();
106 } 107 }
107 108
108 bool RegisterSupportHostRequest::ParseResponse(const XmlElement* response, 109 bool RegisterSupportHostRequest::ParseResponse(const XmlElement* response,
109 std::string* support_id, 110 std::string* support_id,
110 base::TimeDelta* lifetime) { 111 base::TimeDelta* lifetime) {
111 std::string type = response->Attr(buzz::QN_TYPE); 112 std::string type = response->Attr(buzz::QN_TYPE);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Cleanup state before calling the callback. 177 // Cleanup state before calling the callback.
177 request_.reset(); 178 request_.reset();
178 iq_sender_.reset(); 179 iq_sender_.reset();
179 signal_strategy_->RemoveListener(this); 180 signal_strategy_->RemoveListener(this);
180 signal_strategy_ = nullptr; 181 signal_strategy_ = nullptr;
181 182
182 base::ResetAndReturn(&callback_).Run(success, support_id, lifetime); 183 base::ResetAndReturn(&callback_).Run(success, support_id, lifetime);
183 } 184 }
184 185
185 } // namespace remoting 186 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender_unittest.cc ('k') | remoting/host/register_support_host_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698