mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
In preparation for adding dn_rewrite()...
s/dn_normalize/dn_validate/ s/dn_normalize_case/dn_normalize/
This commit is contained in:
parent
a68825e6df
commit
7a0b0b2bbf
@ -371,7 +371,7 @@ acl_access_allowed(
|
||||
*/
|
||||
/* 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;
|
||||
}
|
||||
@ -748,7 +748,7 @@ aci_group_member (
|
||||
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);
|
||||
@ -826,7 +826,7 @@ aci_access_allowed (
|
||||
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);
|
||||
|
@ -69,7 +69,7 @@ do_add( Connection *conn, Operation *op )
|
||||
|
||||
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 );
|
||||
|
@ -360,7 +360,7 @@ bdb2i_cache_find_entry_dn2id(
|
||||
|
||||
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 */
|
||||
|
@ -172,7 +172,7 @@ bdb2i_back_modrdn_internal(
|
||||
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 */
|
||||
|
||||
@ -221,7 +221,7 @@ bdb2i_back_modrdn_internal(
|
||||
|
||||
|
||||
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 );
|
||||
|
@ -246,7 +246,7 @@ bdb2i_back_search_internal(
|
||||
/* 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 );
|
||||
|
@ -148,7 +148,7 @@ ldap_send_entry(
|
||||
|
||||
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;
|
||||
|
@ -445,7 +445,7 @@ cache_find_entry_dn2id(
|
||||
|
||||
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 */
|
||||
|
@ -191,7 +191,7 @@ ldbm_back_modrdn(
|
||||
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 */
|
||||
@ -258,7 +258,7 @@ ldbm_back_modrdn(
|
||||
|
||||
|
||||
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 );
|
||||
|
@ -251,7 +251,7 @@ ldbm_back_search(
|
||||
/* 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 );
|
||||
|
@ -240,7 +240,7 @@ pw2entry( Backend *be, struct passwd *pw, char *rdn )
|
||||
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 );
|
||||
|
@ -111,7 +111,7 @@ do_bind(
|
||||
|
||||
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 );
|
||||
@ -272,6 +272,7 @@ do_bind(
|
||||
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 );
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ do_compare(
|
||||
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 );
|
||||
|
@ -247,7 +247,7 @@ read_config( const char *fname )
|
||||
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 );
|
||||
@ -299,8 +299,6 @@ read_config( const char *fname )
|
||||
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 );
|
||||
|
||||
@ -347,7 +345,7 @@ read_config( const char *fname )
|
||||
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,
|
||||
@ -556,7 +554,7 @@ read_config( const char *fname )
|
||||
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 );
|
||||
|
@ -51,7 +51,7 @@ config_info(
|
||||
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;
|
||||
|
||||
{
|
||||
|
@ -1053,7 +1053,7 @@ static int connection_op_activate( Connection *conn, Operation *op )
|
||||
|
||||
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;
|
||||
|
@ -59,7 +59,7 @@ do_delete(
|
||||
|
||||
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 );
|
||||
|
@ -29,12 +29,12 @@
|
||||
#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;
|
||||
@ -146,7 +146,7 @@ dn_normalize( char *dn )
|
||||
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 == '\\' ) {
|
||||
@ -176,18 +176,18 @@ dn_normalize( char *dn )
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 );
|
||||
|
@ -145,7 +145,7 @@ str2entry( char *s )
|
||||
|
||||
/* 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 );
|
||||
|
@ -87,7 +87,7 @@ do_modify(
|
||||
|
||||
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 );
|
||||
|
@ -84,7 +84,7 @@ do_modrdn(
|
||||
|
||||
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 );
|
||||
@ -127,7 +127,7 @@ do_modrdn(
|
||||
|
||||
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,
|
||||
|
@ -55,7 +55,7 @@ monitor_info(
|
||||
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;
|
||||
|
||||
{
|
||||
|
@ -205,8 +205,8 @@ void connection_done LDAP_P((Connection *));
|
||||
* 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 ));
|
||||
|
@ -34,7 +34,7 @@ root_dse_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
||||
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++ ) {
|
||||
|
@ -1174,7 +1174,7 @@ schema_info( Connection *conn, Operation *op, char **attrs, int attrsonly )
|
||||
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;
|
||||
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ do_search(
|
||||
|
||||
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;
|
||||
|
@ -298,7 +298,7 @@ main( int argc, char **argv )
|
||||
} 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 );
|
||||
|
@ -59,7 +59,7 @@ main( int argc, char **argv )
|
||||
|
||||
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;
|
||||
|
@ -198,7 +198,7 @@ slap_tool_init(
|
||||
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 );
|
||||
|
@ -96,7 +96,7 @@ value_normalize(
|
||||
}
|
||||
|
||||
if ( syntax & SYNTAX_DN ) {
|
||||
(void) dn_normalize_case( s );
|
||||
(void) dn_normalize( s );
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user