*/
if ( rc == LDAP_SUCCESS ) {
rc = LDAPDN_validate( dn );
+ ldap_dnfree( dn );
}
- ldap_dnfree( dn );
-
if ( rc != LDAP_SUCCESS ) {
return( LDAP_INVALID_SYNTAX );
}
if ( val->bv_len != 0 ) {
LDAPDN *dn = NULL;
- char *dn_out = NULL;
int rc;
/*
/*
* Back to string representation
*/
- rc = ldap_dn2str( dn, &dn_out, LDAP_DN_FORMAT_LDAPV3 );
+ out = ch_malloc( sizeof(struct berval));
+
+ rc = ldap_dn2bv( dn, out, LDAP_DN_FORMAT_LDAPV3 );
ldap_dnfree( dn );
if ( rc != LDAP_SUCCESS ) {
+ free( out );
return LDAP_INVALID_SYNTAX;
}
-
- out = ber_bvstr( dn_out );
-
} else {
out = ber_bvdup( val );
}
if ( val->bv_len != 0 ) {
LDAPDN *dn = NULL;
- char *dn_out = NULL;
int rc;
/* FIXME: should be liberal in what we accept */
/* RE: the default is the form that is used as
* an internal representation; the pretty form
* is a variant */
- rc = ldap_dn2str( dn, &dn_out,
+
+ out = ch_malloc( sizeof(struct berval));
+
+ rc = ldap_dn2bv( dn, out,
LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
ldap_dnfree( dn );
if ( rc != LDAP_SUCCESS ) {
+ free( out );
return LDAP_INVALID_SYNTAX;
}
-
- out = ber_bvstr( dn_out );
-
} else {
out = ber_bvdup( val );
}
if ( val->bv_len != 0 ) {
LDAPDN *dn = NULL;
- char *dn_out = NULL;
int rc;
pretty->bv_val = NULL;
return LDAP_INVALID_SYNTAX;
}
- rc = ldap_dn2str( dn, &dn_out,
+ rc = ldap_dn2bv( dn, pretty,
LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
}
- ber_str2bv( dn_out, 0, 0, pretty );
-
if ( LDAPDN_rewrite( dn, 0 ) != LDAP_SUCCESS ) {
ldap_dnfree( dn );
free( pretty->bv_val );
return LDAP_INVALID_SYNTAX;
}
- rc = ldap_dn2str( dn, &dn_out, LDAP_DN_FORMAT_LDAPV3 );
+ rc = ldap_dn2bv( dn, normal, LDAP_DN_FORMAT_LDAPV3 );
ldap_dnfree( dn );
if ( rc != LDAP_SUCCESS ) {
pretty->bv_len = 0;
return LDAP_INVALID_SYNTAX;
}
-
- ber_str2bv( dn_out, 0, 0, normal );
} else {
ber_dupbv( pretty, val );
ber_dupbv( normal, val );
int
dnExtractRdn(
struct berval *dn,
- struct berval **rdn )
+ struct berval *rdn )
{
LDAPRDN *tmpRDN;
const char *p;
- char *rdnout;
int rc;
assert( dn );
return rc;
}
- rc = ldap_rdn2str( tmpRDN, &rdnout, LDAP_DN_FORMAT_LDAPV3 );
+ rc = ldap_rdn2bv( tmpRDN, rdn, LDAP_DN_FORMAT_LDAPV3 );
ldap_rdnfree( tmpRDN );
if ( rc != LDAP_SUCCESS ) {
return rc;
}
- *rdn = ber_bvstr( rdnout );
- if ( *rdn == NULL ) {
- free( rdnout );
- return LDAP_NO_MEMORY;
- }
-
return LDAP_SUCCESS;
}
Backend *be,
struct berval *dn_in )
{
- struct berval *rdn = NULL;
- int retval = 0;
+ struct berval rdn;
assert( dn_in );
return 0;
}
- retval = rdn->bv_len;
- ber_bvfree( rdn );
+ free( rdn.bv_val );
- return retval;
+ return rdn.bv_len;
}
/*
Backend *be,
struct berval *dn_in )
{
- struct berval *rdn = NULL;
- char *retval;
+ struct berval rdn;
assert( dn_in );
return NULL;
}
- retval = rdn->bv_val;
- free( rdn );
-
- return retval;
+ return rdn.bv_val;
}
/*