Don't call doProtocol from TLS funcs in java when detached.
@@ -459,6 +459,13 @@ Java_sun_nio_ch_SocketChannelImpl_write(JNIEnv *jni, jobject obj, jobject buf)
JNIEXPORT jobject JNICALL
Java_sun_security_ssl_SSLEngineImpl_unwrap(JNIEnv *jni, jobject obj, jobject src, jobjectArray dsts, jint offset, jint len)
{
+ if (g_cfg.funcs_attached == FALSE) {
+ //call the original method
+ jobject res = (*jni)->CallObjectMethod(jni, obj, g_java.mid_SSLEngineImpl___unwrap, src, dsts, offset, len);
+ clearJniException(jni);
+ return res;
+ }
+
jboolean preexisting_exception = (*jni)->ExceptionCheck(jni);
int fd = -1;
@@ -535,6 +542,13 @@ Java_com_sun_net_ssl_internal_ssl_SSLEngineImpl_unwrap(JNIEnv *jni, jobject obj,
JNIEXPORT jobject JNICALL
Java_sun_security_ssl_SSLEngineImpl_wrap(JNIEnv *jni, jobject obj, jobjectArray srcs, jint offset, jint len, jobject dst)
{
+ if (g_cfg.funcs_attached == FALSE) {
+ //call the original method
+ jobject res = (*jni)->CallObjectMethod(jni, obj, g_java.mid_SSLEngineImpl___wrap, srcs, offset, len, dst);
+ clearJniException(jni);
+ return res;
+ }
+
jboolean preexisting_exception = (*jni)->ExceptionCheck(jni);
int fd = -1;
@@ -605,6 +619,13 @@ Java_com_sun_net_ssl_internal_ssl_SSLEngineImpl_wrap(JNIEnv *jni, jobject obj, j
JNIEXPORT void JNICALL
Java_sun_security_ssl_AppOutputStream_write(JNIEnv *jni, jobject obj, jbyteArray buf, jint offset, jint len)
{
+ if (g_cfg.funcs_attached == FALSE) {
+ //call the original method
+ (*jni)->CallVoidMethod(jni, obj, g_java.mid_AppOutputStream___write, buf, offset, len);
+ clearJniException(jni);
+ return;
+ }
+
jboolean preexisting_exception = (*jni)->ExceptionCheck(jni);
int fd = -1;
@@ -648,6 +669,13 @@ Java_com_sun_net_ssl_internal_ssl_AppOutputStream_write(JNIEnv *jni, jobject obj
JNIEXPORT jint JNICALL
Java_sun_security_ssl_AppInputStream_read(JNIEnv *jni, jobject obj, jbyteArray buf, jint offset, jint len)
{
+ if (g_cfg.funcs_attached == FALSE) {
+ //call the original method
+ jint res = (*jni)->CallIntMethod(jni, obj, g_java.mid_AppInputStream___read, buf, offset, len);
+ clearJniException(jni);
+ return res;
+ }
+
jboolean preexisting_exception = (*jni)->ExceptionCheck(jni);
int fd = -1;
