Author: stsp Date: Thu Jun 19 11:59:44 2014 New Revision: 1603846 URL: http://svn.apache.org/r1603846 Log: On the svn-auth-x590 branch, tweak the name and declaration of the cert parsing function.
* subversion/libsvn_subr/x509.h, subversion/libsvn_subr/x509parse.c (x509parse_crt): Rename to... (svn_x509_parse_cert): ... this. Pass in APR pools and start using them. Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h?rev=1603846&r1=1603845&r2=1603846&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509.h Thu Jun 19 11:59:44 2014 @@ -174,17 +174,13 @@ typedef struct _x509_cert { extern "C" { #endif - /** - * \brief Parse one or more certificates and add them - * to the chained list - * - * \param chain points to the start of the chain - * \param buf buffer holding the certificate data - * \param buflen size of the buffer - * - * \return 0 if successful, or a specific X509 error code - */ - int x509parse_crt(x509_cert * chain, const unsigned char *buf, int buflen); + /* Parse x509 DER certificate data from BUF (with length BUFLEN), + * returning a structured representation in *CERT, allocated in RESULT_POOL. */ + int svn_x509_parse_cert(x509_cert **cert, + const unsigned char *buf, + int buflen, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); #ifdef __cplusplus } Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c?rev=1603846&r1=1603845&r2=1603846&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c Thu Jun 19 11:59:44 2014 @@ -44,6 +44,8 @@ * http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */ +#include <apr_pools.h> + #include "x509.h" #include <string.h> @@ -417,14 +419,19 @@ static int x509_get_uid(unsigned char ** /* * Parse one certificate. */ -static int _x509parse_crt_1(x509_cert * chain, unsigned char *buf, int buflen) +int +svn_x509_parse_cert(x509_cert **cert, + const unsigned char *buf, + int buflen, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool) { int ret, len; unsigned char *p; const unsigned char *end; x509_cert *crt; - crt = chain; + crt = apr_pcalloc(result_pool, sizeof(*crt)); /* * Copy the raw DER data.