Require the struct berval **out argument of dnPretty/dnNormalize

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).
This commit is contained in:
Kurt Zeilenga 2001-12-24 18:38:20 +00:00
parent d3d4bb9270
commit d047cc854e
4 changed files with 14 additions and 9 deletions

View 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;

View 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 ) {

View 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' ) {

View 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,