Skip to content
Snippets Groups Projects
Commit 1aa4b07c authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Remove support for DNS DNs (not to be confused with X.500 DN using

domainComponents (DC)).
parent c1117666
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
......
......@@ -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,...
*/
......
......@@ -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;
}
......@@ -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},
......
......@@ -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
......
......@@ -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;
......
......@@ -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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment