mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
Remove unused deprecated DN routines.
Only dn_validate, dn_normalize, and dn_parent remain (for now).
This commit is contained in:
parent
e154da3a09
commit
d2f5d75885
@ -66,8 +66,8 @@ bdb_db_init( BackendDB *be )
|
||||
|
||||
/* indicate system schema supported */
|
||||
be->be_flags |= SLAP_BFLAG_ALIASES
|
||||
| SLAP_BFLAG_REFERRALS
|
||||
| SLAP_BFLAG_SUBENTRIES;
|
||||
| SLAP_BFLAG_REFERRALS
|
||||
| SLAP_BFLAG_SUBENTRIES;
|
||||
|
||||
/* allocate backend-database-specific stuff */
|
||||
bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
|
||||
|
@ -748,7 +748,7 @@ backend_check_controls(
|
||||
if( (*ctrls)->ldctl_iscritical &&
|
||||
!charray_inlist( be->be_controls, (*ctrls)->ldctl_oid ) )
|
||||
{
|
||||
*text = "control unavailable in NamingContext";
|
||||
*text = "control unavailable in context";
|
||||
return LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ int get_ctrls(
|
||||
if( tag == LBER_ERROR ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
|
||||
"get_ctrls: conn %d get OID failed.\n",
|
||||
"get_ctrls: conn %d get OID failed.\n",
|
||||
conn->c_connid ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get oid failed.\n",
|
||||
@ -198,7 +198,7 @@ int get_ctrls(
|
||||
if( tag == LBER_ERROR ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
|
||||
"get_ctrls: conn %d get crit failed.\n",
|
||||
"get_ctrls: conn %d get crit failed.\n",
|
||||
conn->c_connid ));
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get crit failed.\n",
|
||||
|
@ -768,124 +768,6 @@ dn_rdnlen(
|
||||
return p - dn_in->bv_val;
|
||||
}
|
||||
|
||||
/* 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 = NULL, **values = NULL, *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 **values = NULL, *retval;
|
||||
|
||||
if ( rdn_attrs( rdn, NULL, &values ) != LDAP_SUCCESS ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
retval = ch_strdup( values[ 0 ] );
|
||||
|
||||
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 );
|
||||
assert( *values == NULL );
|
||||
assert( types == NULL || *types == NULL );
|
||||
|
||||
rc = ldap_str2rdn( rdn, &tmpRDN, (char **)&p, LDAP_DN_FORMAT_LDAP );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* FIXME: should we complain if the rdn is actually a dn?
|
||||
*/
|
||||
if ( p[ 0 ] != '\0' ) {
|
||||
ldap_rdnfree( tmpRDN );
|
||||
return LDAP_INVALID_DN_SYNTAX;
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( iAVA = 0; tmpRDN[ 0 ][ iAVA ]; iAVA++ ) {
|
||||
LDAPAVA *ava = tmpRDN[ 0 ][ iAVA ];
|
||||
|
||||
assert( ava );
|
||||
assert( ava->la_attr.bv_val );
|
||||
assert( ava->la_value.bv_val );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* rdnValidate:
|
||||
*
|
||||
|
@ -395,21 +395,19 @@ LDAP_SLAPD_F (int) dnExtractRdn LDAP_P((
|
||||
|
||||
LDAP_SLAPD_F (int) rdnValidate LDAP_P(( struct berval * rdn ));
|
||||
|
||||
LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, struct berval *dn ));
|
||||
|
||||
LDAP_SLAPD_F (void) build_new_dn LDAP_P((
|
||||
struct berval * new_dn,
|
||||
struct berval * parent_dn,
|
||||
struct berval * newrdn ));
|
||||
|
||||
#define SLAP_DN_MIGRATION
|
||||
#ifdef SLAP_DN_MIGRATION
|
||||
/* These routines are deprecated!!! */
|
||||
LDAP_SLAPD_F (char *) dn_validate LDAP_P(( char *dn ));
|
||||
LDAP_SLAPD_F (char *) dn_normalize LDAP_P(( char *dn ));
|
||||
LDAP_SLAPD_F (char *) dn_parent LDAP_P(( Backend *be, const char *dn ));
|
||||
LDAP_SLAPD_F (int) dn_rdnlen LDAP_P(( Backend *be, struct berval *dn ));
|
||||
LDAP_SLAPD_F (char *) rdn_attr_value LDAP_P(( const char * rdn ));
|
||||
LDAP_SLAPD_F (char *) rdn_attr_type LDAP_P(( const char * rdn ));
|
||||
LDAP_SLAPD_F (int) rdn_attrs LDAP_P(( const char * rdn,
|
||||
char ***ptypes, char ***pvals ));
|
||||
|
||||
LDAP_SLAPD_F (void) build_new_dn LDAP_P(( struct berval * new_dn,
|
||||
struct berval * parent_dn,
|
||||
struct berval * newrdn ));
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user