From 1aa4b07c98f79d875c511d812b7f822f8edc8a4f Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Mon, 5 Jun 2000 20:07:02 +0000 Subject: [PATCH] Remove support for DNS DNs (not to be confused with X.500 DN using domainComponents (DC)). --- include/ldap.h | 10 ------ libraries/libldap/dn.c | 39 ++--------------------- libraries/libldap/getdn.c | 61 ------------------------------------ libraries/libldap/init.c | 1 - libraries/libldap/ldap-int.h | 1 - libraries/libldap/options.c | 4 --- servers/slapd/dn.c | 8 ----- 7 files changed, 2 insertions(+), 122 deletions(-) diff --git a/include/ldap.h b/include/ldap.h index c8094a04ec..09595d9034 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -105,8 +105,6 @@ LDAP_BEGIN_DECL #define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000 /* to 0x7FFF inclusive */ /* private and experimental options */ -#define LDAP_OPT_DNS 0x4001 /* use DN & DNS */ - /* OpenLDAP specific options */ #define LDAP_OPT_DEBUG_LEVEL 0x5001 /* debug level */ #define LDAP_OPT_TIMEOUT 0x5002 /* default timeout */ @@ -1158,14 +1156,6 @@ LIBLDAP_F( char * ) ldap_normalize_dn LDAP_P(( LDAP_CONST char *dn )); -LIBLDAP_F( char ** ) -ldap_explode_dns LDAP_P(( /* deprecated */ - LDAP_CONST char *dn )); - -LIBLDAP_F( int ) -ldap_is_dns_dn LDAP_P(( /* deprecated */ - LDAP_CONST char *dn )); - LIBLDAP_F( char * ) ldap_dn2dcedn LDAP_P(( LDAP_CONST char *dn )); /* deprecated */ diff --git a/libraries/libldap/dn.c b/libraries/libldap/dn.c index b658bed769..d0ba92f886 100644 --- a/libraries/libldap/dn.c +++ b/libraries/libldap/dn.c @@ -217,25 +217,7 @@ ldap_dn_parent( } /* - * no =, assume it is a dns name, like blah@some.domain.name - * if the blah@ part is there, return some.domain.name. if - * it's just some.domain.name, return domain.name. - */ - if ( strchr( dn, '=' ) == NULL ) { - if ( (s = strchr( dn, '@' )) == NULL ) { - if ( (s = strchr( dn, '.' )) == NULL ) { - return( NULL ); - } - } - if ( *(s + 1) == '\0' ) { - return( NULL ); - } else { - return( LDAP_STRDUP( &s[1] ) ); - } - } - - /* - * else assume it is an X.500-style name, which looks like + * assume it is an X.500-style name, which looks like * foo=bar,sha=baz,... */ @@ -288,25 +270,8 @@ char * ldap_dn_rdn( return NULL; } -#ifdef DNS_DN - /* - * no =, assume it is a dns name, like blah@some.domain.name - * if the blah@ part is there, return some.domain.name. if - * it's just some.domain.name, return domain.name. - */ - if ( strchr( rdn, '=' ) == NULL ) { - if ( (s = strchr( rdn, '@' )) == NULL ) { - if ( (s = strchr( rdn, '.' )) == NULL ) { - return( rdn ); - } - } - *s = '\0'; - return( rdn ); - } -#endif - /* - * else assume it is an X.500-style name, which looks like + * assume it is an X.500-style name, which looks like * foo=bar,sha=baz,... */ diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 7c3895ede7..20f1882cf5 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -63,12 +63,6 @@ ldap_dn2ufn( LDAP_CONST char *dn ) return NULL; } - if ( ldap_is_dns_dn( dn ) || - ( p = ldap_utf8_strpbrk( dn, "=" ) ) == NULL ) - { - return( LDAP_STRDUP( dn ) ); - } - ufn = LDAP_STRDUP( ++p ); if( ufn == NULL ) return NULL; @@ -141,58 +135,11 @@ ldap_dn2ufn( LDAP_CONST char *dn ) return( ufn ); } -char ** -ldap_explode_dns( LDAP_CONST char *dn_in ) -{ - char *s; - char **rdns; - char *tok_r; - char *dn; - - int ncomps; - int maxcomps = 8; - - if ( (dn = LDAP_STRDUP( dn_in )) == NULL ) { - return( NULL ); - } - - if ( (rdns = (char **) LDAP_MALLOC( maxcomps * sizeof(char *) )) == NULL ) { - LDAP_FREE( dn ); - return( NULL ); - } - - ncomps = 0; - for ( s = ldap_pvt_strtok( dn, "@.", &tok_r ); s != NULL; - s = ldap_pvt_strtok( NULL, "@.", &tok_r ) ) - { - if ( ncomps == maxcomps ) { - maxcomps *= 2; - if ( (rdns = (char **) LDAP_REALLOC( rdns, maxcomps * - sizeof(char *) )) == NULL ) - { - LDAP_FREE( dn ); - return NULL; - } - } - rdns[ncomps++] = LDAP_STRDUP( s ); - } - LDAP_FREE(dn); - - rdns[ncomps] = NULL; - - /* trim rdns */ - rdns = (char **) LDAP_REALLOC( rdns, (ncomps+1) * sizeof(char*) ); - return( rdns ); -} - char ** ldap_explode_dn( LDAP_CONST char *dn, int notypes ) { Debug( LDAP_DEBUG_TRACE, "ldap_explode_dn\n", 0, 0, 0 ); - if ( ldap_is_dns_dn( dn ) ) { - return( ldap_explode_dns( dn ) ); - } return explode_name( dn, notypes, NAME_TYPE_LDAP_DN ); } @@ -415,11 +362,3 @@ explode_name( const char *name, int notypes, int is_type ) return( parts ); } - - -int -ldap_is_dns_dn( LDAP_CONST char *dn ) -{ - return dn[ 0 ] != '\0' && ldap_utf8_strpbrk( dn, "=,;" ) == NULL; -} - diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 1a5d1ef7b9..a9afa385c5 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -70,7 +70,6 @@ static const struct ol_attribute { {0, ATTR_URIS, "URI", NULL, 0}, {0, ATTR_BOOL, "REFERRALS", NULL, LDAP_BOOL_REFERRALS}, {0, ATTR_BOOL, "RESTART", NULL, LDAP_BOOL_RESTART}, - {0, ATTR_BOOL, "DNS", NULL, LDAP_BOOL_DNS}, {0, ATTR_TLS, "TLS", NULL, LDAP_OPT_X_TLS}, {0, ATTR_TLS, "TLS_CERT", NULL, LDAP_OPT_X_TLS_CERTFILE}, {0, ATTR_TLS, "TLS_KEY", NULL, LDAP_OPT_X_TLS_KEYFILE}, diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index acb912cf52..09fc5cd2b1 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -55,7 +55,6 @@ LDAP_BEGIN_DECL #define LDAP_BOOL_REFERRALS 0 #define LDAP_BOOL_RESTART 1 -#define LDAP_BOOL_DNS 2 #define LDAP_BOOL_TLS 3 #define LDAP_BOOLEANS unsigned long diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index a892207d8c..acea330be9 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -188,10 +188,6 @@ ldap_get_option( * (int *) outvalue = (int) LDAP_BOOL_GET(lo, LDAP_BOOL_RESTART); return LDAP_OPT_SUCCESS; - case LDAP_OPT_DNS: /* LDAPv2 */ - * (int *) outvalue = (int) LDAP_BOOL_GET(lo, LDAP_BOOL_DNS); - return LDAP_OPT_SUCCESS; - case LDAP_OPT_PROTOCOL_VERSION: * (int *) outvalue = lo->ldo_version; return LDAP_OPT_SUCCESS; diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 39dc192bbd..dd3a8ef76d 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -388,9 +388,7 @@ get_next_substring( const char * s, char d ) /* Skip leading spaces */ while ( *s && ASCII_SPACE(*s) ) { - s++; - } /* Copy word */ @@ -423,9 +421,7 @@ get_next_substring( const char * s, char d ) char * rdn_attr_type( const char * s ) { - return get_next_substring( s, '=' ); - } @@ -445,9 +441,7 @@ rdn_attr_value( const char * rdn ) const char *str; if ( (str = strchr( rdn, '=' )) != NULL ) { - return get_next_substring(++str, '\0'); - } return NULL; @@ -478,10 +472,8 @@ build_new_dn( char ** new_dn, { if ( p_dn == NULL ) { - *new_dn = ch_strdup( newrdn ); return; - } *new_dn = (char *) ch_malloc( strlen( p_dn ) + strlen( newrdn ) + 3 ); -- 2.39.5