summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jni/Android.mk2
-rw-r--r--jni/jbcrypto.cpp29
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java15
4 files changed, 38 insertions, 9 deletions
diff --git a/jni/Android.mk b/jni/Android.mk
index 761fa00..3de0705 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -25,7 +25,7 @@ include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_LDLIBS := -llog
LOCAL_SRC_FILES:= minivpn.c
-LOCAL_MODULE = minivp
+LOCAL_MODULE = minivpn
LOCAL_SHARED_LIBRARIES=openvpn
include $(BUILD_EXECUTABLE)
diff --git a/jni/jbcrypto.cpp b/jni/jbcrypto.cpp
index 0c56b97..8bc6fb8 100644
--- a/jni/jbcrypto.cpp
+++ b/jni/jbcrypto.cpp
@@ -12,11 +12,34 @@
#include <openssl/rsa.h>
#include <openssl/objects.h>
#include <openssl/md5.h>
+#include <android/log.h>
+#include <openssl/err.h>
+
extern "C" {
jbyteArray Java_de_blinkt_openvpn_OpenVpnManagementThread_rsasign(JNIEnv* env, jclass, jbyteArray from, jint pkeyRef);
}
+int jniThrowException(JNIEnv* env, const char* className, const char* msg) {
+
+ jclass exceptionClass = env->FindClass(className);
+
+ if (exceptionClass == NULL) {
+ __android_log_print(ANDROID_LOG_DEBUG,"openvpn","Unable to find exception class %s", className);
+ /* ClassNotFoundException now pending */
+ return -1;
+ }
+
+ if (env->ThrowNew( exceptionClass, msg) != JNI_OK) {
+ __android_log_print(ANDROID_LOG_DEBUG,"openvpn","Failed throwing '%s' '%s'", className, msg);
+ /* an exception, most likely OOM, will now be pending */
+ return -1;
+ }
+
+ env->DeleteLocalRef(exceptionClass);
+ return 0;
+}
+
jbyteArray Java_de_blinkt_openvpn_OpenVpnManagementThread_rsasign(JNIEnv* env, jclass, jbyteArray from, jint pkeyRef) {
@@ -32,9 +55,10 @@ jbyteArray Java_de_blinkt_openvpn_OpenVpnManagementThread_rsasign(JNIEnv* env, j
jbyte* data = env-> GetByteArrayElements (from, NULL);
int datalen = env-> GetArrayLength(from);
- if(data==NULL || datalen == )
+ if(data==NULL )
+ jniThrowException(env, "java/lang/NullPointerException", "data is null");
- unsigned int siglen;
+ unsigned int siglen;
unsigned char* sigret = (unsigned char*)malloc(RSA_size(pkey->pkey.rsa));
@@ -46,7 +70,6 @@ jbyteArray Java_de_blinkt_openvpn_OpenVpnManagementThread_rsasign(JNIEnv* env, j
sigret, &siglen, pkey->pkey.rsa) <= 0 )
{
- ERR_print_errors(errbio);
jniThrowException(env, "java/security/InvalidKeyException", "rsa_sign went wrong, see logcat");
ERR_print_errors_fp(stderr);
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6fa7815..b6d43e9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -233,6 +233,7 @@
<string name="obscure">Obscure OpenVPN Settings. Normally not needed.</string>
<string name="advanced">Advanced</string>
<string name="export_config_title">ICS Openvpn Config</string>
+ <string name="warn_no_dns">No DNS servers being used. Name resolution may not work. Consider setting custom DNS Servers</string>
</resources> \ No newline at end of file
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index c50196b..102e5d5 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -241,7 +241,8 @@ public class OpenVpnService extends VpnService implements StateListener {
for (String dns : mDnslist ) {
builder.addDnsServer(dns);
}
-
+
+
builder.setMtu(mMtu);
@@ -283,7 +284,11 @@ public class OpenVpnService extends VpnService implements StateListener {
OpenVPN.logBuilderConfig(bconfig);
-
+
+ // No DNS Server, log a warning
+ if(mDnslist.size()==0)
+ OpenVPN.logInfo(R.string.warn_no_dns);
+
// Reset information
mDnslist.clear();
mRoutes.clear();
@@ -393,10 +398,10 @@ public class OpenVpnService extends VpnService implements StateListener {
}
// Skip exiting status if the status is already hidden
- if("EXITING SIGINT".equals(state) && !mNotificationvisible) {
+ if(("EXITING SIGINT".equals(state) || "EXITING".equals(state))
+ && !mNotificationvisible) {
return;
- }
-
+ }
if("BYTECOUNT".equals(state)) {
if(mDisplayBytecount) {