From c7a7829c00f259d515f89448a12362e457fa10f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julio=20S=C3=A1nchez=20Fern=C3=A1ndez?= Date: Fri, 17 Sep 1999 15:48:23 +0000 Subject: [PATCH] Let at_find find the AttributeType that matches a given AttributeDescription. Useful to deal with things like userCertificate;binary. --- servers/slapd/attr.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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 ); } -- 2.39.5