summaryrefslogtreecommitdiff
path: root/src/de/blinkt
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/blinkt')
-rw-r--r--src/de/blinkt/openvpn/ConfigConverter.java5
-rw-r--r--src/de/blinkt/openvpn/FileSelect.java3
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java23
-rw-r--r--src/de/blinkt/openvpn/core/OpenVpnManagementThread.java2
-rw-r--r--src/de/blinkt/openvpn/fragments/AboutFragment.java21
5 files changed, 33 insertions, 21 deletions
diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java
index 22109f81..75620455 100644
--- a/src/de/blinkt/openvpn/ConfigConverter.java
+++ b/src/de/blinkt/openvpn/ConfigConverter.java
@@ -35,7 +35,7 @@ public class ConfigConverter extends ListActivity {
public static final String IMPORT_PROFILE = "de.blinkt.openvpn.IMPORT_PROFILE";
- private VpnProfile mResult;
+ private VpnProfile mResult;
private ArrayAdapter<String> mArrayAdapter;
private List<String> mPathsegments;
@@ -306,7 +306,8 @@ public class ConfigConverter extends ListActivity {
InputStream input = new FileInputStream(file);
long len= file.length();
-
+ if (len > VpnProfile.MAX_EMBED_FILE_SIZE)
+ throw new IOException("File size of file to import too large.");
// Create the byte array to hold the data
byte[] bytes = new byte[(int) len];
diff --git a/src/de/blinkt/openvpn/FileSelect.java b/src/de/blinkt/openvpn/FileSelect.java
index 88a9abdd..8389a2ab 100644
--- a/src/de/blinkt/openvpn/FileSelect.java
+++ b/src/de/blinkt/openvpn/FileSelect.java
@@ -155,7 +155,8 @@ public class FileSelect extends Activity {
InputStream input = new FileInputStream(file);
long len= file.length();
-
+ if (len > VpnProfile.MAX_EMBED_FILE_SIZE)
+ throw new IOException("selected file size too big to embed into profile");
// Create the byte array to hold the data
byte[] bytes = new byte[(int) len];
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index 3a2f2bbf..ed19cd17 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -44,6 +44,19 @@ public class VpnProfile implements Serializable {
// The Serializable documentation mentions that class name change are possible
// but the how is unclear
//
+ transient static final long MAX_EMBED_FILE_SIZE = 2048*1024; // 2048kB
+ // Don't change this, not all parts of the program use this constant
+ public static final String EXTRA_PROFILEUUID = "de.blinkt.openvpn.profileUUID";
+ public static final String INLINE_TAG = "[[INLINE]]";
+ public static final String MINIVPN = "miniopenvpn";
+ private static final long serialVersionUID = 7085688938959334563L;
+ private static final String OVPNCONFIGFILE = "android.conf";
+ public static String DEFAULT_DNS1 = "8.8.8.8";
+ public static String DEFAULT_DNS2 = "8.8.4.4";
+
+ public transient String mTransientPW = null;
+ public transient String mTransientPCKS12PW = null;
+
public static final int TYPE_CERTIFICATES = 0;
public static final int TYPE_PKCS12 = 1;
@@ -58,16 +71,6 @@ public class VpnProfile implements Serializable {
public static final int X509_VERIFY_TLSREMOTE_DN = 2;
public static final int X509_VERIFY_TLSREMOTE_RDN = 3;
public static final int X509_VERIFY_TLSREMOTE_RDN_PREFIX = 4;
- // Don't change this, not all parts of the program use this constant
- public static final String EXTRA_PROFILEUUID = "de.blinkt.openvpn.profileUUID";
- public static final String INLINE_TAG = "[[INLINE]]";
- public static final String MINIVPN = "miniopenvpn";
- private static final long serialVersionUID = 7085688938959334563L;
- private static final String OVPNCONFIGFILE = "android.conf";
- public static String DEFAULT_DNS1 = "8.8.8.8";
- public static String DEFAULT_DNS2 = "8.8.4.4";
- public transient String mTransientPW = null;
- public transient String mTransientPCKS12PW = null;
// variable named wrong and should haven beeen transient
// but needs to keep wrong name to guarante loading of old
// profiles
diff --git a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index 9497f18b..4fe54217 100644
--- a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -93,7 +93,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
}
public void managmentCommand(String cmd) {
- if(mSocket!=null) {
+ if(mSocket!=null && mSocket.getOutputStream() !=null) {
try {
mSocket.getOutputStream().write(cmd.getBytes());
mSocket.getOutputStream().flush();
diff --git a/src/de/blinkt/openvpn/fragments/AboutFragment.java b/src/de/blinkt/openvpn/fragments/AboutFragment.java
index ce57afda..c4f27ee1 100644
--- a/src/de/blinkt/openvpn/fragments/AboutFragment.java
+++ b/src/de/blinkt/openvpn/fragments/AboutFragment.java
@@ -111,13 +111,15 @@ public class AboutFragment extends Fragment implements View.OnClickListener {
final ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- createPlayBuyOptions(ownedSkus, responseList);
-
- }
- });
+ if (getActivity() != null) {
+ getActivity().runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ createPlayBuyOptions(ownedSkus, responseList);
+
+ }
+ });
+ }
} catch (RemoteException e) {
e.printStackTrace();
@@ -274,6 +276,11 @@ public class AboutFragment extends Fragment implements View.OnClickListener {
}
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ if (mService!=null)
+ initGooglePlayDonation();
+ }
@Override
public void onClick(View v) {