]> git.sur5r.net Git - openldap/commitdiff
Require the struct berval **out argument of dnPretty/dnNormalize
authorKurt Zeilenga <kurt@openldap.org>
Mon, 24 Dec 2001 18:38:20 +0000 (18:38 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 24 Dec 2001 18:38:20 +0000 (18:38 +0000)
point to a NULL pointer, that is assert( *out == NULL ).
Eventually, we'll allow **out to point to a preallocated
struct berval (to avoid unnecessary allocation).

servers/slapd/aclparse.c
servers/slapd/add.c
servers/slapd/dn.c
servers/slapd/entry.c

index 5c061745aeab61ea30aa085ac2d23a5fbc42dbac..f54bb8a933be6a8b0be2d6c0d30e3e3fb9f7f298 100644 (file)
@@ -232,7 +232,7 @@ parse_acl(
                        if( a->acl_dn_pat.bv_len != 0 ) {
                                if ( a->acl_dn_style != ACL_STYLE_REGEX )
                                {
-                                       struct berval *bv;
+                                       struct berval *bv = NULL;
                                        dnNormalize( NULL, &a->acl_dn_pat, &bv);
                                        free( a->acl_dn_pat.bv_val );
                                        a->acl_dn_pat = *bv;
index 2050fecd34f0bfb53d6b39d3f800d421aa454acb..3127b8664b4ddf97e7bdf7dfa552abde552cfbac 100644 (file)
@@ -87,7 +87,7 @@ do_add( Connection *conn, Operation *op )
        e->e_private = NULL;
 
        {
-               struct berval *pdn;
+               struct berval *pdn = NULL;
                rc = dnPretty( NULL, &dn, &pdn );
 
                if( rc != LDAP_SUCCESS ) {
@@ -108,7 +108,7 @@ do_add( Connection *conn, Operation *op )
        }
 
        {
-               struct berval *ndn;
+               struct berval *ndn = NULL;
                rc = dnNormalize( NULL, &dn, &ndn );
 
                if( rc != LDAP_SUCCESS ) {
index ed81bf5a14592b31329d699b70772ab8983009c1..38ecca3af38ce367eda11344b337473cb34c7fb9 100644 (file)
@@ -311,6 +311,8 @@ dnNormalize(
        assert( val );
        assert( normalized );
 
+       assert( *normalized == NULL );
+
        if ( val->bv_len != 0 ) {
                LDAPDN          *dn = NULL;
                char            *dn_out = NULL;
@@ -371,6 +373,7 @@ dnPretty(
 
        assert( val );
        assert( pretty );
+       assert( *pretty == NULL );
 
        if ( val->bv_len != 0 ) {
                LDAPDN          *dn = NULL;
@@ -477,7 +480,8 @@ dnMatch(
 char *
 dn_validate( char *dn )
 {
-       struct berval val, *pretty;
+       struct berval val;
+       struct berval *pretty = NULL;
        int             rc;
 
        if ( dn == NULL || dn[0] == '\0' ) {
@@ -512,7 +516,8 @@ dn_validate( char *dn )
 char *
 dn_normalize( char *dn )
 {
-       struct berval   val, *normalized;
+       struct berval val;
+       struct berval *normalized = NULL;
        int             rc;
 
        if ( dn == NULL || dn[0] == '\0' ) {
index a0acd7a33f8a2d63d8fae94ce6f9e5e8ee22498a..af1eb92f4e8930b248544e7646c9ad86a319f64c 100644 (file)
@@ -117,7 +117,7 @@ str2entry( char *s )
                }
 
                if ( strcasecmp( type, "dn" ) == 0 ) {
-                       struct berval *pdn;
+                       struct berval *pdn = NULL;
 
                        free( type );
 
@@ -156,7 +156,8 @@ str2entry( char *s )
                                return NULL;
                        }
 
-                       e->e_name.bv_val = pdn->bv_val != NULL ? pdn->bv_val : ch_strdup( "" );
+                       e->e_name.bv_val = pdn->bv_val != NULL
+                               ? pdn->bv_val : ch_strdup( "" );
                        e->e_name.bv_len = pdn->bv_len;
                        free( pdn );
                        continue;
@@ -290,10 +291,9 @@ str2entry( char *s )
 
        /* generate normalized dn */
        {
-               struct berval *ndn;
+               struct berval *ndn = NULL;
 
                rc = dnNormalize( NULL, &e->e_name, &ndn );
-
                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_INFO,