Skip to content
Snippets Groups Projects
Commit b1172dc5 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Add experimental support for undefined attribute types.

parent 7ec41919
No related branches found
No related tags found
No related merge requests found
......@@ -243,3 +243,54 @@ int ad_inlist(
}
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;
}
......@@ -115,11 +115,19 @@ str2entry( char *s )
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 );
......
......@@ -41,6 +41,16 @@ LDAP_SLAPD_F (int) ad_inlist LDAP_P((
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
*/
......
......@@ -199,6 +199,17 @@ struct slap_schema_ad_map {
{ 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 )
......@@ -245,6 +256,8 @@ schema_prep( void )
}
}
slap_schema.si_at_undefined = &slap_at_undefined;
++schema_init_done;
return LDAP_SUCCESS;
}
......@@ -388,10 +388,10 @@ struct slap_internal_schema {
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;
......@@ -399,14 +399,14 @@ struct slap_internal_schema {
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;
......@@ -424,12 +424,15 @@ struct slap_internal_schema {
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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment