axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r399558 - in /webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl: ssl_stream.c ssl_utils.c
Date Thu, 04 May 2006 05:51:29 GMT
Author: sahan
Date: Wed May  3 22:51:29 2006
New Revision: 399558

URL: http://svn.apache.org/viewcvs?rev=399558&view=rev
Log:
Added error checking code for SSL transport

Modified:
    webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_stream.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_utils.c

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_stream.c?rev=399558&r1=399557&r2=399558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_stream.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_stream.c Wed May
 3 22:51:29 2006
@@ -133,10 +133,30 @@
 {
     ssl_stream_impl_t *stream_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+    int read = -1;
+    int len = -1;
     
     stream_impl = AXIS2_INTF_TO_IMPL(stream);
 
-    return SSL_read(stream_impl->ssl ,buffer,count);
+    read = SSL_read(stream_impl->ssl ,buffer,count);
+    switch(SSL_get_error(stream_impl->ssl ,read))
+    {
+        case SSL_ERROR_NONE:
+            len = read;
+            break;
+        case SSL_ERROR_ZERO_RETURN:
+            len = -1;
+            break;
+        case SSL_ERROR_SYSCALL:
+            AXIS2_LOG_ERROR((*env)->log, AXIS2_LOG_SI, 
+                        "SSL Error: Premature close");
+            len = -1;
+            break;
+        default:
+            len = -1;
+            break;
+     } 
+    return len;
 }
 
 int AXIS2_CALL
@@ -144,12 +164,23 @@
 						const void *buf, size_t count)
 {
 	ssl_stream_impl_t *stream_impl = NULL;
+    int write = -1;
 
     AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, buf, AXIS2_FAILURE);
     stream_impl = AXIS2_INTF_TO_IMPL(stream);
-    return SSL_write(stream_impl->ssl, buf, count);
+    write = SSL_write(stream_impl->ssl, buf, count);
 
+    switch(SSL_get_error(stream_impl->ssl , write))
+    {
+        case SSL_ERROR_NONE:
+            if(count != write)
+            AXIS2_LOG_ERROR((*env)->log, AXIS2_LOG_SI, "Incomplete SSL write!");
+            break;
+        default:
+            return -1;
+    }
+    return write;
 }
 
 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_utils.c?rev=399558&r1=399557&r2=399558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_utils.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/ssl/ssl_utils.c Wed May 
3 22:51:29 2006
@@ -90,6 +90,12 @@
         return NULL;
     }
     SSL_set_bio(ssl, sbio, sbio);
+    if(SSL_connect(ssl) <=0 )
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SSL_ENGINE, 
+                        AXIS2_FAILURE);
+        return NULL;
+    }
     return ssl;
 }
 



Mime
View raw message