]> git.sur5r.net Git - openldap/commitdiff
treat bervals as bervals (related to ITS#6378,ITS#6379)
authorPierangelo Masarati <ando@openldap.org>
Sun, 15 Nov 2009 18:26:53 +0000 (18:26 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 15 Nov 2009 18:26:53 +0000 (18:26 +0000)
include/lutil.h
servers/slapd/schema_init.c

index cda43ebb23f6814efdf9f35274f022ba3bf131b6..fa05e2866d2b387de50b6a6ec6043b9557b9e400 100644 (file)
@@ -194,6 +194,8 @@ lutil_strncopy LDAP_P(( char *dst, const char *src, size_t n ));
 LDAP_LUTIL_F( char* )
 lutil_memcopy LDAP_P(( char *dst, const char *src, size_t n ));
 
+#define lutil_strbvcopy(a, bv) lutil_memcopy((a),(bv)->bv_val,(bv)->bv_len)
+
 struct tm;
 
 /* use this macro to statically allocate buffer for lutil_gentime */
index 55fc2fa8888127464fae42dd5fbb0a67cff5ff17..0e473744e554f6f6ffb257beeb9508a3ea6f64a0 100644 (file)
@@ -2265,8 +2265,7 @@ postalAddressNormalize(
 
        p = normalized->bv_val;
        for ( l = 0; !BER_BVISNULL( &nlines[l] ); l++ ) {
-               p = lutil_memcopy( p, nlines[l].bv_val, nlines[l].bv_len );
-
+               p = lutil_strbvcopy( p, &nlines[l] );
                *p++ = '$';
        }
        *--p = '\0';
@@ -3329,9 +3328,9 @@ serialNumberAndIssuerPretty(
 
        p = out->bv_val;
        p = lutil_strcopy( p, "{ serialNumber " /*}*/ );
-       p = lutil_strncopy( p, sn.bv_val, sn.bv_len );
+       p = lutil_strbvcopy( p, &sn );
        p = lutil_strcopy( p, ", issuer rdnSequence:\"" );
-       p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
+       p = lutil_strbvcopy( p, &ni );
        p = lutil_strcopy( p, /*{*/ "\" }" );
 
        assert( p == &out->bv_val[out->bv_len] );
@@ -3491,9 +3490,9 @@ serialNumberAndIssuerNormalize(
        p = out->bv_val;
 
        p = lutil_strcopy( p, "{ serialNumber " /*}*/ );
-       p = lutil_strncopy( p, sn3.bv_val, sn3.bv_len );
+       p = lutil_strbvcopy( p, &sn3 );
        p = lutil_strcopy( p, ", issuer rdnSequence:\"" );
-       p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
+       p = lutil_strbvcopy( p, &ni );
        p = lutil_strcopy( p, /*{*/ "\" }" );
 
        assert( p == &out->bv_val[out->bv_len] );
@@ -3588,9 +3587,9 @@ certificateExactNormalize(
        p = normalized->bv_val;
 
        p = lutil_strcopy( p, "{ serialNumber " /*}*/ );
-       p = lutil_strncopy( p, sn2.bv_val, sn2.bv_len );
+       p = lutil_strbvcopy( p, &sn2 );
        p = lutil_strcopy( p, ", issuer rdnSequence:\"" );
-       p = lutil_strncopy( p, issuer_dn.bv_val, issuer_dn.bv_len );
+       p = lutil_strbvcopy( p, &issuer_dn );
        p = lutil_strcopy( p, /*{*/ "\" }" );
 
        rc = LDAP_SUCCESS;
@@ -3920,9 +3919,9 @@ issuerAndThisUpdatePretty(
 
        p = out->bv_val;
        p = lutil_strcopy( p, "{ issuer rdnSequence:\"" /*}*/ );
-       p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
+       p = lutil_strbvcopy( p, &ni );
        p = lutil_strcopy( p, "\", thisUpdate \"" );
-       p = lutil_strncopy( p, tu.bv_val, tu.bv_len );
+       p = lutil_strbvcopy( p, &tu );
        p = lutil_strcopy( p, /*{*/ "\" }" );
 
        assert( p == &out->bv_val[out->bv_len] );
@@ -3986,9 +3985,9 @@ issuerAndThisUpdateNormalize(
        p = out->bv_val;
 
        p = lutil_strcopy( p, "{ issuer rdnSequence:\"" /*}*/ );
-       p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
+       p = lutil_strbvcopy( p, &ni );
        p = lutil_strcopy( p, "\", thisUpdate \"" );
-       p = lutil_strncopy( p, tu2.bv_val, tu2.bv_len );
+       p = lutil_strbvcopy( p, &tu2 );
        p = lutil_strcopy( p, /*{*/ "\" }" );
 
        assert( p == &out->bv_val[out->bv_len] );
@@ -4081,9 +4080,9 @@ certificateListExactNormalize(
        p = normalized->bv_val;
 
        p = lutil_strcopy( p, "{ issuer rdnSequence:\"" );
-       p = lutil_strncopy( p, issuer_dn.bv_val, issuer_dn.bv_len );
+       p = lutil_strbvcopy( p, &issuer_dn );
        p = lutil_strcopy( p, "\", thisUpdate \"" );
-       p = lutil_strncopy( p, thisUpdate.bv_val, thisUpdate.bv_len );
+       p = lutil_strbvcopy( p, &thisUpdate );
        p = lutil_strcopy( p, /*{*/ "\" }" );
 
        rc = LDAP_SUCCESS;
@@ -4516,11 +4515,11 @@ serialNumberAndIssuerSerialPretty(
 
        p = out->bv_val;
        p = lutil_strcopy( p, "{ serialNumber " );
-       p = lutil_strncopy( p, sn.bv_val, sn.bv_len );
+       p = lutil_strbvcopy( p, &sn );
        p = lutil_strcopy( p, ", issuer { baseCertificateID { issuer { directoryName:rdnSequence:\"" );
-       p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
+       p = lutil_strbvcopy( p, &ni );
        p = lutil_strcopy( p, "\" }, serial " );
-       p = lutil_strncopy( p, i_sn.bv_val, i_sn.bv_len );
+       p = lutil_strbvcopy( p, &i_sn );
        p = lutil_strcopy( p, " } } }" );
 
        assert( p == &out->bv_val[out->bv_len] );
@@ -4630,11 +4629,11 @@ serialNumberAndIssuerSerialNormalize(
        p = out->bv_val;
 
        p = lutil_strcopy( p, "{ serialNumber " );
-       p = lutil_strncopy( p, sn3.bv_val, sn3.bv_len );
+       p = lutil_strbvcopy( p, &sn3 );
        p = lutil_strcopy( p, ", issuer { baseCertificateID { issuer { directoryName:rdnSequence:\"" );
-       p = lutil_strncopy( p, ni.bv_val, ni.bv_len );
+       p = lutil_strbvcopy( p, &ni );
        p = lutil_strcopy( p, "\" }, serial " );
-       p = lutil_strncopy( p, i_sn3.bv_val, i_sn3.bv_len );
+       p = lutil_strbvcopy( p, &i_sn3 );
        p = lutil_strcopy( p, " } } }" );
 
        assert( p == &out->bv_val[out->bv_len] );
@@ -4763,11 +4762,11 @@ attributeCertificateExactNormalize(
        p = normalized->bv_val;
 
        p = lutil_strcopy( p, "{ serialNumber " );
-       p = lutil_strncopy( p, sn2.bv_val, sn2.bv_len );
+       p = lutil_strbvcopy( p, &sn2 );
        p = lutil_strcopy( p, ", issuer { baseCertificateID { issuer { directoryName:rdnSequence:\"" );
-       p = lutil_strncopy( p, issuer_dn.bv_val, issuer_dn.bv_len );
+       p = lutil_strbvcopy( p, &issuer_dn );
        p = lutil_strcopy( p, "\" }, serial " );
-       p = lutil_strncopy( p, i_sn2.bv_val, i_sn2.bv_len );
+       p = lutil_strbvcopy( p, &i_sn2 );
        p = lutil_strcopy( p, " } } }" );
 
        Debug( LDAP_DEBUG_TRACE, "attributeCertificateExactNormalize: %s\n",
@@ -5108,7 +5107,7 @@ csnNormalize21(
        ptr = lutil_strncopy( ptr, &gt.bv_val[ STRLENOF( "YYYYmmddHH:MM:" ) ],
                STRLENOF( "SS" ) );
        ptr = lutil_strcopy( ptr, ".000000Z#00" );
-       ptr = lutil_strncopy( ptr, cnt.bv_val, cnt.bv_len );
+       ptr = lutil_strbvcopy( ptr, &cnt );
        *ptr++ = '#';
        *ptr++ = '0';
        *ptr++ = '0';
@@ -5201,7 +5200,7 @@ csnNormalize23(
        ptr = bv.bv_val;
        ptr = lutil_strncopy( ptr, gt.bv_val, gt.bv_len - 1 );
        ptr = lutil_strcopy( ptr, ".000000Z#" );
-       ptr = lutil_strncopy( ptr, cnt.bv_val, cnt.bv_len );
+       ptr = lutil_strbvcopy( ptr, &cnt );
        *ptr++ = '#';
        *ptr++ = '0';
        for ( i = 0; i < sid.bv_len; i++ ) {
@@ -5556,7 +5555,7 @@ generalizedTimeValidate(
        return check_time_syntax(in, 0, parts, &fraction);
 }
 
-static int
+int
 generalizedTimeNormalize(
        slap_mask_t usage,
        Syntax *syntax,