Enlightenment CVS committal

Author  : englebass
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_con


Modified Files:
        Ecore_Con.h ecore_con.c ecore_con_private.h 


Log Message:
Support SSLv3

===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/Ecore_Con.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- Ecore_Con.h 30 Nov 2007 08:10:37 -0000      1.32
+++ Ecore_Con.h 8 Jan 2008 21:06:43 -0000       1.33
@@ -74,8 +74,10 @@
        ECORE_CON_LOCAL_SYSTEM,
        ECORE_CON_LOCAL_ABSTRACT,
        ECORE_CON_REMOTE_SYSTEM,
-       ECORE_CON_USE_SSL = 16
+       ECORE_CON_USE_SSL2 = (1 << 4),
+       ECORE_CON_USE_SSL3 = (1 << 5)
      } Ecore_Con_Type;
+#define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2
 
    typedef enum _Ecore_Con_Url_Time
      {
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -3 -r1.88 -r1.89
--- ecore_con.c 30 Nov 2007 08:21:37 -0000      1.88
+++ ecore_con.c 8 Jan 2008 21:06:43 -0000       1.89
@@ -167,7 +167,7 @@
    type = compl_type;
 #if USE_OPENSSL
    /* unset the SSL flag for the following checks */
-   type &= ~ECORE_CON_USE_SSL;
+   type &= ECORE_CON_TYPE;
 #endif
 
    if ((type == ECORE_CON_LOCAL_USER) || (type == ECORE_CON_LOCAL_SYSTEM) ||
@@ -315,7 +315,7 @@
      }
 
 #if USE_OPENSSL
-   if (compl_type & ECORE_CON_USE_SSL)
+   if (compl_type & ECORE_CON_SSL)
      {
        if (!ssl_init_count)
          {
@@ -324,9 +324,17 @@
          }
        ssl_init_count++;
 
-       /* SSLv3 gives *weird* results on my box, don't use it yet */
-       if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
-         goto error;
+       switch (compl_type & ECORE_CON_SSL)
+         {
+          case ECORE_CON_USE_SSL2:
+             if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
+               goto error;
+             break;
+          case ECORE_CON_USE_SSL3:
+             if (!(svr->ssl_ctx = SSL_CTX_new(SSLv3_client_method())))
+               goto error;
+             break;
+         }
 
        if (!(svr->ssl = SSL_new(svr->ssl_ctx)))
          goto error;
@@ -411,7 +419,7 @@
    type = compl_type;
 #if USE_OPENSSL
    /* unset the SSL flag for the following checks */
-   type &= ~ECORE_CON_USE_SSL;
+   type &= ECORE_CON_TYPE;
 #endif
    if ((type == ECORE_CON_REMOTE_SYSTEM) && (port < 0)) return NULL;
 
@@ -1165,7 +1173,7 @@
    svr->ip = strdup(buf);
 
 #if USE_OPENSSL
-   if (svr->type & ECORE_CON_USE_SSL)
+   if (svr->type & ECORE_CON_SSL)
      {
        if (!ssl_init_count)
          {
@@ -1174,9 +1182,17 @@
          }
        ssl_init_count++;
 
-       /* SSLv3 gives *weird* results on my box, don't use it yet */
-       if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
-         goto error;
+       switch (svr->type & ECORE_CON_SSL)
+         {
+          case ECORE_CON_USE_SSL2:
+             if (!(svr->ssl_ctx = SSL_CTX_new(SSLv2_client_method())))
+               goto error;
+             break;
+          case ECORE_CON_USE_SSL3:
+             if (!(svr->ssl_ctx = SSL_CTX_new(SSLv3_client_method())))
+               goto error;
+             break;
+         }
 
        if (!(svr->ssl = SSL_new(svr->ssl_ctx)))
          goto error;
@@ -1306,6 +1322,19 @@
                    {
                       ssl_err = SSL_get_error(svr->ssl, num);
                       lost_server = (ssl_err == SSL_ERROR_ZERO_RETURN);
+                      if (ssl_err == SSL_ERROR_SYSCALL)
+                        {
+                           if (num == 0) lost_server = 1;
+                           else
+                             {
+                                lost_server = ((errno == EIO) ||
+                                               (errno == EBADF) ||
+                                               (errno == EPIPE) ||
+                                               (errno == EINVAL) ||
+                                               (errno == ENOSPC) ||
+                                               (errno == ECONNRESET));
+                             }
+                        }
                    }
                  else
                    ssl_err = SSL_ERROR_NONE;
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con_private.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -3 -r1.20 -r1.21
--- ecore_con_private.h 26 Sep 2007 17:18:52 -0000      1.20
+++ ecore_con_private.h 8 Jan 2008 21:06:43 -0000       1.21
@@ -8,6 +8,9 @@
 #define ECORE_MAGIC_CON_CLIENT             0x77556677
 #define ECORE_MAGIC_CON_URL                0x77074255
 
+#define ECORE_CON_TYPE 0x0f
+#define ECORE_CON_SSL  0xf0
+
 #if USE_OPENSSL
 #include <openssl/ssl.h>
 #endif



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to