httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Best (safest) way to edit char string (from envvars)?
Date Wed, 20 Jun 2012 14:35:44 GMT

I am working on a module, and I get one of the SSL envvars, SSL_CLIENT_CERT, using apr_table_get()
into a const char *.

The client cert char string returned has the extra beginning line (-----BEGIN CERTIFICATE-----)
and ending line (-----END CERTIFICATE-----), but I need to remove both of those lines for
a call that I need to make.

I have to admit, I'm a bit (a lot) rusty with 'C', and I guess I could do something like:

strpy(original_cert, original_cert+27);

and then set the ending position to \0 (to terminate the char string early), but since with
this is a module, and I'm working with a pointer to the memory pool, I'm kind of worried that
doing stuff like that would mess things up (e.g., garbage collection, since the string is
now shorter by 'x' bytes.

So, from an Apache module development standpoint, what would be the safest way to do this
(strip a string of chars from the beginning and end)?


View raw message