mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-05 14:42:10 -05:00
Added an_oc to AttributeName for caching ObjectClass lookups.
Added error checking to str2anlist; if the attr name doesn't match any attribute or objectclass the offending attr name is displayed.
This commit is contained in:
parent
bf5b4405fe
commit
8067107ed2
4 changed files with 23 additions and 1 deletions
|
|
@ -204,6 +204,12 @@ parse_acl(
|
|||
} else if ( strncasecmp( left, "attr", 4 ) == 0 ) {
|
||||
a->acl_attrs = str2anlist( a->acl_attrs,
|
||||
right, "," );
|
||||
if ( a->acl_attrs == NULL ) {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: unknown attr \"%s\" in to clause\n",
|
||||
fname, lineno, right );
|
||||
acl_usage();
|
||||
}
|
||||
} else {
|
||||
fprintf( stderr,
|
||||
"%s: line %d: expecting <what> got \"%s\"\n",
|
||||
|
|
|
|||
|
|
@ -301,7 +301,11 @@ int ad_inlist(
|
|||
* EXTENSION: see if requested description is an object class
|
||||
* if so, return attributes which the class requires/allows
|
||||
*/
|
||||
oc = oc_bvfind( &attrs->an_name );
|
||||
oc = attrs->an_oc;
|
||||
if( oc == NULL ) {
|
||||
oc = oc_bvfind( &attrs->an_name );
|
||||
attrs->an_oc = oc;
|
||||
}
|
||||
if( oc != NULL ) {
|
||||
if ( oc == slap_schema.si_oc_extensibleObject ) {
|
||||
/* extensibleObject allows the return of anything */
|
||||
|
|
@ -461,8 +465,18 @@ str2anlist( AttributeName *an, const char *in, const char *brkstr )
|
|||
s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
|
||||
{
|
||||
anew->an_desc = NULL;
|
||||
anew->an_oc = NULL;
|
||||
ber_str2bv(s, 0, 1, &anew->an_name);
|
||||
slap_bv2ad(&anew->an_name, &anew->an_desc, &text);
|
||||
if ( !anew->an_desc ) {
|
||||
anew->an_oc = oc_bvfind( &anew->an_name );
|
||||
if ( !anew->an_oc ) {
|
||||
free( an );
|
||||
/* overwrites input string on error! */
|
||||
strcpy( in, s );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
anew++;
|
||||
}
|
||||
anew->an_name.bv_val = NULL;
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ do_search(
|
|||
}
|
||||
for ( i=0; i<siz; i++ ) {
|
||||
an[i].an_desc = NULL;
|
||||
an[i].an_oc = NULL;
|
||||
slap_bv2ad(&an[i].an_name, &an[i].an_desc, &text);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@ typedef struct slap_attr_desc {
|
|||
typedef struct slap_attr_name {
|
||||
struct berval an_name;
|
||||
AttributeDescription *an_desc;
|
||||
ObjectClass *an_oc;
|
||||
} AttributeName;
|
||||
|
||||
#define slap_ad_is_lang(ad) ( (ad)->ad_lang.bv_len != 0 )
|
||||
|
|
|
|||
Loading…
Reference in a new issue