| Index: chromeos/dbus/cryptohome_client.cc
|
| diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
|
| index cd027e3e6249f3b87329ff5fcff342934f8dc176..54116d7b21788fb6d806b0ab34d02295f6c60be0 100644
|
| --- a/chromeos/dbus/cryptohome_client.cc
|
| +++ b/chromeos/dbus/cryptohome_client.cc
|
| @@ -330,6 +330,23 @@ class CryptohomeClientImpl : public CryptohomeClient {
|
| }
|
|
|
| // CryptohomeClient override.
|
| + virtual void Pkcs11GetTpmTokenInfoForUser(
|
| + const std::string& username,
|
| + const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE {
|
| + dbus::MethodCall method_call(
|
| + cryptohome::kCryptohomeInterface,
|
| + cryptohome::kCryptohomePkcs11GetTpmTokenInfoForUser);
|
| + dbus::MessageWriter writer(&method_call);
|
| + writer.AppendString(username);
|
| + proxy_->CallMethod(
|
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
|
| + base::Bind(
|
| + &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfoForUser,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + callback));
|
| + }
|
| +
|
| + // CryptohomeClient override.
|
| virtual bool InstallAttributesGet(const std::string& name,
|
| std::vector<uint8>* value,
|
| bool* successful) OVERRIDE {
|
| @@ -729,6 +746,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
|
| bool result = false;
|
| if (!reader.PopBool(&result)) {
|
| callback.Run(DBUS_METHOD_CALL_FAILURE, false);
|
| + LOG(ERROR) << "Invalid response: " << response->ToString();
|
| return;
|
| }
|
| callback.Run(DBUS_METHOD_CALL_SUCCESS, result);
|
| @@ -770,21 +788,44 @@ class CryptohomeClientImpl : public CryptohomeClient {
|
| callback.Run(DBUS_METHOD_CALL_SUCCESS, result, data);
|
| }
|
|
|
| - // Handles responses for Pkcs11GetTpmtTokenInfo.
|
| + // Handles responses for Pkcs11GetTpmTokenInfo.
|
| void OnPkcs11GetTpmTokenInfo(const Pkcs11GetTpmTokenInfoCallback& callback,
|
| dbus::Response* response) {
|
| if (!response) {
|
| - callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string());
|
| + callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
|
| return;
|
| }
|
| dbus::MessageReader reader(response);
|
| std::string label;
|
| std::string user_pin;
|
| if (!reader.PopString(&label) || !reader.PopString(&user_pin)) {
|
| - callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string());
|
| + callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
|
| + LOG(ERROR) << "Invalid response: " << response->ToString();
|
| + return;
|
| + }
|
| + const int kDefaultSlot = 0;
|
| + callback.Run(DBUS_METHOD_CALL_SUCCESS, label, user_pin, kDefaultSlot);
|
| + }
|
| +
|
| + // Handles responses for Pkcs11GetTpmTokenInfoForUser.
|
| + void OnPkcs11GetTpmTokenInfoForUser(
|
| + const Pkcs11GetTpmTokenInfoCallback& callback,
|
| + dbus::Response* response) {
|
| + if (!response) {
|
| + callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
|
| + return;
|
| + }
|
| + dbus::MessageReader reader(response);
|
| + std::string label;
|
| + std::string user_pin;
|
| + int slot = 0;
|
| + if (!reader.PopString(&label) || !reader.PopString(&user_pin) ||
|
| + !reader.PopInt32(&slot)) {
|
| + callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string(), -1);
|
| + LOG(ERROR) << "Invalid response: " << response->ToString();
|
| return;
|
| }
|
| - callback.Run(DBUS_METHOD_CALL_SUCCESS, label, user_pin);
|
| + callback.Run(DBUS_METHOD_CALL_SUCCESS, label, user_pin, slot);
|
| }
|
|
|
| // Handles AsyncCallStatus signal.
|
|
|