summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/ConfigParser.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-12-27 19:47:35 +0100
committerArne Schwabe <arne@rfc2549.org>2012-12-27 19:47:35 +0100
commitbbbefe26e6c160bca867dce3188b3679f0fcf2fc (patch)
tree8fd78a979459a78c9fad50043366e1d1d890dd68 /src/de/blinkt/openvpn/ConfigParser.java
parent501b58833bd95950e871e83ca21b34fd72991228 (diff)
Make changes needed to provide an external API
Diffstat (limited to 'src/de/blinkt/openvpn/ConfigParser.java')
-rw-r--r--src/de/blinkt/openvpn/ConfigParser.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java
index cdec964e..faf0dbd9 100644
--- a/src/de/blinkt/openvpn/ConfigParser.java
+++ b/src/de/blinkt/openvpn/ConfigParser.java
@@ -242,7 +242,7 @@ public class ConfigParser {
// This method is far too long
- VpnProfile convertProfile() throws ConfigParseError{
+ public VpnProfile convertProfile() throws ConfigParseError{
boolean noauthtypeset=true;
VpnProfile np = new VpnProfile("converted Profile");
// Pull, client, tls-client
@@ -461,7 +461,6 @@ public class ConfigParser {
Vector<String> authuser = getOption("auth-user-pass",0,1);
if(authuser !=null){
-
if(noauthtypeset) {
np.mAuthenticationType=VpnProfile.TYPE_USERPASS;
} else if(np.mAuthenticationType==VpnProfile.TYPE_CERTIFICATES) {
@@ -470,7 +469,10 @@ public class ConfigParser {
np.mAuthenticationType=VpnProfile.TYPE_USERPASS_KEYSTORE;
}
if(authuser.size()>1) {
- np.mUsername=authuser.get(1);
+ // Set option value to password get to get canche to embed later.
+ np.mUsername=null;
+ np.mPassword=authuser.get(1);
+ useEmbbedUserAuth(np,authuser.get(1));
}
}
@@ -483,6 +485,16 @@ public class ConfigParser {
return np;
}
+
+ static public void useEmbbedUserAuth(VpnProfile np,String inlinedata)
+ {
+ String data = inlinedata.replace(VpnProfile.INLINE_TAG, "");
+ String[] parts = data.split("\n");
+ if(parts.length >= 2) {
+ np.mUsername=parts[0];
+ np.mPassword=parts[1];
+ }
+ }
private void checkIgnoreAndInvalidOptions(VpnProfile np) throws ConfigParseError {
for(String option:unsupportedOptions)