- bv.bv_val = (char *) dn_in;
- bv.bv_len = strlen( bv.bv_val );
-
- if ( dnExtractRdn( &bv, &rdn ) != LDAP_SUCCESS ) {
- ber_bvfree( rdn );
- return 0;
- }
-
- retval = rdn->bv_len;
- ber_bvfree( rdn );
-
- return retval;
-}
-
-/*
- * FIXME: should be replaced by dnExtractRdn() (together with dn_rdnlen)
- */
-char * dn_rdn(
- Backend *be,
- const char *dn_in )
-{
- struct berval bv;
- struct berval *rdn = NULL;
- char *retval;
-
- assert( dn_in );
-
- if ( dn_in == NULL ) {
- return NULL;
- }
-
- while ( dn_in[ 0 ] && ASCII_SPACE( dn_in[ 0 ] ) ) {
- dn_in++;
- }
-
- if ( dn_in[ 0 ] == '\0' ) {
- return NULL;
- }
-
- if ( be != NULL && be_issuffix( be, dn_in ) ) {
- return NULL;
- }
-
- bv.bv_val = (char *) dn_in;
- bv.bv_len = strlen( bv.bv_val );
-
- if ( dnExtractRdn( &bv, &rdn ) != LDAP_SUCCESS ) {
- ber_bvfree( rdn );
- return NULL;
- }
-
- retval = rdn->bv_val;
- free( rdn );
-
- return retval;
-}
-
-/*
- * dn_issuffix - tells whether suffix is a suffix of dn.
- * Both dn and suffix must be normalized.
- * deprecated in favor of dnIsSuffix()
- */
-int
-dn_issuffix(
- const char *dn,
- const char *suffix
-)
-{
- struct berval bvdn, bvsuffix;
-
- assert( dn );
- assert( suffix );
-
- bvdn.bv_val = (char *) dn;
- bvdn.bv_len = strlen( dn );
- bvsuffix.bv_val = (char *) suffix;
- bvsuffix.bv_len = strlen( suffix );
-
- return dnIsSuffix( &bvdn, &bvsuffix );
-}
-
-/* rdn_attr_type:
- *
- * Given a string (i.e. an rdn) of the form:
- * "attribute_type = attribute_value"
- * this function returns the type of an attribute, that is the
- * string "attribute_type" which is placed in newly allocated
- * memory. The returned string will be null-terminated.
- *
- * Deprecated
- */
-
-char * rdn_attr_type( const char * s )
-{
- char **attrs, **values, *retval;
-
- if ( rdn_attrs( s, &attrs, &values ) != LDAP_SUCCESS ) {
- return NULL;
- }
-
- retval = ch_strdup( attrs[ 0 ] );
-
- charray_free( attrs );
- charray_free( values );
-
- return retval;
-}
-
-
-/* rdn_attr_value:
- *
- * Given a string (i.e. an rdn) of the form:
- * "attribute_type = attribute_value"
- * this function returns "attribute_type" which is placed in newly allocated
- * memory. The returned string will be null-terminated and may contain
- * spaces (i.e. "John Doe\0").
- *
- * Deprecated
- */
-
-char *
-rdn_attr_value( const char * rdn )
-{
- char **attrs, **values, *retval;
-
- if ( rdn_attrs( rdn, &attrs, &values ) != LDAP_SUCCESS ) {
- return NULL;
- }
-
- retval = ch_strdup( values[ 0 ] );