shill: vpn: Make L2TPIPSec driver use the base VPNDriver's KeyValueStore.
This should fix property handling which was currently split between
the base and the derived class.
BUG=chromium-os:30045
TEST=unit tests
Change-Id: I74268b3825223907d483bb82539788a29ff05d78
Reviewed-on: https://gerrit.chromium.org/gerrit/21182
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/l2tp_ipsec_driver.cc b/l2tp_ipsec_driver.cc
index 51ef9e9..6ec67a7 100644
--- a/l2tp_ipsec_driver.cc
+++ b/l2tp_ipsec_driver.cc
@@ -199,7 +199,7 @@
}
bool L2TPIPSecDriver::InitOptions(vector<string> *options, Error *error) {
- string vpnhost = args_.LookupString(flimflam::kProviderHostProperty, "");
+ string vpnhost = args()->LookupString(flimflam::kProviderHostProperty, "");
if (vpnhost.empty()) {
Error::PopulateAndLog(
error, Error::kInvalidArguments, "VPN host not specified.");
@@ -247,7 +247,7 @@
}
bool L2TPIPSecDriver::InitPSKOptions(vector<string> *options, Error *error) {
- string psk = args_.LookupString(flimflam::kL2tpIpsecPskProperty, "");
+ string psk = args()->LookupString(flimflam::kL2tpIpsecPskProperty, "");
if (!psk.empty()) {
if (!file_util::CreateTemporaryFileInDir(
manager()->run_path(), &psk_file_) ||
@@ -266,9 +266,9 @@
void L2TPIPSecDriver::InitNSSOptions(vector<string> *options) {
string ca_cert =
- args_.LookupString(flimflam::kL2tpIpsecCaCertNssProperty, "");
+ args()->LookupString(flimflam::kL2tpIpsecCaCertNssProperty, "");
if (!ca_cert.empty()) {
- const string &vpnhost = args_.GetString(flimflam::kProviderHostProperty);
+ const string &vpnhost = args()->GetString(flimflam::kProviderHostProperty);
vector<char> id(vpnhost.begin(), vpnhost.end());
FilePath certfile = nss_->GetDERCertfile(ca_cert, id);
if (certfile.empty()) {
@@ -282,7 +282,7 @@
bool L2TPIPSecDriver::AppendValueOption(
const string &property, const string &option, vector<string> *options) {
- string value = args_.LookupString(property, "");
+ string value = args()->LookupString(property, "");
if (!value.empty()) {
options->push_back(option);
options->push_back(value);
@@ -295,7 +295,7 @@
const string &true_option,
const string &false_option,
vector<string> *options) {
- string value = args_.LookupString(property, "");
+ string value = args()->LookupString(property, "");
if (!value.empty()) {
options->push_back(value == "true" ? true_option : false_option);
return true;
@@ -316,13 +316,13 @@
void L2TPIPSecDriver::GetLogin(string *user, string *password) {
SLOG(VPN, 2) << __func__;
string user_property =
- args_.LookupString(flimflam::kL2tpIpsecUserProperty, "");
+ args()->LookupString(flimflam::kL2tpIpsecUserProperty, "");
if (user_property.empty()) {
LOG(ERROR) << "User not set.";
return;
}
string password_property =
- args_.LookupString(flimflam::kL2tpIpsecPasswordProperty, "");
+ args()->LookupString(flimflam::kL2tpIpsecPasswordProperty, "");
if (password_property.empty()) {
LOG(ERROR) << "Password not set.";
return;
diff --git a/l2tp_ipsec_driver.h b/l2tp_ipsec_driver.h
index b8d765e..e734999 100644
--- a/l2tp_ipsec_driver.h
+++ b/l2tp_ipsec_driver.h
@@ -13,7 +13,6 @@
#include "shill/glib.h"
#include "shill/ipconfig.h"
-#include "shill/key_value_store.h"
#include "shill/rpc_task.h"
#include "shill/service.h"
#include "shill/vpn_driver.h"
@@ -111,7 +110,6 @@
DeviceInfo *device_info_;
GLib *glib_;
NSS *nss_;
- KeyValueStore args_;
VPNServiceRefPtr service_;
scoped_ptr<RPCTask> rpc_task_;
diff --git a/l2tp_ipsec_driver_unittest.cc b/l2tp_ipsec_driver_unittest.cc
index a1ccb1b..02008d3 100644
--- a/l2tp_ipsec_driver_unittest.cc
+++ b/l2tp_ipsec_driver_unittest.cc
@@ -69,7 +69,7 @@
static const int kInterfaceIndex;
void SetArg(const string &arg, const string &value) {
- driver_->args_.SetString(arg, value);
+ driver_->args()->SetString(arg, value);
}
KeyValueStore *GetArgs() {