From: Julio Sánchez Fernández Date: Tue, 23 Oct 2001 09:05:04 +0000 (+0000) Subject: Normalization and more error checking. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~942 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=de353ebedae56a3eb9161f715eefc7b315a1142d;p=openldap Normalization and more error checking. --- diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 7de9a78895..4b6b52335a 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -3556,7 +3556,26 @@ certificateExactConvert( } serial = asn1_integer2str(xcert->cert_info->serialNumber); + if ( !serial ) { + X509_free(xcert); + return LDAP_INVALID_SYNTAX; + } issuer_dn = dn_openssl2ldap(X509_get_issuer_name(xcert)); + if ( !issuer_dn ) { + X509_free(xcert); + ber_bvfree(serial); + return LDAP_INVALID_SYNTAX; + } + /* Actually, dn_openssl2ldap returns in a normalized format, but + it is different from our normalized format */ + bv_tmp = issuer_dn; + if ( dnNormalize(NULL, bv_tmp, &issuer_dn) != LDAP_SUCCESS ) { + X509_free(xcert); + ber_bvfree(serial); + ber_bvfree(bv_tmp); + return LDAP_INVALID_SYNTAX; + } + ber_bvfree(bv_tmp); X509_free(xcert); @@ -3630,7 +3649,7 @@ serial_and_issuer_parse( q = ch_malloc( (end-begin+1)+1 ); AC_MEMCPY( q, begin, end-begin+1 ); q[end-begin+1] = '\0'; - *issuer_dn = ber_bvstr(q); + *issuer_dn = ber_bvstr(dn_normalize(q)); return LDAP_SUCCESS; }