From 61dffba4793a22df0e93cddc1a935599f6d85dc3 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 22 Mar 2003 16:12:39 +0000 Subject: [PATCH] ITS#2847: fix cn=#,... --- servers/slapd/dn.c | 5 +++++ servers/slapd/schema_check.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 647468d92b..b1168901c0 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -267,6 +267,11 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags ) ava->la_attr = ad->ad_cname; if( ava->la_flags & LDAP_AVA_BINARY ) { + if( ava->la_value.bv_len == 0 ) { + /* BER encoding is empty */ + return LDAP_INVALID_SYNTAX; + } + /* AVA is binary encoded, don't muck with it */ } else if( flags & SLAP_LDAPDN_PRETTY ) { transf = ad->ad_type->sat_syntax->ssyn_pretty; diff --git a/servers/slapd/schema_check.c b/servers/slapd/schema_check.c index 75cf612d2f..357f7f5ae9 100644 --- a/servers/slapd/schema_check.c +++ b/servers/slapd/schema_check.c @@ -845,10 +845,17 @@ entry_naming_check( snprintf( textbuf, textlen, "naming attribute '%s' is not present in entry", ava->la_attr.bv_val ); - rc = LDAP_NO_SUCH_ATTRIBUTE; + rc = LDAP_NAMING_VIOLATION; break; } + if( ava->la_flags & LDAP_AVA_BINARY ) { + snprintf( textbuf, textlen, + "value of naming attribute '%s' in unsupported BER form", + ava->la_attr.bv_val ); + rc = LDAP_NAMING_VIOLATION; + } + #ifdef SLAP_NVALUES if ( value_find_ex( desc, SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH, @@ -861,7 +868,7 @@ entry_naming_check( snprintf( textbuf, textlen, "value of naming attribute '%s' is not present in entry", ava->la_attr.bv_val ); - rc = LDAP_NO_SUCH_ATTRIBUTE; + rc = LDAP_NAMING_VIOLATION; break; } } -- 2.39.5