From b34cf024884cf35572d98164381537f256b6dfee Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 7 May 2004 02:18:08 +0000 Subject: [PATCH] more on fixing escaped semicolon in normalized DN --- servers/slapd/acl.c | 18 +++++++++--------- servers/slapd/aclparse.c | 4 ++-- servers/slapd/back-ldap/suffixmassage.c | 5 ++++- servers/slapd/back-meta/search.c | 2 +- servers/slapd/backend.c | 2 +- servers/slapd/dn.c | 4 ++-- servers/slapd/limits.c | 2 +- servers/slapd/overlays/rwmdn.c | 5 ++++- 8 files changed, 24 insertions(+), 18 deletions(-) diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 23abde734f..28b1fec16b 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -551,7 +551,7 @@ acl_get( continue; if ( patlen > 0 ) { - if ( !DN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) ) + if ( !NDN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) ) continue; sep = 1; } @@ -561,13 +561,13 @@ acl_get( continue; } else if ( a->acl_dn_style == ACL_STYLE_SUBTREE ) { - if ( dnlen > patlen && !DN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) ) + if ( dnlen > patlen && !NDN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) ) continue; } else if ( a->acl_dn_style == ACL_STYLE_CHILDREN ) { if ( dnlen <= patlen ) continue; - if ( !DN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) ) + if ( !NDN_SEPARATOR( e->e_ndn[dnlen - patlen - 1] ) ) continue; } @@ -652,7 +652,7 @@ acl_get( } else if ( a->acl_dn_style == ACL_STYLE_ONE ) { int rdnlen = -1; - if ( !DN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) + if ( !NDN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) continue; rdnlen = dn_rdnlen( NULL, val ); @@ -660,14 +660,14 @@ acl_get( continue; } else if ( a->acl_dn_style == ACL_STYLE_SUBTREE ) { - if ( vdnlen > patlen && !DN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) + if ( vdnlen > patlen && !NDN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) continue; } else if ( a->acl_dn_style == ACL_STYLE_CHILDREN ) { if ( vdnlen <= patlen ) continue; - if ( !DN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) + if ( !NDN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) continue; } @@ -880,7 +880,7 @@ acl_mask( goto dn_match_cleanup; } - if ( !DN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) ) { + if ( !NDN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) ) { goto dn_match_cleanup; } @@ -890,7 +890,7 @@ acl_mask( } } else if ( b->a_dn_style == ACL_STYLE_SUBTREE ) { - if ( odnlen > patlen && !DN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) ) { + if ( odnlen > patlen && !NDN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) ) { goto dn_match_cleanup; } @@ -899,7 +899,7 @@ acl_mask( goto dn_match_cleanup; } - if ( !DN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) ) { + if ( !NDN_SEPARATOR( op->o_ndn.bv_val[odnlen - patlen - 1] ) ) { goto dn_match_cleanup; } } diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index efec82f904..8c3738c4d6 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -196,7 +196,7 @@ check_scope( BackendDB *be, AccessControl *a ) int rdnlen = -1, sep = 0; if ( patlen > 0 ) { - if ( !DN_SEPARATOR( dn.bv_val[ dn.bv_len - patlen - 1 ] ) ) + if ( !NDN_SEPARATOR( dn.bv_val[ dn.bv_len - patlen - 1 ] ) ) return ACL_SCOPE_ERR; sep = 1; } @@ -227,7 +227,7 @@ check_scope( BackendDB *be, AccessControl *a ) break; } - if ( dn.bv_len < patlen && !DN_SEPARATOR( a->acl_dn_pat.bv_val[ patlen -dn.bv_len - 1 ] ) ) { + if ( dn.bv_len < patlen && !NDN_SEPARATOR( a->acl_dn_pat.bv_val[ patlen -dn.bv_len - 1 ] ) ) { return ACL_SCOPE_ERR; } diff --git a/servers/slapd/back-ldap/suffixmassage.c b/servers/slapd/back-ldap/suffixmassage.c index 2ad3bafdf8..67841698b8 100644 --- a/servers/slapd/back-ldap/suffixmassage.c +++ b/servers/slapd/back-ldap/suffixmassage.c @@ -134,7 +134,10 @@ ldap_back_dn_massage( if ( diff < 0 ) { /* alias is longer than dn */ continue; - } else if ( diff > 0 && ( !DN_SEPARATOR(dn->bv_val[diff-1]))) { + } else if ( diff > 0 && ( !NDN_SEPARATOR(dn->bv_val[diff-1]))) { + /* FIXME: should use DN_SEPARATOR() instead of + * NDN_SEPARATOR(), but the latter may fail if + * an escaped ';' is present */ /* boundary is not at a DN separator */ continue; /* At a DN Separator */ diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 2e239e3383..c48b73e50b 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -749,7 +749,7 @@ is_one_level_rdn( ) { for ( ; from--; ) { - if ( DN_SEPARATOR( rdn[ from ] ) ) { + if ( NDN_SEPARATOR( rdn[ from ] ) ) { return 0; } } diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index b99ecdc1e2..75eeef7e2e 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -670,7 +670,7 @@ select_backend( * need not look at escaping */ if ( len && len < dnlen && - !DN_SEPARATOR( dn->bv_val[(dnlen-len)-1] )) + !NDN_SEPARATOR( dn->bv_val[(dnlen-len)-1] )) { continue; } diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 6702e8dc18..66203b56e8 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -690,7 +690,7 @@ dnParent( return; } - assert( DN_SEPARATOR( p[ 0 ] ) ); + assert( NDN_SEPARATOR( p[ 0 ] ) ); p++; assert( ATTR_LEADCHAR( p[ 0 ] ) ); @@ -882,7 +882,7 @@ dnIsSuffix( } /* no rdn separator or escaped rdn separator */ - if ( d > 1 && !DN_SEPARATOR( dn->bv_val[ d - 1 ] ) ) { + if ( d > 1 && !NDN_SEPARATOR( dn->bv_val[ d - 1 ] ) ) { return 0; } diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index 55fce61705..81a3bce063 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -163,7 +163,7 @@ limits_get( } } else { /* check for unescaped rdn separator */ - if ( !DN_SEPARATOR( ndn->bv_val[d-1] ) ) { + if ( !NDN_SEPARATOR( ndn->bv_val[d-1] ) ) { break; } } diff --git a/servers/slapd/overlays/rwmdn.c b/servers/slapd/overlays/rwmdn.c index e45ffff18e..c3bec9fc04 100644 --- a/servers/slapd/overlays/rwmdn.c +++ b/servers/slapd/overlays/rwmdn.c @@ -138,7 +138,10 @@ rwm_dn_massage( if ( diff < 0 ) { /* alias is longer than dn */ continue; - } else if ( diff > 0 && ( !DN_SEPARATOR(dn->bv_val[diff-1]))) { + } else if ( diff > 0 && ( !NDN_SEPARATOR(dn->bv_val[diff-1]))) { + /* FIXME: should use DN_SEPARATOR() instead of + * NDN_SEPARATOR(), but the latter may fail if + * an escaped ';' is present */ /* boundary is not at a DN separator */ continue; /* At a DN Separator */ -- 2.39.5