You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2005/07/08 01:51:04 UTC

[Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Attached is a backport of rev 209530, which demanded a little
bit of rework to make it functional.

This resolves build issues which caused errors in 0.9.7f and
prior on Win32 and build failures on Netware.  This patch
correctly chooses the appropriate const-ness for 0.9.6, 0.9.7,
or 0.9.8 OpenSSL.  It needs to be verified on Netware since
my Win32 builds completely clean.

Votes please?  It's trivial and I don't want it to linger.

Bill

Re: [Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 10:00 AM 7/8/2005, Joe Orton wrote:
>> Comments/Votes?  2.0.x patch attached; 2.1 committed.
>
>+1 for 2.0.x if the below is changed to use (unsigned char *) rather 
>than (UCHAR *) in the cast too.  Thanks for fixing this!

I will switch these to (unsigned char *)... from (UCHAR *)

but need Netware Metrowerks compiler feedback, please!



Re: [Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Posted by Joe Orton <jo...@redhat.com>.
On Fri, Jul 08, 2005 at 09:53:44AM -0500, William Rowe wrote:
> 
> >At 01:48 AM 7/8/2005, Joe Orton wrote:
> >>On Thu, Jul 07, 2005 at 06:51:04PM -0500, William Rowe wrote:
> >>> 
> >>> This resolves build issues which caused errors in 0.9.7f and
> >>> prior on Win32 and build failures on Netware.  This patch
> >>> correctly chooses the appropriate const-ness for 0.9.6, 0.9.7,
> >>> or 0.9.8 OpenSSL.  It needs to be verified on Netware since
> >>> my Win32 builds completely clean.
> >>
> >>-1, this is barely readable, using a #define as previously or a typedef 
> >>in ssl_toolkit_compat.h is much cleaner.
> 
> Ok, attached is a const-flag based solution buried back into
> ssl_toolkit_compat.h, that I believe is the most readable.
> 
> Comments/Votes?  2.0.x patch attached; 2.1 committed.

+1 for 2.0.x if the below is changed to use (unsigned char *) rather 
than (UCHAR *) in the cast too.  Thanks for fixing this!

> --- ssl_scache_dbm.c	(revision 209795)
> +++ ssl_scache_dbm.c	(working copy)
> @@ -193,7 +193,7 @@
>      apr_datum_t dbmkey;
>      apr_datum_t dbmval;
>      SSL_SESSION *sess = NULL;
> -    UCHAR *ucpData;
> +    MODSSL_D2I_SSL_SESSION_CONST unsigned char *ucpData;
>      int nData;
>      time_t expiry;
>      time_t now;
> @@ -234,13 +234,14 @@
>  
>      /* parse resulting data */
>      nData = dbmval.dsize-sizeof(time_t);
> -    ucpData = (UCHAR *)malloc(nData);
> +    ucpData = malloc(nData);
>      if (ucpData == NULL) {
>          apr_dbm_close(dbm);
>          ssl_mutex_off(s);
>          return NULL;
>      }
> -    memcpy(ucpData, (char *)dbmval.dptr+sizeof(time_t), nData);
> +    /* Cast needed, ucpData may be const */
> +    memcpy((UCHAR *)ucpData, (char *)dbmval.dptr+sizeof(time_t), nData);
>      memcpy(&expiry, dbmval.dptr, sizeof(time_t));
>  
>      apr_dbm_close(dbm);



Re: [Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
>At 01:48 AM 7/8/2005, Joe Orton wrote:
>>On Thu, Jul 07, 2005 at 06:51:04PM -0500, William Rowe wrote:
>>> 
>>> This resolves build issues which caused errors in 0.9.7f and
>>> prior on Win32 and build failures on Netware.  This patch
>>> correctly chooses the appropriate const-ness for 0.9.6, 0.9.7,
>>> or 0.9.8 OpenSSL.  It needs to be verified on Netware since
>>> my Win32 builds completely clean.
>>
>>-1, this is barely readable, using a #define as previously or a typedef 
>>in ssl_toolkit_compat.h is much cleaner.

Ok, attached is a const-flag based solution buried back into
ssl_toolkit_compat.h, that I believe is the most readable.

Comments/Votes?  2.0.x patch attached; 2.1 committed.

Bill

Re: [Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Posted by Joe Orton <jo...@redhat.com>.
On Fri, Jul 08, 2005 at 09:17:29AM -0500, William Rowe wrote:
> At 01:48 AM 7/8/2005, Joe Orton wrote:
> >On Thu, Jul 07, 2005 at 06:51:04PM -0500, William Rowe wrote:
> >> 
> >> This resolves build issues which caused errors in 0.9.7f and
> >> prior on Win32 and build failures on Netware.  This patch
> >> correctly chooses the appropriate const-ness for 0.9.6, 0.9.7,
> >> or 0.9.8 OpenSSL.  It needs to be verified on Netware since
> >> my Win32 builds completely clean.
> >
> >-1, this is barely readable, using a #define as previously or a typedef 
> >in ssl_toolkit_compat.h is much cleaner.
> 
> Then we need three of them, but do we want to simplify this with
> the appropriate version tests to...

Ah sorry, I hadn't realized that *more* of these things had changed in 
0.9.8 than just those in 0.9.7g.  But this:

> #define MODSSL_CONST_D2I_SSL_SESSION   const
> #define MODSSL_CONST_D2I_X509          const
> #define MODSSL_CONST_D2I_PrivateKey    const

is I think is the lesser-of-all-evils, +1.  A typedef is tempting but 
like you say, obscuring the unqualified type probably would be bad.  
Still, yowch, eh?

> And simply use that as a modifier, so the reader can follow
> that the type is an unsigned char * in the main code, without
> going back to ssl_toolkit_compat.h?  Or us a full type, which
> is less legible (requires the reader to know that D2I datum
> are unsigned char *)?



> Bill
> 

Re: [Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 01:48 AM 7/8/2005, Joe Orton wrote:
>On Thu, Jul 07, 2005 at 06:51:04PM -0500, William Rowe wrote:
>> 
>> This resolves build issues which caused errors in 0.9.7f and
>> prior on Win32 and build failures on Netware.  This patch
>> correctly chooses the appropriate const-ness for 0.9.6, 0.9.7,
>> or 0.9.8 OpenSSL.  It needs to be verified on Netware since
>> my Win32 builds completely clean.
>
>-1, this is barely readable, using a #define as previously or a typedef 
>in ssl_toolkit_compat.h is much cleaner.

Then we need three of them, but do we want to simplify this with
the appropriate version tests to...

#define MODSSL_CONST_D2I_SSL_SESSION   const
#define MODSSL_CONST_D2I_X509          const
#define MODSSL_CONST_D2I_PrivateKey    const

And simply use that as a modifier, so the reader can follow
that the type is an unsigned char * in the main code, without
going back to ssl_toolkit_compat.h?  Or us a full type, which
is less legible (requires the reader to know that D2I datum
are unsigned char *)?

Bill



Re: [Patch 2.0] d2i_SSL_SESSION args for 0.9.7f-/0.9.7g/0.9.8

Posted by Joe Orton <jo...@redhat.com>.
On Thu, Jul 07, 2005 at 06:51:04PM -0500, William Rowe wrote:
> Attached is a backport of rev 209530, which demanded a little
> bit of rework to make it functional.
> 
> This resolves build issues which caused errors in 0.9.7f and
> prior on Win32 and build failures on Netware.  This patch
> correctly chooses the appropriate const-ness for 0.9.6, 0.9.7,
> or 0.9.8 OpenSSL.  It needs to be verified on Netware since
> my Win32 builds completely clean.

-1, this is barely readable, using a #define as previously or a typedef 
in ssl_toolkit_compat.h is much cleaner.

joe