From: Julio Sánchez Fernández Date: Fri, 17 Sep 1999 15:48:23 +0000 (+0000) Subject: Let at_find find the AttributeType that matches a given AttributeDescription. X-Git-Tag: UCDATA_2_4~424 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c7a7829c00f259d515f89448a12362e457fa10f3;p=openldap Let at_find find the AttributeType that matches a given AttributeDescription. Useful to deal with things like userCertificate;binary. --- diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 8a5f5358cb..de6453b353 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -386,11 +386,27 @@ at_find( ) { struct aindexrec *air = NULL; + char *p, *tmpname = NULL; - if ( (air = (struct aindexrec *) avl_find( attr_index, name, + /* + * The name may actually be an AttributeDescription, i.e. it may + * contain options. Let's deal with it. + */ + p = strchr( name, ';' ); + if ( p ) { + tmpname = ch_malloc( p-name+1 ); + strncpy( tmpname, name, p-name ); + tmpname[p-name] = '\0'; + } else + tmpname = (char *)name; + if ( (air = (struct aindexrec *) avl_find( attr_index, tmpname, (AVL_CMP) attr_index_name_cmp )) != NULL ) { + if ( tmpname != name ) + ldap_memfree( tmpname ); return( air->air_at ); } + if ( tmpname != name ) + ldap_memfree( tmpname ); return( NULL ); }