diff options
| author | Arne Schwabe <arne@rfc2549.org> | 2015-07-08 12:23:34 +0200 | 
|---|---|---|
| committer | Arne Schwabe <arne@rfc2549.org> | 2015-07-08 12:23:34 +0200 | 
| commit | 4f95e3584b717273cd7f108eb2ed54ebfe1c5b86 (patch) | |
| tree | 4dc1549d1f961db8678b6e3c2c590b359dfa9e71 | |
| parent | 4e6bfafca302d9a5bd47faecf47713771834e84a (diff) | |
Fix importing config files with extra-certs
| -rw-r--r-- | main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 2 | ||||
| -rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 14 | 
2 files changed, 12 insertions, 4 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index 058e8097..5afb1fe5 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -539,7 +539,7 @@ public class VpnProfile implements Serializable, Cloneable {      }      //! Put inline data inline and other data as normal escaped filename -    private String insertFileData(String cfgentry, String filedata) { +    public static String insertFileData(String cfgentry, String filedata) {          if (filedata == null) {              // TODO: generate good error              return String.format("%s %s\n", cfgentry, "missing"); diff --git a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java index 232c454b..0d7d54c0 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java +++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java @@ -838,13 +838,21 @@ public class ConfigParser {          return false;      } +    //! Generate options for custom options      private String getOptionStrings(Vector<Vector<String>> option) {          String custom = "";          for (Vector<String> optionsline : option) {              if (!ignoreThisOption(optionsline)) { -                for (String arg : optionsline) -                    custom += VpnProfile.openVpnEscape(arg) + " "; -                custom += "\n"; +                // Check if option had been inlined and inline again +                if (optionsline.size() == 2 && "extra-certs".equals(optionsline.get(0)) ) { +                    custom += VpnProfile.insertFileData(optionsline.get(0), optionsline.get(1)); + + +                } else { +                    for (String arg : optionsline) +                        custom += VpnProfile.openVpnEscape(arg) + " "; +                    custom += "\n"; +                }              }          }          return custom;  | 
