aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-05-03 16:43:30 +0200
committerMartin Willi <martin@revosec.ch>2011-05-16 15:24:14 +0200
commita1bf879a43cf701bc3c134cc839f88718f357393 (patch)
treef7377f60c24564b94f581f1fde2a55ff20ff915b /src
parentac96ca80eb8f7c2c41bf27b239963864791775b8 (diff)
downloadstrongswan-a1bf879a43cf701bc3c134cc839f88718f357393.tar.bz2
strongswan-a1bf879a43cf701bc3c134cc839f88718f357393.tar.xz
Added preshared_key/eap_password load_tester options to set custom credentials
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/load_tester/load_tester_creds.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/libcharon/plugins/load_tester/load_tester_creds.c b/src/libcharon/plugins/load_tester/load_tester_creds.c
index 0c0cfefd6..c34ea73c5 100644
--- a/src/libcharon/plugins/load_tester/load_tester_creds.c
+++ b/src/libcharon/plugins/load_tester/load_tester_creds.c
@@ -173,16 +173,14 @@ static char cert[] = {
/**
- * A preshared key
+ * Default IKE preshared key
*/
-static char psk[] = {
- 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08
-};
+static char *default_psk = "default-psk";
/**
- * Password for EAP
+ * Default EAP password for EAP
*/
-static char pwd[] = "test#123";
+static char *default_pwd = "default-pwd";
METHOD(credential_set_t, create_private_enumerator, enumerator_t*,
private_load_tester_creds_t *this, key_type_t type, identification_t *id)
@@ -303,9 +301,8 @@ METHOD(credential_set_t, create_shared_enumerator, enumerator_t*,
default:
return NULL;
}
- return enumerator_create_filter(
- enumerator_create_single(this->pwd, NULL),
- (void*)shared_filter, NULL, NULL);
+ return enumerator_create_filter(enumerator_create_single(shared, NULL),
+ (void*)shared_filter, NULL, NULL);
}
METHOD(load_tester_creds_t, destroy, void,
@@ -321,6 +318,12 @@ METHOD(load_tester_creds_t, destroy, void,
load_tester_creds_t *load_tester_creds_create()
{
private_load_tester_creds_t *this;
+ char *pwd, *psk;
+
+ psk = lib->settings->get_str(lib->settings,
+ "charon.plugins.load-tester.preshared_key", default_psk);
+ pwd = lib->settings->get_str(lib->settings,
+ "charon.plugins.load-tester.eap_password", default_pwd);
INIT(this,
.public = {
@@ -341,7 +344,7 @@ load_tester_creds_t *load_tester_creds_create()
BUILD_X509_FLAG, X509_CA,
BUILD_END),
.psk = shared_key_create(SHARED_IKE,
- chunk_clone(chunk_create(psk, sizeof(psk)))),
+ chunk_clone(chunk_create(psk, strlen(psk)))),
.pwd = shared_key_create(SHARED_EAP,
chunk_clone(chunk_create(pwd, strlen(pwd)))),
);