You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Guenter Knauf <fu...@apache.org> on 2007/11/25 17:40:43 UTC

[PATCH] fix for const mismatch in 2.0.x ssl_scache_shmht.c

Hi all,
when I try to compile Apache 2.0.x mod_ssl with OpenSSL 0.9.8 then I get a const mismatch:
### mwccnlm Compiler:
#    File: ssl_scache_shmht.c
# ---------------------------
#     237:      sess = d2i_SSL_SESSION(NULL, &ucpData, nData);
#   Error:                                                  ^
#   illegal implicit conversion from 'unsigned char **' to
#   'const unsigned char **'

Errors caused tool to abort.

since this file is not present in 2.2.x branch and later the problem
doesnt happen there, and so I cant propose a backport here ...
here's the patch:

--- ssl_scache_shmht.c.orig	Wed Jul 12 09:40:56 2006
+++ ssl_scache_shmht.c	Sun Nov 25 17:01:26 2007
@@ -234,7 +234,8 @@
     }
 
     /* unstreamed SSL_SESSION */
-    sess = d2i_SSL_SESSION(NULL, &ucpData, nData);
+    sess = d2i_SSL_SESSION(NULL, 
+            (MODSSL_D2I_SSL_SESSION_CONST UCHAR **)&ucpData, nData);
 
     return sess;
 }

can I get some agreement to commit this patch?

I also thought of another patch changing ucpData as done in the other
ssl_scache_* files, however then another cast with memcpy() is needed;
therefore I tend more to the first patch:

--- ssl_scache_shmht.c.orig	Wed Jul 12 09:40:56 2006
+++ ssl_scache_shmht.c	Sun Nov 25 17:32:58 2007
@@ -198,7 +198,7 @@
     SSLModConfigRec *mc = myModConfig(s);
     void *vp;
     SSL_SESSION *sess = NULL;
-    UCHAR *ucpData;
+    MODSSL_D2I_SSL_SESSION_CONST UCHAR *ucpData;
     int nData;
     time_t expiry;
     time_t now;
@@ -223,7 +223,7 @@
         return NULL;
     }
     memcpy(&expiry, vp, sizeof(time_t));
-    memcpy(ucpData, (char *)vp+sizeof(time_t), nData);
+    memcpy((void *)ucpData, (char *)vp+sizeof(time_t), nData);
     ssl_mutex_off(s);
 
     /* make sure the stuff is still not expired */


thanks, Guenter.