*/
/* see if asker is listed in dnattr */
string_expand(buf, sizeof(buf), b->a_group_pat, edn, matches);
- if ( dn_normalize_case(buf) == NULL ) {
+ if ( dn_normalize(buf) == NULL ) {
/* did not expand to a valid dn */
continue;
}
grpdn = (char *)ch_malloc(1024);
if (grpoc != NULL && grpat != NULL && grpdn != NULL) {
string_expand(grpdn, 1024, subjdn, edn, matches);
- if ( dn_normalize_case(grpdn) != NULL ) {
+ if ( dn_normalize(grpdn) != NULL ) {
rc = (backend_group(be, e, grpdn, op->o_ndn, grpoc, grpat) == 0);
}
ch_free(grpdn);
if (subjdn == NULL)
return(0);
rc = 0;
- if (dn_normalize_case(subjdn) != NULL)
+ if ( dn_normalize(subjdn) != NULL )
rc = (strcasecmp(op->o_ndn, subjdn) == 0);
ch_free(subjdn);
return(rc);
ndn = ch_strdup( dn );
- if ( dn_normalize_case( ndn ) == NULL ) {
+ if ( dn_normalize( ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn, 0, 0 );
send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
e.e_dn = (char *) dn;
e.e_ndn = ch_strdup( dn );
- (void) dn_normalize_case( e.e_ndn );
+ (void) dn_normalize( e.e_ndn );
try_again:
/* set cache mutex */
0, 0, 0 );
np_ndn = ch_strdup( np_dn );
- (void) dn_normalize_case( np_ndn );
+ (void) dn_normalize( np_ndn );
/* newSuperior == oldParent?, if so ==> ERROR */
new_ndn = ch_strdup( new_dn );
- (void) dn_normalize_case( new_ndn );
+ (void) dn_normalize( new_ndn );
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
new_ndn, 0, 0 );
/* check scope */
if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
- (void) dn_normalize_case( dn );
+ (void) dn_normalize( dn );
scopeok = (dn == realbase)
? 1
: (strcmp( dn, realbase ) ? 0 : 1 );
ent.e_dn = ldap_get_dn(lc->ld, e);
ent.e_ndn = ch_strdup( ent.e_dn);
- (void) dn_normalize_case( ent.e_ndn );
+ (void) dn_normalize( ent.e_ndn );
ent.e_id = 0;
ent.e_attrs = 0;
ent.e_private = 0;
e.e_dn = (char *) dn;
e.e_ndn = ch_strdup( dn );
- (void) dn_normalize_case( e.e_ndn );
+ (void) dn_normalize( e.e_ndn );
try_again:
/* set cache mutex */
0, 0, 0 );
np_ndn = ch_strdup( np_dn );
- (void) dn_normalize_case( np_ndn );
+ (void) dn_normalize( np_ndn );
/* newSuperior == oldParent?, if so ==> ERROR */
/* newSuperior == entry being moved?, if so ==> ERROR */
new_ndn = ch_strdup(new_dn);
- (void) dn_normalize_case( new_ndn );
+ (void) dn_normalize( new_ndn );
Debug( LDAP_DEBUG_TRACE, "ldbm_back_modrdn: new ndn=%s\n",
new_ndn, 0, 0 );
/* check scope */
if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
- (void) dn_normalize_case( dn );
+ (void) dn_normalize( dn );
scopeok = (dn == realbase)
? 1
: (strcmp( dn, realbase ) ? 0 : 1 );
sprintf( buf, "uid=%s,%s", pw->pw_name, be->be_suffix[0] );
e->e_dn = ch_strdup( buf );
e->e_ndn = ch_strdup( buf );
- (void) dn_normalize_case( e->e_ndn );
+ (void) dn_normalize( e->e_ndn );
val.bv_val = pw->pw_name;
val.bv_len = strlen( pw->pw_name );
ndn = ch_strdup( dn );
- if ( dn_normalize_case( ndn ) == NULL ) {
+ if ( dn_normalize( ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n", dn, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
NULL, NULL, default_referral, NULL );
} else {
+ /* noSuchObject is not allowed to be returned by bind */
send_ldap_result( conn, op, rc = LDAP_INVALID_CREDENTIALS,
NULL, NULL, NULL, NULL );
}
ndn = ch_strdup( dn );
- if( dn_normalize_case( ndn ) == NULL ) {
+ if( dn_normalize( ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", dn, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
fname, lineno, tmp_be->be_suffix[0] );
} else {
char *dn = ch_strdup( cargv[1] );
- (void) dn_normalize( dn );
+ (void) dn_validate( dn );
charray_add( &be->be_suffix, dn );
(void) ldap_pvt_str2upper( dn );
charray_add( &be->be_nsuffix, dn );
aliased_dn = ch_strdup( cargv[2] );
(void) dn_normalize( aliased_dn );
- (void) dn_normalize_case( alias );
- (void) dn_normalize_case( aliased_dn );
charray_add( &be->be_suffixAlias, alias );
charray_add( &be->be_suffixAlias, aliased_dn );
be->be_root_dn = ch_strdup( cargv[1] );
be->be_root_ndn = ch_strdup( cargv[1] );
- if( dn_normalize_case( be->be_root_ndn ) == NULL ) {
+ if( dn_normalize( be->be_root_ndn ) == NULL ) {
free( be->be_root_dn );
free( be->be_root_ndn );
Debug( LDAP_DEBUG_ANY,
fname, lineno, 0 );
} else {
be->be_update_ndn = ch_strdup( cargv[1] );
- if( dn_normalize_case( be->be_update_ndn ) == NULL ) {
+ if( dn_normalize( be->be_update_ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"%s: line %d: updatedn DN is invalid\n",
fname, lineno, 0 );
e->e_attrs = NULL;
e->e_dn = ch_strdup( SLAPD_CONFIG_DN );
e->e_ndn = ch_strdup( SLAPD_CONFIG_DN );
- (void) dn_normalize_case( e->e_ndn );
+ (void) dn_normalize( e->e_ndn );
e->e_private = NULL;
{
arg->co_op->o_dn = ch_strdup( tmpdn != NULL ? tmpdn : "" );
arg->co_op->o_ndn = ch_strdup( arg->co_op->o_dn );
- (void) dn_normalize_case( arg->co_op->o_ndn );
+ (void) dn_normalize( arg->co_op->o_ndn );
arg->co_op->o_protocol = conn->c_protocol;
arg->co_op->o_connid = conn->c_connid;
ndn = ch_strdup( dn );
- if( dn_normalize_case( ndn ) == NULL ) {
+ if( dn_normalize( ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_delete: invalid dn (%s)\n", dn, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
#define B4SEPARATOR 8
/*
- * dn_normalize - put dn into a canonical format. the dn is
- * normalized in place, as well as returned if valid.
+ * dn_validate - validate and compress dn. the dn is
+ * compressed in place are returned if valid.
*/
char *
-dn_normalize( char *dn )
+dn_validate( char *dn )
{
char *d, *s;
int state, gotesc;
default:
dn = NULL;
Debug( LDAP_DEBUG_ANY,
- "dn_normalize - unknown state %d\n", state, 0, 0 );
+ "dn_validate - unknown state %d\n", state, 0, 0 );
break;
}
if ( *s == '\\' ) {
}
/*
- * dn_normalize_case - put dn into a canonical form suitable for storing
+ * dn_normalize - put dn into a canonical form suitable for storing
* in a hash database. this involves normalizing the case as well as
* the format. the dn is normalized in place as well as returned if valid.
*/
char *
-dn_normalize_case( char *dn )
+dn_normalize( char *dn )
{
ldap_pvt_str2upper( dn );
- /* normalize format */
- dn = dn_normalize( dn );
+ /* validate and compress dn */
+ dn = dn_validate( dn );
/* and upper case it */
return( dn );
/* generate normalized dn */
e->e_ndn = ch_strdup( e->e_dn );
- (void) dn_normalize_case( e->e_ndn );
+ (void) dn_normalize( e->e_ndn );
Debug(LDAP_DEBUG_TRACE, "<= str2entry(%s) -> %ld (0x%lx)\n",
e->e_dn, e->e_id, (unsigned long)e );
ndn = ch_strdup( dn );
- if( dn_normalize_case( ndn ) == NULL ) {
+ if( dn_normalize( ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_modify: invalid dn (%s)\n", dn, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
ndn = ch_strdup( dn );
- if( dn_normalize_case( ndn ) == NULL ) {
+ if( dn_normalize( ndn ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid dn (%s)\n", dn, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
"invalid DN", NULL, NULL );
nnewSuperior = ch_strdup( newSuperior );
- if( dn_normalize_case( nnewSuperior ) == NULL ) {
+ if( dn_normalize( nnewSuperior ) == NULL ) {
Debug( LDAP_DEBUG_ANY, "do_modrdn: invalid new superior (%s)\n",
newSuperior, 0, 0 );
send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
e->e_attrs = NULL;
e->e_dn = ch_strdup( SLAPD_MONITOR_DN );
e->e_ndn = ch_strdup(SLAPD_MONITOR_DN);
- (void) dn_normalize_case( e->e_ndn );
+ (void) dn_normalize( e->e_ndn );
e->e_private = NULL;
{
* dn.c
*/
+char * dn_validate LDAP_P(( char *dn ));
char * dn_normalize LDAP_P(( char *dn ));
-char * dn_normalize_case LDAP_P(( char *dn ));
char * dn_parent LDAP_P(( Backend *be, const char *dn ));
char ** dn_subtree LDAP_P(( Backend *be, const char *dn ));
char * dn_rdn LDAP_P(( Backend *be, char *dn ));
e->e_attrs = NULL;
e->e_dn = ch_strdup( LDAP_ROOT_DSE );
e->e_ndn = ch_strdup( LDAP_ROOT_DSE );
- (void) dn_normalize_case( e->e_ndn );
+ (void) dn_normalize( e->e_ndn );
e->e_private = NULL;
for ( i = 0; i < nbackends; i++ ) {
e->e_attrs = NULL;
e->e_dn = ch_strdup( SLAPD_SCHEMA_DN );
e->e_ndn = ch_strdup( SLAPD_SCHEMA_DN );
- (void) dn_normalize_case( e->e_ndn );
+ (void) dn_normalize( e->e_ndn );
e->e_private = NULL;
{
nbase = ch_strdup( base );
- if( dn_normalize_case( nbase ) == NULL ) {
+ if( dn_normalize( nbase ) == NULL ) {
send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX,
NULL, "invalid DN", NULL, NULL );
rc = -1;
} else {
buf[strlen( buf ) - 1] = '\0';
}
- (void) dn_normalize_case( buf );
+ (void) dn_normalize( buf );
if ( (tbe = select_backend( buf )) == NULL ) {
fprintf( stderr, "unknown suffix \"%s\"\n",
buf );
if( !noschemacheck ) {
/* make sure the DN is valid */
- if( dn_normalize_case( e->e_ndn ) == NULL ) {
+ if( dn_normalize( e->e_ndn ) == NULL ) {
fprintf( stderr, "%s: bad dn=\"%s\" (line=%d)\n",
progname, e->e_dn, lineno );
rc = EXIT_FAILURE;
if( base != NULL ) {
char *tbase = ch_strdup( base );
- if( dn_normalize_case( tbase ) == NULL ) {
+ if( dn_normalize( tbase ) == NULL ) {
fprintf( stderr, "%s: slap_init invalid suffix (\"%s\")\n",
progname, base );
exit( EXIT_FAILURE );
}
if ( syntax & SYNTAX_DN ) {
- (void) dn_normalize_case( s );
+ (void) dn_normalize( s );
return;
}