From d2f5d75885a7c3a23cf846da6b4448f869a58a5b Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 16 Jan 2002 00:16:51 +0000 Subject: [PATCH] Remove unused deprecated DN routines. Only dn_validate, dn_normalize, and dn_parent remain (for now). --- servers/slapd/back-bdb/init.c | 4 +- servers/slapd/backend.c | 2 +- servers/slapd/controls.c | 4 +- servers/slapd/dn.c | 118 ---------------------------------- servers/slapd/proto-slap.h | 16 ++--- 5 files changed, 12 insertions(+), 132 deletions(-) diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index 48b2ebac55..3e3956d747 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -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) ); diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 530410362c..e01ccc6dae 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -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; } } diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 0ac52e7884..f0338dc974 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -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", diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index a392485128..c90dffaf6d 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -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: * diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index fb8c2aae43..1cce9b2575 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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 /* -- 2.39.5