tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r391288 - /tomcat/connectors/trunk/jni/native/src/sslnetwork.c
Date Tue, 04 Apr 2006 12:32:18 GMT
Author: mturk
Date: Tue Apr  4 05:32:16 2006
New Revision: 391288

URL: http://svn.apache.org/viewcvs?rev=391288&view=rev
Log:
Fix ssl code by properly registering the socket
shutdown modes.

Modified:
    tomcat/connectors/trunk/jni/native/src/sslnetwork.c

Modified: tomcat/connectors/trunk/jni/native/src/sslnetwork.c
URL: http://svn.apache.org/viewcvs/tomcat/connectors/trunk/jni/native/src/sslnetwork.c?rev=391288&r1=391287&r2=391288&view=diff
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/sslnetwork.c (original)
+++ tomcat/connectors/trunk/jni/native/src/sslnetwork.c Tue Apr  4 05:32:16 2006
@@ -289,19 +289,22 @@
             int i = SSL_get_error(con->ssl, s);
             switch (i) {
                 case SSL_ERROR_NONE:
+                    con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
                     return APR_SUCCESS;
                 break;
                 case SSL_ERROR_WANT_READ:
                 case SSL_ERROR_WANT_WRITE:
                     if ((rv = wait_for_io_or_timeout(con, i)) != APR_SUCCESS) {
+                        con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                         return rv;
                     }
                 break;
                 case SSL_ERROR_SYSCALL:
+                case SSL_ERROR_SSL:
                     s = apr_get_netos_error();
                     if (!APR_STATUS_IS_EAGAIN(s) &&
                         !APR_STATUS_IS_EINTR(s)) {
-                        con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
+                        con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                         return s;
                     }
                 break;
@@ -309,7 +312,7 @@
                     /*
                     * Anything else is a fatal error
                     */
-                    con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
+                    con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                     return SSL_TO_APR_ERROR(i);
                 break;
             }
@@ -319,7 +322,7 @@
         */
         if (SSL_get_verify_result(con->ssl) != X509_V_OK) {
             /* TODO: Log SSL client authentication failed */
-            con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
+            con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
             /* TODO: Figure out the correct return value */
             return APR_EGENERAL;
         }
@@ -355,28 +358,33 @@
             switch (i) {
                 case SSL_ERROR_ZERO_RETURN:
                     *len = 0;
+                    con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
                     return APR_EOF;
                 break;
                 case SSL_ERROR_WANT_READ:
                 case SSL_ERROR_WANT_WRITE:
                     if ((rv = wait_for_io_or_timeout(con, i)) != APR_SUCCESS) {
+                        con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                         return rv;
                     }
                 break;
                 case SSL_ERROR_SYSCALL:
+                case SSL_ERROR_SSL:
                     if (!APR_STATUS_IS_EAGAIN(os) &&
                         !APR_STATUS_IS_EINTR(os)) {
-                        con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
+                        con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                         return os;
                     }
                 break;
                 default:
+                    con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                     return os;
                 break;
             }
         }
         else {
             *len = s;
+            con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
             break;
         }
     }
@@ -388,16 +396,17 @@
                 apr_size_t *len)
 {
     tcn_ssl_conn_t *con = (tcn_ssl_conn_t *)sock;
-    int s, rd = (int)(*len);
+    int s, wr = (int)(*len);
     apr_status_t rv = APR_SUCCESS;
 
     for (;;) {
-        if ((s = SSL_write(con->ssl, buf, rd)) <= 0) {
+        if ((s = SSL_write(con->ssl, buf, wr)) <= 0) {
             apr_status_t os = apr_get_netos_error();
             int i = SSL_get_error(con->ssl, s);
             switch (i) {
                 case SSL_ERROR_ZERO_RETURN:
                     *len = 0;
+                        con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
                     return APR_EOF;
                 break;
                 case SSL_ERROR_WANT_READ:
@@ -407,13 +416,15 @@
                     }
                 break;
                 case SSL_ERROR_SYSCALL:
+                case SSL_ERROR_SSL:
                     if (!APR_STATUS_IS_EAGAIN(os) &&
                         !APR_STATUS_IS_EINTR(os)) {
-                        con->shutdown_type = SSL_SHUTDOWN_TYPE_STANDARD;
+                        con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                         return os;
                     }
                 break;
                 default:
+                    con->shutdown_type = SSL_SHUTDOWN_TYPE_UNCLEAN;
                     return os;
                 break;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message