diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-07-02 21:40:41 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-07-02 21:40:41 +0200 |
commit | d18dfef96c176e0d48160daa610b8664dba81c68 (patch) | |
tree | bc91372fb24b625c556213499f2ffb20ee2947f4 /src/de/blinkt/openvpn/ConfigConverter.java | |
parent | d88496f07bab09728572643d15cf86c7c7606bbc (diff) |
Import User and Password from auth-user-file if it exists. (closes #issue 42)
Diffstat (limited to 'src/de/blinkt/openvpn/ConfigConverter.java')
-rw-r--r-- | src/de/blinkt/openvpn/ConfigConverter.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java index 3ccda053..71a17fa2 100644 --- a/src/de/blinkt/openvpn/ConfigConverter.java +++ b/src/de/blinkt/openvpn/ConfigConverter.java @@ -123,7 +123,8 @@ public class ConfigConverter extends ListActivity { continue;
// read the file inline
- String filedata = VpnProfile.INLINE_TAG;
+
+ String filedata = "";
byte[] buf =new byte[2048];
log(R.string.trying_to_read, possibleFile.getAbsolutePath());
@@ -153,10 +154,22 @@ public class ConfigConverter extends ListActivity { // This where I would like to have a c++ style
// void embedFile(std::string & option)
- mResult.mCaFilename = embedFile(mResult.mCaFilename);
- mResult.mClientCertFilename = embedFile(mResult.mClientCertFilename);
- mResult.mClientKeyFilename = embedFile(mResult.mClientKeyFilename);
- mResult.mTLSAuthFilename = embedFile(mResult.mTLSAuthFilename);
+ mResult.mCaFilename = VpnProfile.INLINE_TAG + embedFile(mResult.mCaFilename);
+ mResult.mClientCertFilename = VpnProfile.INLINE_TAG + embedFile(mResult.mClientCertFilename);
+ mResult.mClientKeyFilename = VpnProfile.INLINE_TAG + embedFile(mResult.mClientKeyFilename);
+ mResult.mTLSAuthFilename = VpnProfile.INLINE_TAG + embedFile(mResult.mTLSAuthFilename);
+
+ if(mResult.mUsername != null){
+ String data =embedFile(mResult.mName);
+ mResult.mName=null;
+ if(data!=null) {
+ String[] parts = data.split("\n");
+ if(parts.length >= 2) {
+ mResult.mName=parts[0];
+ mResult.mPassword=parts[1];
+ }
+ }
+ }
}
|