- 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 ] );
-
- charray_free( attrs );
- charray_free( values );
-
- return retval;
-}
-
-
-/* rdn_attrs:
- *
- * Given a string (i.e. an rdn) of the form:
- * "attribute_type=attribute_value[+attribute_type=attribute_value[...]]"
- * this function stores the types of the attributes in ptypes, that is the
- * array of strings "attribute_type" which is placed in newly allocated
- * memory, and the values of the attributes in pvalues, that is the
- * array of strings "attribute_value" which is placed in newly allocated
- * memory. Returns 0 on success, -1 on failure.
- *
- * note: got part of the code from dn_validate
- *
- * Deprecated; directly use LDAPRDN from ldap_str2rdn
- */
-int
-rdn_attrs( const char * rdn, char ***types, char ***values)
-{
- LDAPRDN *tmpRDN;
- const char *p;
- int iAVA;
- int rc;
-
- assert( rdn );
- assert( values );
-
- rc = ldap_str2rdn( rdn, &tmpRDN, &p, LDAP_DN_FORMAT_LDAP );
- if ( rc != LDAP_SUCCESS ) {
- return rc;
- }
-
- for ( iAVA = 0; tmpRDN[ iAVA ]; iAVA++ ) {
- LDAPAVA *ava = tmpRDN[ iAVA ][ 0 ];
-
- assert( ava );
- assert( ava->la_attr );
- assert( ava->la_value );
-
- if ( types ) {
- charray_add_n( types, ava->la_attr->bv_val,
- ava->la_attr->bv_len );
- }
- charray_add_n( values, ava->la_value->bv_val,
- ava->la_value->bv_len );
- }
-
- ldap_rdnfree( tmpRDN );
-
- return LDAP_SUCCESS;