| OLD | NEW |
| 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 "chrome/browser/password_manager/native_backend_kwallet_x.h" | 5 #include "chrome/browser/password_manager/native_backend_kwallet_x.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 builder.AppendString(signon_realm); // key | 385 builder.AppendString(signon_realm); // key |
| 386 builder.AppendString(app_name_); // appid | 386 builder.AppendString(app_name_); // appid |
| 387 scoped_ptr<dbus::Response> response( | 387 scoped_ptr<dbus::Response> response( |
| 388 kwallet_proxy_->CallMethodAndBlock( | 388 kwallet_proxy_->CallMethodAndBlock( |
| 389 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); | 389 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); |
| 390 if (!response.get()) { | 390 if (!response.get()) { |
| 391 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; | 391 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; |
| 392 continue; | 392 continue; |
| 393 } | 393 } |
| 394 dbus::MessageReader reader(response.get()); | 394 dbus::MessageReader reader(response.get()); |
| 395 uint8_t* bytes = NULL; | 395 const uint8_t* bytes = NULL; |
| 396 size_t length = 0; | 396 size_t length = 0; |
| 397 if (!reader.PopArrayOfBytes(&bytes, &length)) { | 397 if (!reader.PopArrayOfBytes(&bytes, &length)) { |
| 398 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " | 398 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " |
| 399 << response->ToString(); | 399 << response->ToString(); |
| 400 continue; | 400 continue; |
| 401 } | 401 } |
| 402 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm)) | 402 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm)) |
| 403 continue; | 403 continue; |
| 404 | 404 |
| 405 // Can't we all just agree on whether bytes are signed or not? Please? | 405 // Can't we all just agree on whether bytes are signed or not? Please? |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 builder.AppendString(signon_realm); // key | 495 builder.AppendString(signon_realm); // key |
| 496 builder.AppendString(app_name_); // appid | 496 builder.AppendString(app_name_); // appid |
| 497 scoped_ptr<dbus::Response> response( | 497 scoped_ptr<dbus::Response> response( |
| 498 kwallet_proxy_->CallMethodAndBlock( | 498 kwallet_proxy_->CallMethodAndBlock( |
| 499 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); | 499 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); |
| 500 if (!response.get()) { | 500 if (!response.get()) { |
| 501 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; | 501 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; |
| 502 return false; | 502 return false; |
| 503 } | 503 } |
| 504 dbus::MessageReader reader(response.get()); | 504 dbus::MessageReader reader(response.get()); |
| 505 uint8_t* bytes = NULL; | 505 const uint8_t* bytes = NULL; |
| 506 size_t length = 0; | 506 size_t length = 0; |
| 507 if (!reader.PopArrayOfBytes(&bytes, &length)) { | 507 if (!reader.PopArrayOfBytes(&bytes, &length)) { |
| 508 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " | 508 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " |
| 509 << response->ToString(); | 509 << response->ToString(); |
| 510 return false; | 510 return false; |
| 511 } | 511 } |
| 512 if (!bytes) | 512 if (!bytes) |
| 513 return false; | 513 return false; |
| 514 if (!CheckSerializedValue(bytes, length, signon_realm)) { | 514 if (!CheckSerializedValue(bytes, length, signon_realm)) { |
| 515 // This is weird, but we choose not to call it an error. There is an | 515 // This is weird, but we choose not to call it an error. There is an |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 builder.AppendString(signon_realm); // key | 603 builder.AppendString(signon_realm); // key |
| 604 builder.AppendString(app_name_); // appid | 604 builder.AppendString(app_name_); // appid |
| 605 scoped_ptr<dbus::Response> response( | 605 scoped_ptr<dbus::Response> response( |
| 606 kwallet_proxy_->CallMethodAndBlock( | 606 kwallet_proxy_->CallMethodAndBlock( |
| 607 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); | 607 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); |
| 608 if (!response.get()) { | 608 if (!response.get()) { |
| 609 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; | 609 LOG(ERROR) << "Error contacting kwalletd (readEntry)"; |
| 610 continue; | 610 continue; |
| 611 } | 611 } |
| 612 dbus::MessageReader reader(response.get()); | 612 dbus::MessageReader reader(response.get()); |
| 613 uint8_t* bytes = NULL; | 613 const uint8_t* bytes = NULL; |
| 614 size_t length = 0; | 614 size_t length = 0; |
| 615 if (!reader.PopArrayOfBytes(&bytes, &length)) { | 615 if (!reader.PopArrayOfBytes(&bytes, &length)) { |
| 616 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " | 616 LOG(ERROR) << "Error reading response from kwalletd (readEntry): " |
| 617 << response->ToString(); | 617 << response->ToString(); |
| 618 continue; | 618 continue; |
| 619 } | 619 } |
| 620 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm)) | 620 if (!bytes || !CheckSerializedValue(bytes, length, signon_realm)) |
| 621 continue; | 621 continue; |
| 622 | 622 |
| 623 // Can't we all just agree on whether bytes are signed or not? Please? | 623 // Can't we all just agree on whether bytes are signed or not? Please? |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 // Each other profile must be able to migrate the shared data as well, | 962 // Each other profile must be able to migrate the shared data as well, |
| 963 // so we must leave it alone. After a few releases, we'll add code to | 963 // so we must leave it alone. After a few releases, we'll add code to |
| 964 // delete them, and eventually remove this migration code. | 964 // delete them, and eventually remove this migration code. |
| 965 // TODO(mdm): follow through with the plan above. | 965 // TODO(mdm): follow through with the plan above. |
| 966 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); | 966 PasswordStoreX::SetPasswordsUseLocalProfileId(prefs_); |
| 967 } else { | 967 } else { |
| 968 // We failed to migrate for some reason. Use the old folder name. | 968 // We failed to migrate for some reason. Use the old folder name. |
| 969 folder_name_ = kKWalletFolder; | 969 folder_name_ = kKWalletFolder; |
| 970 } | 970 } |
| 971 } | 971 } |
| OLD | NEW |