shill: vpn: Destroy connection on fatal unsupported management messages.
This will inidicate VPN service connection failure to the UI and end
up prompting the user to re-enter credentials and configuration
options. Still TODO is to pass through relevant error messages to the
UI.
BUG=chromium-os:29425
TEST=unit tests
Change-Id: If34c9aa0290e5b8a9927687c0898da27ddfbb277
Reviewed-on: https://gerrit.chromium.org/gerrit/20374
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/openvpn_management_server.cc b/openvpn_management_server.cc
index fa4aa48..7fd42f2 100644
--- a/openvpn_management_server.cc
+++ b/openvpn_management_server.cc
@@ -168,7 +168,8 @@
PerformStaticChallenge(tag);
} else {
NOTIMPLEMENTED()
- << "User/password (no-OTP) authentication not implemented.";
+ << ": User/password (no-OTP) authentication not implemented.";
+ driver_->Cleanup(Service::kStateFailure);
}
} else if (StartsWithASCII(tag, "User-Specific TPM Token", true)) {
SupplyTPMToken(tag);
@@ -197,7 +198,8 @@
string otp =
driver_->args()->LookupString(flimflam::kOpenVPNOTPProperty, "");
if (user.empty() || password.empty() || otp.empty()) {
- NOTIMPLEMENTED() << "Missing credentials.";
+ NOTIMPLEMENTED() << ": Missing credentials.";
+ driver_->Cleanup(Service::kStateFailure);
return;
}
gchar *b64_password =
@@ -221,7 +223,8 @@
void OpenVPNManagementServer::SupplyTPMToken(const string &tag) {
string pin = driver_->args()->LookupString(flimflam::kOpenVPNPinProperty, "");
if (pin.empty()) {
- NOTIMPLEMENTED() << "Missing PIN.";
+ NOTIMPLEMENTED() << ": Missing PIN.";
+ driver_->Cleanup(Service::kStateFailure);
return;
}
SendPassword(tag, pin);
@@ -233,6 +236,7 @@
return false;
}
NOTIMPLEMENTED();
+ driver_->Cleanup(Service::kStateFailure);
return true;
}