From 229e12b69d7785a7a3e38a47ed680775b56bc2ef Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 28 May 2000 19:15:37 +0000 Subject: [PATCH] SLAPD_SCHEMA_NOT_COMPAT: add subtype aware is_at_syntax() --- servers/slapd/aclparse.c | 8 ++++---- servers/slapd/at.c | 13 +++++++++++++ servers/slapd/proto-slap.h | 4 ++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index 81a1de981b..c46979fb55 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -335,8 +335,8 @@ parse_acl( } - if( strcmp( b->a_dn_at->ad_type->sat_oid, - SLAPD_OID_DN_SYNTAX ) != 0 ) + if( !is_at_syntax( b->a_dn_at->ad_type, + SLAPD_OID_DN_SYNTAX ) ) { fprintf( stderr, "%s: line %d: dnattr \"%s\": " @@ -461,8 +461,8 @@ parse_acl( } #ifdef SLAPD_SCHEMA_NOT_COMPAT - if( strcmp( b->a_group_at->ad_type->sat_oid, - SLAPD_OID_DN_SYNTAX ) != 0 ) + if( !is_at_syntax( b->a_group_at->ad_type, + SLAPD_OID_DN_SYNTAX ) ) { fprintf( stderr, "%s: line %d: group \"%s\": inappropriate syntax: %s\n", diff --git a/servers/slapd/at.c b/servers/slapd/at.c index e1a3f5f971..3271ed303e 100644 --- a/servers/slapd/at.c +++ b/servers/slapd/at.c @@ -173,6 +173,19 @@ at_fake_if_needed( #endif +int is_at_syntax( + AttributeType *at, + const char *oid ) +{ + for( ; at != NULL; at = at->sat_sup ) { + if( at->sat_syntax_oid ) { + return ( strcmp( at->sat_syntax_oid, oid ) == 0 ); + } + } + + return 0; +} + int is_at_subtype( AttributeType *sub, AttributeType *sup ) diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index c1b268ed22..d51f1f25f3 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -100,6 +100,10 @@ LIBSLAPD_F (int) is_at_subtype LDAP_P(( AttributeType *sub, AttributeType *super )); +LIBSLAPD_F (int) is_at_syntax LDAP_P(( + AttributeType *at, + const char *oid )); + # define at_canonical_name(at) ((at)->sat_cname) #else LIBSLAPD_F (int) at_fake_if_needed LDAP_P(( const char *name )); -- 2.39.5