int
syn_add(
- LDAP_SYNTAX *syn,
+ LDAPSyntax *syn,
unsigned flags,
slap_syntax_validate_func *validate,
+ slap_syntax_transform_func *normalize,
+ slap_syntax_transform_func *pretty,
+#ifdef SLAPD_BINARY_CONVERSION
slap_syntax_transform_func *ber2str,
slap_syntax_transform_func *str2ber,
+#endif
const char **err
)
{
ssyn = (Syntax *) ch_calloc( 1, sizeof(Syntax) );
- memcpy( &ssyn->ssyn_syn, syn, sizeof(LDAP_SYNTAX) );
+ AC_MEMCPY( &ssyn->ssyn_syn, syn, sizeof(LDAPSyntax) );
ssyn->ssyn_next = NULL;
ssyn->ssyn_flags = flags;
ssyn->ssyn_validate = validate;
+ ssyn->ssyn_normalize = normalize;
+ ssyn->ssyn_pretty = pretty;
#ifdef SLAPD_BINARY_CONVERSION
ssyn->ssyn_ber2str = ber2str;
char * desc,
unsigned flags,
slap_syntax_validate_func *validate,
- slap_syntax_transform_func *ber2str,
- slap_syntax_transform_func *str2ber )
+ slap_syntax_transform_func *normalize,
+ slap_syntax_transform_func *pretty )
{
- LDAP_SYNTAX *syn;
+ LDAPSyntax *syn;
int code;
const char *err;
- syn = ldap_str2syntax( desc, &code, &err);
+ syn = ldap_str2syntax( desc, &code, &err, LDAP_SCHEMA_ALLOW_ALL);
if ( !syn ) {
Debug( LDAP_DEBUG_ANY, "Error in register_syntax: %s before %s in %s\n",
ldap_scherr2str(code), err, desc );
return( -1 );
}
- code = syn_add( syn, flags, validate, ber2str, str2ber, &err );
+ code = syn_add( syn, flags, validate, normalize, pretty, &err );
+
+ ldap_memfree( syn );
+
if ( code ) {
Debug( LDAP_DEBUG_ANY, "Error in register_syntax: %s %s in %s\n",
scherr2str(code), err, desc );
struct berval *vals[2];
Syntax *syn;
-#ifdef SLAPD_SCHEMA_NOT_COMPAT
AttributeDescription *ad_ldapSyntaxes = slap_schema.si_ad_ldapSyntaxes;
-#else
- char *ad_ldapSyntaxes = "ldapSyntaxes";
-#endif
vals[0] = &val;
vals[1] = NULL;
for ( syn = syn_list; syn; syn = syn->ssyn_next ) {
+ if ( ! syn->ssyn_validate ) {
+ /* skip syntaxes without validators */
+ continue;
+ }
+ if ( syn->ssyn_flags & SLAP_SYNTAX_HIDE ) {
+ /* hide syntaxes */
+ continue;
+ }
+
val.bv_val = ldap_syntax2str( &syn->ssyn_syn );
if ( val.bv_val == NULL ) {
return -1;
}
val.bv_len = strlen( val.bv_val );
+#if 0
Debug( LDAP_DEBUG_TRACE, "Merging syn [%ld] %s\n",
(long) val.bv_len, val.bv_val, 0 );
+#endif
attr_merge( e, ad_ldapSyntaxes, vals );
ldap_memfree( val.bv_val );
}