domainComponents (DC)).
#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 */
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 */
}
/*
- * 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,...
*/
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,...
*/
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;
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 );
}
return( parts );
}
-
-
-int
-ldap_is_dns_dn( LDAP_CONST char *dn )
-{
- return dn[ 0 ] != '\0' && ldap_utf8_strpbrk( dn, "=,;" ) == NULL;
-}
-
{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},
#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
* (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;
/* Skip leading spaces */
while ( *s && ASCII_SPACE(*s) ) {
-
s++;
-
}
/* Copy word */
char * rdn_attr_type( const char * s )
{
-
return get_next_substring( s, '=' );
-
}
const char *str;
if ( (str = strchr( rdn, '=' )) != NULL ) {
-
return get_next_substring(++str, '\0');
-
}
return NULL;
{
if ( p_dn == NULL ) {
-
*new_dn = ch_strdup( newrdn );
return;
-
}
*new_dn = (char *) ch_malloc( strlen( p_dn ) + strlen( newrdn ) + 3 );