mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Changed AttributeType.sat_cname from char * to struct berval.
(will fix up back-bdb next.)
This commit is contained in:
parent
cc4a51f23c
commit
0bfaa8b4ae
@ -276,7 +276,8 @@ at_add(
|
|||||||
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
|
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
|
||||||
AC_MEMCPY( &sat->sat_atype, at, sizeof(LDAPAttributeType));
|
AC_MEMCPY( &sat->sat_atype, at, sizeof(LDAPAttributeType));
|
||||||
|
|
||||||
sat->sat_cname = cname;
|
sat->sat_cname.bv_val = cname;
|
||||||
|
sat->sat_cname.bv_len = strlen( cname );
|
||||||
ldap_pvt_thread_mutex_init(&sat->sat_ad_mutex);
|
ldap_pvt_thread_mutex_init(&sat->sat_ad_mutex);
|
||||||
|
|
||||||
if ( at->at_sup_oid ) {
|
if ( at->at_sup_oid ) {
|
||||||
|
@ -507,12 +507,12 @@ ldap_send_entry(
|
|||||||
"[rw] searchResult on"
|
"[rw] searchResult on"
|
||||||
" attr=%s:"
|
" attr=%s:"
|
||||||
" \"%s\" -> \"%s\"\n",
|
" \"%s\" -> \"%s\"\n",
|
||||||
attr->a_desc->ad_type->sat_cname,
|
attr->a_desc->ad_type->sat_cname.bv_val,
|
||||||
bv->bv_val, newval ));
|
bv->bv_val, newval ));
|
||||||
#else /* !NEW_LOGGING */
|
#else /* !NEW_LOGGING */
|
||||||
Debug( LDAP_DEBUG_ARGS,
|
Debug( LDAP_DEBUG_ARGS,
|
||||||
"rw> searchResult on attr=%s: \"%s\" -> \"%s\"\n",
|
"rw> searchResult on attr=%s: \"%s\" -> \"%s\"\n",
|
||||||
attr->a_desc->ad_type->sat_cname,
|
attr->a_desc->ad_type->sat_cname.bv_val,
|
||||||
bv->bv_val, newval );
|
bv->bv_val, newval );
|
||||||
#endif /* !NEW_LOGGING */
|
#endif /* !NEW_LOGGING */
|
||||||
|
|
||||||
|
@ -18,29 +18,17 @@
|
|||||||
|
|
||||||
/* for the cache of attribute information (which are indexed, etc.) */
|
/* for the cache of attribute information (which are indexed, etc.) */
|
||||||
typedef struct ldbm_attrinfo {
|
typedef struct ldbm_attrinfo {
|
||||||
#ifdef SLAPD_USE_AD
|
AttributeDescription *ai_desc; /* attribute description cn;lang-en */
|
||||||
AttributeDescription *ai_desc; /* attribute description cn;lang-en */
|
|
||||||
#else
|
|
||||||
char *ai_desc;
|
|
||||||
#endif
|
|
||||||
slap_mask_t ai_indexmask; /* how the attr is indexed */
|
slap_mask_t ai_indexmask; /* how the attr is indexed */
|
||||||
} AttrInfo;
|
} AttrInfo;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ainfo_type_cmp(
|
ainfo_type_cmp(
|
||||||
#ifdef SLAPD_USE_AD
|
|
||||||
AttributeDescription *desc,
|
AttributeDescription *desc,
|
||||||
#else
|
|
||||||
char *desc,
|
|
||||||
#endif
|
|
||||||
AttrInfo *a
|
AttrInfo *a
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef SLAPD_USE_AD
|
return desc - a->ai_desc;
|
||||||
return ad_cmp( desc, a->ai_desc );
|
|
||||||
#else
|
|
||||||
return( strcasecmp( desc, a->ai_desc ) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -49,21 +37,13 @@ ainfo_cmp(
|
|||||||
AttrInfo *b
|
AttrInfo *b
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef SLAPD_USE_AD
|
return a->ai_desc - b->ai_desc;
|
||||||
return ad_cmp( a->ai_desc, b->ai_desc );
|
|
||||||
#else
|
|
||||||
return( strcasecmp( a->ai_desc, b->ai_desc ) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
attr_mask(
|
attr_mask(
|
||||||
struct ldbminfo *li,
|
struct ldbminfo *li,
|
||||||
#ifdef SLAPD_USE_AD
|
AttributeDescription *desc,
|
||||||
AttributeDescription *desc,
|
|
||||||
#else
|
|
||||||
const char *desc,
|
|
||||||
#endif
|
|
||||||
slap_mask_t *indexmask )
|
slap_mask_t *indexmask )
|
||||||
{
|
{
|
||||||
AttrInfo *a;
|
AttrInfo *a;
|
||||||
@ -211,11 +191,7 @@ attr_index_config(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef SLAPD_USE_AD
|
|
||||||
a->ai_desc = ad;
|
a->ai_desc = ad;
|
||||||
#else
|
|
||||||
a->ai_desc = ch_strdup( ad->ad_cname.bv_val );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a->ai_indexmask = mask;
|
a->ai_indexmask = mask;
|
||||||
|
|
||||||
@ -241,11 +217,7 @@ attr_index_config(
|
|||||||
static void
|
static void
|
||||||
ainfo_free( void *attr )
|
ainfo_free( void *attr )
|
||||||
{
|
{
|
||||||
AttrInfo *ai = attr;
|
free( attr );
|
||||||
#ifndef SLAPD_USE_AD
|
|
||||||
free( ai->ai_desc );
|
|
||||||
#endif
|
|
||||||
free( ai );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -253,4 +225,3 @@ attr_index_destroy( Avlnode *tree )
|
|||||||
{
|
{
|
||||||
avl_free( tree, ainfo_free );
|
avl_free( tree, ainfo_free );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ presence_candidates(
|
|||||||
int rc;
|
int rc;
|
||||||
char *dbname;
|
char *dbname;
|
||||||
slap_mask_t mask;
|
slap_mask_t mask;
|
||||||
struct berval *prefix;
|
struct berval prefix = {0};
|
||||||
|
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
|
LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
|
||||||
@ -221,7 +221,6 @@ presence_candidates(
|
|||||||
Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
|
Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
idl = idl_allids( be );
|
idl = idl_allids( be );
|
||||||
|
|
||||||
rc = index_param( be, desc, LDAP_FILTER_PRESENT,
|
rc = index_param( be, desc, LDAP_FILTER_PRESENT,
|
||||||
@ -252,7 +251,6 @@ presence_candidates(
|
|||||||
0, 0, 0 );
|
0, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,15 +267,14 @@ presence_candidates(
|
|||||||
dbname, LDBM_SUFFIX, 0 );
|
dbname, LDBM_SUFFIX, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( prefix != NULL ) {
|
if( prefix.bv_val != NULL ) {
|
||||||
idl_free( idl );
|
idl_free( idl );
|
||||||
idl = NULL;
|
idl = NULL;
|
||||||
|
|
||||||
rc = key_read( be, db, prefix, &idl );
|
rc = key_read( be, db, &prefix, &idl );
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
if( rc != LDAP_SUCCESS ) {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
@ -304,7 +301,6 @@ presence_candidates(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ldbm_cache_close( be, db );
|
ldbm_cache_close( be, db );
|
||||||
ber_bvfree( prefix );
|
|
||||||
|
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
|
LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
|
||||||
@ -330,7 +326,7 @@ equality_candidates(
|
|||||||
int rc;
|
int rc;
|
||||||
char *dbname;
|
char *dbname;
|
||||||
slap_mask_t mask;
|
slap_mask_t mask;
|
||||||
struct berval *prefix;
|
struct berval prefix = {0};
|
||||||
struct berval **keys = NULL;
|
struct berval **keys = NULL;
|
||||||
MatchingRule *mr;
|
MatchingRule *mr;
|
||||||
|
|
||||||
@ -371,18 +367,15 @@ equality_candidates(
|
|||||||
0, 0, 0 );
|
0, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
mr = ava->aa_desc->ad_type->sat_equality;
|
mr = ava->aa_desc->ad_type->sat_equality;
|
||||||
if( !mr ) {
|
if( !mr ) {
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !mr->smr_filter ) {
|
if( !mr->smr_filter ) {
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,12 +384,10 @@ equality_candidates(
|
|||||||
mask,
|
mask,
|
||||||
ava->aa_desc->ad_type->sat_syntax,
|
ava->aa_desc->ad_type->sat_syntax,
|
||||||
mr,
|
mr,
|
||||||
prefix,
|
&prefix,
|
||||||
ava->aa_value,
|
ava->aa_value,
|
||||||
&keys );
|
&keys );
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
if( rc != LDAP_SUCCESS ) {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
|
LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
|
||||||
@ -514,7 +505,7 @@ approx_candidates(
|
|||||||
int rc;
|
int rc;
|
||||||
char *dbname;
|
char *dbname;
|
||||||
slap_mask_t mask;
|
slap_mask_t mask;
|
||||||
struct berval *prefix;
|
struct berval prefix = {0};
|
||||||
struct berval **keys = NULL;
|
struct berval **keys = NULL;
|
||||||
MatchingRule *mr;
|
MatchingRule *mr;
|
||||||
|
|
||||||
@ -555,7 +546,6 @@ approx_candidates(
|
|||||||
0, 0, 0 );
|
0, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,12 +556,10 @@ approx_candidates(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !mr ) {
|
if( !mr ) {
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !mr->smr_filter ) {
|
if( !mr->smr_filter ) {
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,12 +568,10 @@ approx_candidates(
|
|||||||
mask,
|
mask,
|
||||||
ava->aa_desc->ad_type->sat_syntax,
|
ava->aa_desc->ad_type->sat_syntax,
|
||||||
mr,
|
mr,
|
||||||
prefix,
|
&prefix,
|
||||||
ava->aa_value,
|
ava->aa_value,
|
||||||
&keys );
|
&keys );
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
if( rc != LDAP_SUCCESS ) {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
|
LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
|
||||||
@ -760,7 +746,7 @@ substring_candidates(
|
|||||||
int rc;
|
int rc;
|
||||||
char *dbname;
|
char *dbname;
|
||||||
slap_mask_t mask;
|
slap_mask_t mask;
|
||||||
struct berval *prefix;
|
struct berval prefix = {0};
|
||||||
struct berval **keys = NULL;
|
struct berval **keys = NULL;
|
||||||
MatchingRule *mr;
|
MatchingRule *mr;
|
||||||
|
|
||||||
@ -801,19 +787,16 @@ substring_candidates(
|
|||||||
0, 0, 0 );
|
0, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
mr = sub->sa_desc->ad_type->sat_substr;
|
mr = sub->sa_desc->ad_type->sat_substr;
|
||||||
|
|
||||||
if( !mr ) {
|
if( !mr ) {
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !mr->smr_filter ) {
|
if( !mr->smr_filter ) {
|
||||||
ber_bvfree( prefix );
|
|
||||||
return idl;
|
return idl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,12 +805,10 @@ substring_candidates(
|
|||||||
mask,
|
mask,
|
||||||
sub->sa_desc->ad_type->sat_syntax,
|
sub->sa_desc->ad_type->sat_syntax,
|
||||||
mr,
|
mr,
|
||||||
prefix,
|
&prefix,
|
||||||
sub,
|
sub,
|
||||||
&keys );
|
&keys );
|
||||||
|
|
||||||
ber_bvfree( prefix );
|
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) {
|
if( rc != LDAP_SUCCESS ) {
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
|
LDAP_LOG(( "filter", LDAP_LEVEL_ERR,
|
||||||
|
@ -19,47 +19,54 @@ static slap_mask_t index_mask(
|
|||||||
Backend *be,
|
Backend *be,
|
||||||
AttributeDescription *desc,
|
AttributeDescription *desc,
|
||||||
char **dbname,
|
char **dbname,
|
||||||
char **atname )
|
struct berval *atname )
|
||||||
{
|
{
|
||||||
AttributeType *at;
|
AttributeType *at;
|
||||||
slap_mask_t mask = 0;
|
slap_mask_t mask = 0;
|
||||||
|
|
||||||
attr_mask( be->be_private, desc->ad_cname.bv_val, &mask );
|
attr_mask( be->be_private, desc, &mask );
|
||||||
|
|
||||||
if( mask ) {
|
if( mask ) {
|
||||||
*atname = desc->ad_cname.bv_val;
|
*atname = desc->ad_cname;
|
||||||
*dbname = desc->ad_cname.bv_val;
|
*dbname = desc->ad_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( slap_ad_is_lang( desc ) ) {
|
/* If there is a language tag, did we ever index the base
|
||||||
|
* type? If so, check for mask, otherwise it's not there.
|
||||||
|
*/
|
||||||
|
if( slap_ad_is_lang( desc ) && desc != desc->ad_type->sat_ad ) {
|
||||||
/* has language tag */
|
/* has language tag */
|
||||||
attr_mask( be->be_private, desc->ad_type->sat_cname, &mask );
|
attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
|
||||||
|
|
||||||
if( mask & SLAP_INDEX_AUTO_LANG ) {
|
if( mask & SLAP_INDEX_AUTO_LANG ) {
|
||||||
*atname = desc->ad_cname.bv_val;
|
*atname = desc->ad_cname;
|
||||||
*dbname = desc->ad_type->sat_cname;
|
*dbname = desc->ad_type->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
if( mask & SLAP_INDEX_LANG ) {
|
if( mask & SLAP_INDEX_LANG ) {
|
||||||
*atname = desc->ad_type->sat_cname;
|
*atname = desc->ad_type->sat_cname;
|
||||||
*dbname = desc->ad_type->sat_cname;
|
*dbname = desc->ad_type->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see if supertype defined mask for its subtypes */
|
/* see if supertype defined mask for its subtypes */
|
||||||
for( at = desc->ad_type; at != NULL ; at = at->sat_sup ) {
|
for( at = desc->ad_type; at != NULL ; at = at->sat_sup ) {
|
||||||
attr_mask( be->be_private, at->sat_cname, &mask );
|
/* If no AD, we've never indexed this type */
|
||||||
|
if (!at->sat_ad)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
attr_mask( be->be_private, at->sat_ad, &mask );
|
||||||
|
|
||||||
if( mask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
if( mask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
||||||
*atname = desc->ad_type->sat_cname;
|
*atname = desc->ad_type->sat_cname;
|
||||||
*dbname = at->sat_cname;
|
*dbname = at->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
if( mask & SLAP_INDEX_SUBTYPES ) {
|
if( mask & SLAP_INDEX_SUBTYPES ) {
|
||||||
*atname = at->sat_cname;
|
*atname = at->sat_cname;
|
||||||
*dbname = at->sat_cname;
|
*dbname = at->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,13 +82,12 @@ int index_param(
|
|||||||
int ftype,
|
int ftype,
|
||||||
char **dbnamep,
|
char **dbnamep,
|
||||||
slap_mask_t *maskp,
|
slap_mask_t *maskp,
|
||||||
struct berval **prefixp )
|
struct berval *prefixp )
|
||||||
{
|
{
|
||||||
slap_mask_t mask;
|
slap_mask_t mask;
|
||||||
char *dbname;
|
char *dbname;
|
||||||
char *atname;
|
|
||||||
|
|
||||||
mask = index_mask( be, desc, &dbname, &atname );
|
mask = index_mask( be, desc, &dbname, prefixp );
|
||||||
|
|
||||||
if( mask == 0 ) {
|
if( mask == 0 ) {
|
||||||
return LDAP_INAPPROPRIATE_MATCHING;
|
return LDAP_INAPPROPRIATE_MATCHING;
|
||||||
@ -120,7 +126,6 @@ int index_param(
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
*dbnamep = dbname;
|
*dbnamep = dbname;
|
||||||
*prefixp = ber_bvstrdup( atname );
|
|
||||||
*maskp = mask;
|
*maskp = mask;
|
||||||
return LDAP_SUCCESS;
|
return LDAP_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -128,7 +133,7 @@ done:
|
|||||||
static int indexer(
|
static int indexer(
|
||||||
Backend *be,
|
Backend *be,
|
||||||
char *dbname,
|
char *dbname,
|
||||||
char *atname,
|
struct berval *atname,
|
||||||
struct berval **vals,
|
struct berval **vals,
|
||||||
ID id,
|
ID id,
|
||||||
int op,
|
int op,
|
||||||
@ -139,17 +144,13 @@ static int indexer(
|
|||||||
DBCache *db;
|
DBCache *db;
|
||||||
AttributeDescription *ad = NULL;
|
AttributeDescription *ad = NULL;
|
||||||
struct berval **keys;
|
struct berval **keys;
|
||||||
struct berval prefix;
|
|
||||||
|
|
||||||
assert( mask );
|
assert( mask );
|
||||||
|
|
||||||
rc = slap_str2ad( atname, &ad, &text );
|
rc = slap_bv2ad( atname, &ad, &text );
|
||||||
|
|
||||||
if( rc != LDAP_SUCCESS ) return rc;
|
if( rc != LDAP_SUCCESS ) return rc;
|
||||||
|
|
||||||
prefix.bv_val = atname;
|
|
||||||
prefix.bv_len = strlen( atname );
|
|
||||||
|
|
||||||
db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
|
db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
|
||||||
|
|
||||||
if ( db == NULL ) {
|
if ( db == NULL ) {
|
||||||
@ -167,7 +168,7 @@ static int indexer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
|
if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
|
||||||
key_change( be, db, &prefix, id, op );
|
key_change( be, db, atname, id, op );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
|
if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
|
||||||
@ -176,7 +177,7 @@ static int indexer(
|
|||||||
mask,
|
mask,
|
||||||
ad->ad_type->sat_syntax,
|
ad->ad_type->sat_syntax,
|
||||||
ad->ad_type->sat_equality,
|
ad->ad_type->sat_equality,
|
||||||
&prefix, vals, &keys );
|
atname, vals, &keys );
|
||||||
|
|
||||||
if( rc == LDAP_SUCCESS && keys != NULL ) {
|
if( rc == LDAP_SUCCESS && keys != NULL ) {
|
||||||
for( i=0; keys[i] != NULL; i++ ) {
|
for( i=0; keys[i] != NULL; i++ ) {
|
||||||
@ -192,7 +193,7 @@ static int indexer(
|
|||||||
mask,
|
mask,
|
||||||
ad->ad_type->sat_syntax,
|
ad->ad_type->sat_syntax,
|
||||||
ad->ad_type->sat_approx,
|
ad->ad_type->sat_approx,
|
||||||
&prefix, vals, &keys );
|
atname, vals, &keys );
|
||||||
|
|
||||||
if( rc == LDAP_SUCCESS && keys != NULL ) {
|
if( rc == LDAP_SUCCESS && keys != NULL ) {
|
||||||
for( i=0; keys[i] != NULL; i++ ) {
|
for( i=0; keys[i] != NULL; i++ ) {
|
||||||
@ -208,7 +209,7 @@ static int indexer(
|
|||||||
mask,
|
mask,
|
||||||
ad->ad_type->sat_syntax,
|
ad->ad_type->sat_syntax,
|
||||||
ad->ad_type->sat_substr,
|
ad->ad_type->sat_substr,
|
||||||
&prefix, vals, &keys );
|
atname, vals, &keys );
|
||||||
|
|
||||||
if( rc == LDAP_SUCCESS && keys != NULL ) {
|
if( rc == LDAP_SUCCESS && keys != NULL ) {
|
||||||
for( i=0; keys[i] != NULL; i++ ) {
|
for( i=0; keys[i] != NULL; i++ ) {
|
||||||
@ -232,7 +233,7 @@ static int index_at_values(
|
|||||||
char ** dbnamep,
|
char ** dbnamep,
|
||||||
slap_mask_t *maskp )
|
slap_mask_t *maskp )
|
||||||
{
|
{
|
||||||
slap_mask_t mask;
|
slap_mask_t mask = 0;
|
||||||
slap_mask_t tmpmask = 0;
|
slap_mask_t tmpmask = 0;
|
||||||
int lindex = 0;
|
int lindex = 0;
|
||||||
|
|
||||||
@ -244,45 +245,57 @@ static int index_at_values(
|
|||||||
dbnamep, &tmpmask );
|
dbnamep, &tmpmask );
|
||||||
}
|
}
|
||||||
|
|
||||||
attr_mask( be->be_private, type->sat_cname, &mask );
|
/* If this type has no AD, we've never used it before */
|
||||||
|
if (type->sat_ad)
|
||||||
|
attr_mask( be->be_private, type->sat_ad, &mask );
|
||||||
|
|
||||||
if( mask ) {
|
if( mask ) {
|
||||||
*dbnamep = type->sat_cname;
|
*dbnamep = type->sat_cname.bv_val;
|
||||||
} else if ( tmpmask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
} else if ( tmpmask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
||||||
mask = tmpmask;
|
mask = tmpmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mask ) {
|
if( mask ) {
|
||||||
indexer( be, *dbnamep,
|
indexer( be, *dbnamep,
|
||||||
type->sat_cname,
|
&type->sat_cname,
|
||||||
vals, id, op,
|
vals, id, op,
|
||||||
mask );
|
mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lang->bv_len ) {
|
if( lang->bv_len ) {
|
||||||
char *dbname = NULL;
|
char *dbname = NULL;
|
||||||
size_t tlen = strlen( type->sat_cname );
|
struct berval lname;
|
||||||
size_t llen = lang->bv_len;
|
AttributeDescription *desc;
|
||||||
char *lname = ch_malloc( tlen + llen + sizeof(";") );
|
|
||||||
|
|
||||||
sprintf( lname, "%s;%s", type->sat_cname, lang->bv_val );
|
tmpmask = 0;
|
||||||
|
lname.bv_val = NULL;
|
||||||
|
|
||||||
attr_mask( be->be_private, lname, &tmpmask );
|
desc = ad_find_lang(type, lang);
|
||||||
|
if (desc)
|
||||||
|
attr_mask( be->be_private, desc, &tmpmask );
|
||||||
|
|
||||||
if( tmpmask ) {
|
if( tmpmask ) {
|
||||||
dbname = lname;
|
dbname = desc->ad_cname.bv_val;
|
||||||
|
lname = desc->ad_cname;
|
||||||
|
mask = tmpmask;
|
||||||
} else if ( mask & SLAP_INDEX_AUTO_LANG ) {
|
} else if ( mask & SLAP_INDEX_AUTO_LANG ) {
|
||||||
dbname = *dbnamep;
|
dbname = *dbnamep;
|
||||||
tmpmask = mask;
|
lname.bv_len = type->sat_cname.bv_len+lang->bv_len + 1;
|
||||||
|
lname.bv_val = ch_malloc( lname.bv_len + 1 );
|
||||||
|
|
||||||
|
strcpy(lname.bv_val, type->sat_cname.bv_val);
|
||||||
|
lname.bv_val[type->sat_cname.bv_len] = ';';
|
||||||
|
strcpy(lname.bv_val+type->sat_cname.bv_len+1,
|
||||||
|
lang->bv_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dbname != NULL ) {
|
if( dbname != NULL ) {
|
||||||
indexer( be, dbname, lname,
|
indexer( be, dbname, &lname,
|
||||||
vals, id, op,
|
vals, id, op,
|
||||||
tmpmask );
|
mask );
|
||||||
|
if (!tmpmask)
|
||||||
|
ch_free( lname.bv_val );
|
||||||
}
|
}
|
||||||
|
|
||||||
ch_free( lname );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return LDAP_SUCCESS;
|
return LDAP_SUCCESS;
|
||||||
|
@ -34,7 +34,7 @@ Entry *deref_internal_r LDAP_P((
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void attr_mask LDAP_P(( struct ldbminfo *li,
|
void attr_mask LDAP_P(( struct ldbminfo *li,
|
||||||
const char *desc,
|
AttributeDescription *desc,
|
||||||
slap_mask_t *indexmask ));
|
slap_mask_t *indexmask ));
|
||||||
|
|
||||||
int attr_index_config LDAP_P(( struct ldbminfo *li,
|
int attr_index_config LDAP_P(( struct ldbminfo *li,
|
||||||
@ -146,7 +146,7 @@ index_param LDAP_P((
|
|||||||
int ftype,
|
int ftype,
|
||||||
char **dbname,
|
char **dbname,
|
||||||
slap_mask_t *mask,
|
slap_mask_t *mask,
|
||||||
struct berval **prefix ));
|
struct berval *prefix ));
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
index_values LDAP_P((
|
index_values LDAP_P((
|
||||||
|
@ -725,13 +725,13 @@ meta_send_entry(
|
|||||||
"[rw] searchResult on"
|
"[rw] searchResult on"
|
||||||
" attr=%s:"
|
" attr=%s:"
|
||||||
" \"%s\" -> \"%s\"\n",
|
" \"%s\" -> \"%s\"\n",
|
||||||
attr->a_desc->ad_type->sat_cname,
|
attr->a_desc->ad_type->sat_cname.bv_val,
|
||||||
bv->bv_val, newval ));
|
bv->bv_val, newval ));
|
||||||
#else /* !NEW_LOGGING */
|
#else /* !NEW_LOGGING */
|
||||||
Debug( LDAP_DEBUG_ARGS,
|
Debug( LDAP_DEBUG_ARGS,
|
||||||
"rw> searchResult on attr=%s:"
|
"rw> searchResult on attr=%s:"
|
||||||
" \"%s\" -> \"%s\"\n",
|
" \"%s\" -> \"%s\"\n",
|
||||||
attr->a_desc->ad_type->sat_cname,
|
attr->a_desc->ad_type->sat_cname.bv_val,
|
||||||
bv->bv_val, newval );
|
bv->bv_val, newval );
|
||||||
#endif /* !NEW_LOGGING */
|
#endif /* !NEW_LOGGING */
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ oc_check_required( Entry *e, struct berval *ocname )
|
|||||||
}
|
}
|
||||||
/* not there => schema violation */
|
/* not there => schema violation */
|
||||||
if ( a == NULL ) {
|
if ( a == NULL ) {
|
||||||
return at->sat_cname;
|
return at->sat_cname.bv_val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,15 +218,15 @@ int oc_check_allowed(
|
|||||||
|
|
||||||
#ifdef NEW_LOGGING
|
#ifdef NEW_LOGGING
|
||||||
LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
|
LDAP_LOG(( "schema", LDAP_LEVEL_ENTRY,
|
||||||
"oc_check_allowed: type \"%s\"\n", at->sat_cname ));
|
"oc_check_allowed: type \"%s\"\n", at->sat_cname.bv_val ));
|
||||||
#else
|
#else
|
||||||
Debug( LDAP_DEBUG_TRACE,
|
Debug( LDAP_DEBUG_TRACE,
|
||||||
"oc_check_allowed type \"%s\"\n",
|
"oc_check_allowed type \"%s\"\n",
|
||||||
at->sat_cname, 0, 0 );
|
at->sat_cname.bv_val, 0, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* always allow objectClass attribute */
|
/* always allow objectClass attribute */
|
||||||
if ( strcasecmp( at->sat_cname, "objectClass" ) == 0 ) {
|
if ( strcasecmp( at->sat_cname.bv_val, "objectClass" ) == 0 ) {
|
||||||
return LDAP_SUCCESS;
|
return LDAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ struct slap_attr_desc;
|
|||||||
|
|
||||||
typedef struct slap_attribute_type {
|
typedef struct slap_attribute_type {
|
||||||
LDAPAttributeType sat_atype;
|
LDAPAttributeType sat_atype;
|
||||||
char *sat_cname;
|
struct berval sat_cname;
|
||||||
struct slap_attribute_type *sat_sup;
|
struct slap_attribute_type *sat_sup;
|
||||||
struct slap_attribute_type **sat_subtypes;
|
struct slap_attribute_type **sat_subtypes;
|
||||||
MatchingRule *sat_equality;
|
MatchingRule *sat_equality;
|
||||||
|
Loading…
Reference in New Issue
Block a user