}
+int slap_str2undef_ad(
+ const char *str,
+ AttributeDescription **ad,
+ const char **text )
+{
+ struct berval bv;
+ bv.bv_val = (char *) str;
+ bv.bv_len = strlen( str );
+
+ return slap_bv2undef_ad( &bv, ad, text );
+}
+
+int slap_bv2undef_ad(
+ struct berval *bv,
+ AttributeDescription **ad,
+ const char **text )
+{
+ AttributeDescription desc;
+
+ assert( ad != NULL );
+ assert( *ad == NULL ); /* temporary */
+
+ if( bv == NULL || bv->bv_len == 0 ) {
+ *text = "empty attribute description";
+ return LDAP_UNDEFINED_TYPE;
+ }
+
+ /* make sure description is IA5 */
+ if( ad_keystring( bv ) ) {
+ *text = "attribute description contains inappropriate characters";
+ return LDAP_UNDEFINED_TYPE;
+ }
+
+ desc.ad_type = slap_schema.si_at_undefined;
+ desc.ad_flags = SLAP_DESC_NONE;
+ desc.ad_lang = NULL;
+
+ desc.ad_cname = ber_bvdup( bv );
+
+ /* canoncial to upper case */
+ ldap_pvt_str2upper( bv->bv_val );
+
+ if( *ad == NULL ) {
+ *ad = ch_malloc( sizeof( AttributeDescription ) );
+ }
+
+ **ad = desc;
+
+ return LDAP_SUCCESS;
+}
+
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
- "<= str2entry NULL (str2ad=%s)\n", text, 0, 0 );
- entry_free( e );
- free( value.bv_val );
- free( type );
- return( NULL );
+ "<= str2entry: str2ad(%s): %s\n", type, text, 0 );
+
+ rc = slap_str2undef_ad( type, &ad, &text );
+
+ if( rc != LDAP_SUCCESS ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "<= str2entry: str2undef_ad(%s): %s\n",
+ type, text, 0 );
+ entry_free( e );
+ free( value.bv_val );
+ free( type );
+ return( NULL );
+ }
}
rc = attr_merge( e, ad, vals );
AttributeDescription *desc,
char **attrs ));
+LDAP_SLAPD_F (int) slap_str2undef_ad LDAP_P((
+ const char *,
+ AttributeDescription **ad,
+ const char **text ));
+
+LDAP_SLAPD_F (int) slap_bv2undef_ad LDAP_P((
+ struct berval *bv,
+ AttributeDescription **ad,
+ const char **text ));
+
/*
* acl.c
*/
{ NULL, NULL, NULL, NULL, 0 }
};
+static AttributeType slap_at_undefined = {
+ "UNDEFINED", /* cname */
+ { "1.1.1", NULL, NULL, 1, NULL,
+ NULL, NULL, NULL, NULL,
+ 0, 0, 0, 1, 3 },
+ NULL, /* sup */
+ NULL, /* subtypes */
+ NULL, NULL, NULL, NULL, /* matching rules */
+ NULL, /* syntax (this may need to be defined) */
+ NULL /* next */
+};
int
schema_prep( void )
}
}
+ slap_schema.si_at_undefined = &slap_at_undefined;
+
++schema_init_done;
return LDAP_SUCCESS;
}
ObjectClass *si_oc_subschema;
ObjectClass *si_oc_rootdse;
- /* objectClass attribute */
+ /* objectClass attribute descriptions */
AttributeDescription *si_ad_objectClass;
- /* operational attributes */
+ /* operational attribute descriptions */
AttributeDescription *si_ad_structuralObjectClass;
AttributeDescription *si_ad_creatorsName;
AttributeDescription *si_ad_createTimestamp;
AttributeDescription *si_ad_modifyTimestamp;
AttributeDescription *si_ad_subschemaSubentry;
- /* root DSE attributes */
+ /* root DSE attribute descriptions */
AttributeDescription *si_ad_namingContexts;
AttributeDescription *si_ad_supportedControl;
AttributeDescription *si_ad_supportedExtension;
AttributeDescription *si_ad_supportedLDAPVersion;
AttributeDescription *si_ad_supportedSASLMechanisms;
- /* subschema subentry attributes */
+ /* subschema subentry attribute descriptions */
AttributeDescription *si_ad_objectClasses;
AttributeDescription *si_ad_attributeTypes;
AttributeDescription *si_ad_ldapSyntaxes;
AttributeDescription *si_ad_aci;
#endif
- /* Other */
+ /* Other attributes descriptions */
AttributeDescription *si_ad_userPassword;
AttributeDescription *si_ad_authPassword;
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
AttributeDescription *si_ad_krbName;
#endif
+
+ /* Undefined Attribute Type */
+ AttributeType *si_at_undefined;
};
typedef struct slap_attr_assertion {