From: Pierangelo Masarati Date: Fri, 9 Jan 2004 11:43:00 +0000 (+0000) Subject: honor objectclass inheritance in filters + some cleanup X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~54 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=354d8a183cce8d4d9b345538fc044d0ee44d6591;p=openldap honor objectclass inheritance in filters + some cleanup --- diff --git a/servers/slapd/back-sql/entry-id.c b/servers/slapd/back-sql/entry-id.c index 7a8c839ed8..bdb58b986c 100644 --- a/servers/slapd/back-sql/entry-id.c +++ b/servers/slapd/back-sql/entry-id.c @@ -279,7 +279,7 @@ backsql_get_attr_vals( void *v_at, void *v_bsi ) { backsql_at_map_rec *at = v_at; backsql_srch_info *bsi = v_bsi; - backsql_info *bi = (backsql_info *)bsi->op->o_bd->be_private; + backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private; RETCODE rc; SQLHSTMT sth; BACKSQL_ROW_NTS row; @@ -290,18 +290,18 @@ backsql_get_attr_vals( void *v_at, void *v_bsi ) Debug( LDAP_DEBUG_TRACE, "==>backsql_get_attr_vals(): " "oc='%s' attr='%s' keyval=%ld\n", - BACKSQL_OC_NAME( bsi->oc ), at->ad->ad_cname.bv_val, - bsi->c_eid->keyval ); + BACKSQL_OC_NAME( bsi->bsi_oc ), at->ad->ad_cname.bv_val, + bsi->bsi_c_eid->keyval ); - rc = backsql_Prepare( bsi->dbh, &sth, at->query, 0 ); + rc = backsql_Prepare( bsi->bsi_dbh, &sth, at->query, 0 ); if ( rc != SQL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_get_attr_values(): " "error preparing query: %s\n", at->query, 0, 0 ); - backsql_PrintErrors( bi->db_env, bsi->dbh, sth, rc ); + backsql_PrintErrors( bi->db_env, bsi->bsi_dbh, sth, rc ); return 1; } - rc = backsql_BindParamID( sth, 1, &bsi->c_eid->keyval ); + rc = backsql_BindParamID( sth, 1, &bsi->bsi_c_eid->keyval ); if ( rc != SQL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_get_attr_values(): " "error binding key value parameter\n", 0, 0, 0 ); @@ -313,7 +313,7 @@ backsql_get_attr_vals( void *v_at, void *v_bsi ) Debug( LDAP_DEBUG_TRACE, "backsql_get_attr_values(): " "error executing attribute query '%s'\n", at->query, 0, 0 ); - backsql_PrintErrors( bi->db_env, bsi->dbh, sth, rc ); + backsql_PrintErrors( bi->db_env, bsi->bsi_dbh, sth, rc ); SQLFreeStmt( sth, SQL_DROP ); return 1; } @@ -336,9 +336,9 @@ backsql_get_attr_vals( void *v_at, void *v_bsi ) */ bv.bv_len = strlen( row.cols[ i ] ); #endif - backsql_entry_addattr( bsi->e, + backsql_entry_addattr( bsi->bsi_e, &row.col_names[ i ], &bv, - bsi->op->o_tmpmemctx ); + bsi->bsi_op->o_tmpmemctx ); #ifdef BACKSQL_TRACE Debug( LDAP_DEBUG_TRACE, "prec=%d\n", @@ -370,30 +370,30 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) Debug( LDAP_DEBUG_TRACE, "==>backsql_id2entry()\n", 0, 0, 0 ); rc = dnPrettyNormal( NULL, &eid->dn, &e->e_name, &e->e_nname, - bsi->op->o_tmpmemctx ); + bsi->bsi_op->o_tmpmemctx ); if ( rc != LDAP_SUCCESS ) { return NULL; } - bsi->oc = backsql_id2oc( bsi->op->o_bd->be_private, eid->oc_id ); - bsi->e = e; - bsi->c_eid = eid; + bsi->bsi_oc = backsql_id2oc( bsi->bsi_op->o_bd->be_private, eid->oc_id ); + bsi->bsi_e = e; + bsi->bsi_c_eid = eid; e->e_attrs = NULL; e->e_private = NULL; e->e_id = eid->id; - if ( bsi->attrs != NULL ) { + if ( bsi->bsi_attrs != NULL ) { Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): " "custom attribute list\n", 0, 0, 0 ); - for ( i = 0; bsi->attrs[ i ].an_name.bv_val; i++ ) { - AttributeName *attr = &bsi->attrs[ i ]; + for ( i = 0; bsi->bsi_attrs[ i ].an_name.bv_val; i++ ) { + AttributeName *attr = &bsi->bsi_attrs[ i ]; if ( attr->an_desc == ad_oc ) { continue; } - at = backsql_ad2at( bsi->oc, attr->an_desc ); + at = backsql_ad2at( bsi->bsi_oc, attr->an_desc ); if ( at != NULL ) { backsql_get_attr_vals( at, bsi ); } else { @@ -401,19 +401,20 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) "attribute '%s' is not defined " "for objectlass '%s'\n", attr->an_name.bv_val, - BACKSQL_OC_NAME( bsi->oc ), 0 ); + BACKSQL_OC_NAME( bsi->bsi_oc ), 0 ); } } } else { Debug( LDAP_DEBUG_TRACE, "backsql_id2entry(): " "retrieving all attributes\n", 0, 0, 0 ); - avl_apply( bsi->oc->attrs, backsql_get_attr_vals, + avl_apply( bsi->bsi_oc->attrs, backsql_get_attr_vals, bsi, 0, AVL_INORDER ); } - if ( attr_merge_normalize_one( bsi->e, ad_oc, &bsi->oc->oc->soc_cname, - bsi->op->o_tmpmemctx ) ) { + if ( attr_merge_normalize_one( bsi->bsi_e, ad_oc, + &bsi->bsi_oc->oc->soc_cname, + bsi->bsi_op->o_tmpmemctx ) ) { entry_free( e ); return NULL; } @@ -426,7 +427,7 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) struct berval soc; int rc; - bv[ 0 ] = bsi->oc->oc->soc_cname; + bv[ 0 ] = bsi->bsi_oc->oc->soc_cname; bv[ 1 ].bv_val = NULL; rc = structural_class( bv, &soc, NULL, @@ -437,10 +438,10 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) } if ( ( bsi->bsi_flags | BSQL_SF_ALL_OPER ) - || an_find( bsi->attrs, &AllOper ) ) { - rc = attr_merge_normalize_one( bsi->e, + || an_find( bsi->bsi_attrs, &AllOper ) ) { + rc = attr_merge_normalize_one( bsi->bsi_e, slap_schema.si_ad_structuralObjectClass, - &soc, bsi->op->o_tmpmemctx ); + &soc, bsi->bsi_op->o_tmpmemctx ); if ( rc != LDAP_SUCCESS ) { entry_free( e ); return NULL; diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index e39f3c7792..964f7d26da 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -45,7 +45,7 @@ backsql_attrlist_add( backsql_srch_info *bsi, AttributeDescription *ad ) int n_attrs = 0; AttributeName *an = NULL; - if ( bsi->attrs == NULL ) { + if ( bsi->bsi_attrs == NULL ) { return 1; } @@ -53,13 +53,13 @@ backsql_attrlist_add( backsql_srch_info *bsi, AttributeDescription *ad ) * clear the list (retrieve all attrs) */ if ( ad == NULL ) { - ch_free( bsi->attrs ); - bsi->attrs = NULL; + ch_free( bsi->bsi_attrs ); + bsi->bsi_attrs = NULL; return 1; } - for ( ; bsi->attrs[ n_attrs ].an_name.bv_val; n_attrs++ ) { - an = &bsi->attrs[ n_attrs ]; + for ( ; bsi->bsi_attrs[ n_attrs ].an_name.bv_val; n_attrs++ ) { + an = &bsi->bsi_attrs[ n_attrs ]; Debug( LDAP_DEBUG_TRACE, "==>backsql_attrlist_add(): " "attribute '%s' is in list\n", @@ -76,7 +76,7 @@ backsql_attrlist_add( backsql_srch_info *bsi, AttributeDescription *ad ) Debug( LDAP_DEBUG_TRACE, "==>backsql_attrlist_add(): " "adding '%s' to list\n", ad->ad_cname.bv_val, 0, 0 ); - an = (AttributeName *)ch_realloc( bsi->attrs, + an = (AttributeName *)ch_realloc( bsi->bsi_attrs, sizeof( AttributeName ) * ( n_attrs + 2 ) ); if ( an == NULL ) { return -1; @@ -87,7 +87,7 @@ backsql_attrlist_add( backsql_srch_info *bsi, AttributeDescription *ad ) an[ n_attrs + 1 ].an_name.bv_val = NULL; an[ n_attrs + 1 ].an_name.bv_len = 0; - bsi->attrs = an; + bsi->bsi_attrs = an; return 1; } @@ -107,26 +107,26 @@ backsql_init_search( { AttributeName *p; - bsi->base_dn = base; - bsi->scope = scope; - bsi->slimit = slimit; - bsi->tlimit = tlimit; - bsi->filter = filter; - bsi->dbh = dbh; - bsi->op = op; + bsi->bsi_base_dn = base; + bsi->bsi_scope = scope; + bsi->bsi_slimit = slimit; + bsi->bsi_tlimit = tlimit; + bsi->bsi_filter = filter; + bsi->bsi_dbh = dbh; + bsi->bsi_op = op; bsi->bsi_flags = 0; /* * handle "*" */ if ( attrs == NULL || an_find( attrs, &AllUser ) ) { - bsi->attrs = NULL; + bsi->bsi_attrs = NULL; } else { - bsi->attrs = (AttributeName *)ch_calloc( 1, + bsi->bsi_attrs = (AttributeName *)ch_calloc( 1, sizeof( AttributeName ) ); - bsi->attrs[ 0 ].an_name.bv_val = NULL; - bsi->attrs[ 0 ].an_name.bv_len = 0; + bsi->bsi_attrs[ 0 ].an_name.bv_val = NULL; + bsi->bsi_attrs[ 0 ].an_name.bv_len = 0; for ( p = attrs; p->an_name.bv_val; p++ ) { /* @@ -144,24 +144,25 @@ backsql_init_search( } } - bsi->abandon = 0; - bsi->id_list = NULL; - bsi->n_candidates = 0; - bsi->stoptime = stoptime; - bsi->sel.bb_val.bv_val = NULL; - bsi->sel.bb_val.bv_len = 0; - bsi->sel.bb_len = 0; - bsi->from.bb_val.bv_val = NULL; - bsi->from.bb_val.bv_len = 0; - bsi->from.bb_len = 0; - bsi->join_where.bb_val.bv_val = NULL; - bsi->join_where.bb_val.bv_len = 0; - bsi->join_where.bb_len = 0; - bsi->flt_where.bb_val.bv_val = NULL; - bsi->flt_where.bb_val.bv_len = 0; - bsi->flt_where.bb_len = 0; - - bsi->status = LDAP_SUCCESS; + bsi->bsi_abandon = 0; + bsi->bsi_id_list = NULL; + bsi->bsi_n_candidates = 0; + bsi->bsi_stoptime = stoptime; + bsi->bsi_sel.bb_val.bv_val = NULL; + bsi->bsi_sel.bb_val.bv_len = 0; + bsi->bsi_sel.bb_len = 0; + bsi->bsi_from.bb_val.bv_val = NULL; + bsi->bsi_from.bb_val.bv_len = 0; + bsi->bsi_from.bb_len = 0; + bsi->bsi_join_where.bb_val.bv_val = NULL; + bsi->bsi_join_where.bb_val.bv_len = 0; + bsi->bsi_join_where.bb_len = 0; + bsi->bsi_flt_where.bb_val.bv_val = NULL; + bsi->bsi_flt_where.bb_val.bv_len = 0; + bsi->bsi_flt_where.bb_len = 0; + bsi->bsi_filter_oc = NULL; + + bsi->bsi_status = LDAP_SUCCESS; } static int @@ -173,7 +174,7 @@ backsql_process_filter_list( backsql_srch_info *bsi, Filter *f, int op ) return 0; } - backsql_strfcat( &bsi->flt_where, "c", '(' /* ) */ ); + backsql_strfcat( &bsi->bsi_flt_where, "c", '(' /* ) */ ); while ( 1 ) { res = backsql_process_filter( bsi, f ); @@ -192,20 +193,20 @@ backsql_process_filter_list( backsql_srch_info *bsi, Filter *f, int op ) switch ( op ) { case LDAP_FILTER_AND: - backsql_strfcat( &bsi->flt_where, "l", + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( " AND " ) - 1, " AND " ); break; case LDAP_FILTER_OR: - backsql_strfcat( &bsi->flt_where, "l", + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( " OR " ) - 1, " OR " ); break; } } - backsql_strfcat( &bsi->flt_where, "c", /* ( */ ')' ); + backsql_strfcat( &bsi->bsi_flt_where, "c", /* ( */ ')' ); return 1; } @@ -215,7 +216,7 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) { int i; backsql_at_map_rec *at; - backsql_info *bi = (backsql_info *)bsi->op->o_bd->be_private; + backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private; int casefold = 0; if ( !f ) { @@ -227,7 +228,7 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) casefold = 1; } - at = backsql_ad2at( bsi->oc, f->f_sub_desc ); + at = backsql_ad2at( bsi->bsi_oc, f->f_sub_desc ); assert( at ); @@ -237,7 +238,7 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) * SQL filters are more liberal. */ - backsql_strfcat( &bsi->flt_where, "c", '(' /* ) */ ); + backsql_strfcat( &bsi->bsi_flt_where, "c", '(' /* ) */ ); /* TimesTen */ Debug( LDAP_DEBUG_TRACE, "expr: '%s' '%s'\n", at->sel_expr.bv_val, @@ -247,13 +248,13 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) * If a pre-upper-cased version of the column exists, use it */ if ( at->sel_expr_u.bv_val ) { - backsql_strfcat( &bsi->flt_where, + backsql_strfcat( &bsi->bsi_flt_where, "bl", &at->sel_expr_u, (ber_len_t)sizeof( " LIKE '" ) - 1, " LIKE '" ); } else { - backsql_strfcat( &bsi->flt_where, + backsql_strfcat( &bsi->bsi_flt_where, "bcbcl", &bi->upper_func, '(', @@ -263,7 +264,7 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) " LIKE '" ); } } else { - backsql_strfcat( &bsi->flt_where, "bl", + backsql_strfcat( &bsi->bsi_flt_where, "bl", &at->sel_expr, (ber_len_t)sizeof( " LIKE '" ) - 1, " LIKE '" ); } @@ -271,15 +272,15 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) if ( f->f_sub_initial.bv_val != NULL ) { size_t start; - start = bsi->flt_where.bb_val.bv_len; - backsql_strfcat( &bsi->flt_where, "b", + start = bsi->bsi_flt_where.bb_val.bv_len; + backsql_strfcat( &bsi->bsi_flt_where, "b", &f->f_sub_initial ); if ( casefold && bi->upper_func.bv_val ) { - ldap_pvt_str2upper( &bsi->flt_where.bb_val.bv_val[ start ] ); + ldap_pvt_str2upper( &bsi->bsi_flt_where.bb_val.bv_val[ start ] ); } } - backsql_strfcat( &bsi->flt_where, "c", '%' ); + backsql_strfcat( &bsi->bsi_flt_where, "c", '%' ); if ( f->f_sub_any != NULL ) { for ( i = 0; f->f_sub_any[ i ].bv_val != NULL; i++ ) { @@ -292,8 +293,8 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) 0, 0 ); #endif /* BACKSQL_TRACE */ - start = bsi->flt_where.bb_val.bv_len; - backsql_strfcat( &bsi->flt_where, + start = bsi->bsi_flt_where.bb_val.bv_len; + backsql_strfcat( &bsi->bsi_flt_where, "bc", &f->f_sub_any[ i ], '%' ); @@ -301,23 +302,23 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) /* * Note: toupper('%') = '%' */ - ldap_pvt_str2upper( &bsi->flt_where.bb_val.bv_val[ start ] ); + ldap_pvt_str2upper( &bsi->bsi_flt_where.bb_val.bv_val[ start ] ); } } if ( f->f_sub_final.bv_val != NULL ) { size_t start; - start = bsi->flt_where.bb_val.bv_len; - backsql_strfcat( &bsi->flt_where, "b", + start = bsi->bsi_flt_where.bb_val.bv_len; + backsql_strfcat( &bsi->bsi_flt_where, "b", &f->f_sub_final ); if ( casefold && bi->upper_func.bv_val ) { - ldap_pvt_str2upper( &bsi->flt_where.bb_val.bv_val[ start ] ); + ldap_pvt_str2upper( &bsi->bsi_flt_where.bb_val.bv_val[ start ] ); } } } - backsql_strfcat( &bsi->flt_where, "l", + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( /* (' */ "')" ) - 1, /* ( */ "')" ); return 1; @@ -326,7 +327,7 @@ backsql_process_sub_filter( backsql_srch_info *bsi, Filter *f ) static int backsql_process_filter( backsql_srch_info *bsi, Filter *f ) { - backsql_info *bi = (backsql_info *)bsi->op->o_bd->be_private; + backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private; backsql_at_map_rec *at; backsql_at_map_rec oc_attr = { slap_schema.si_ad_objectClass, BER_BVC(""), BER_BVC(""), @@ -358,11 +359,11 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f ) break; case LDAP_FILTER_NOT: - backsql_strfcat( &bsi->flt_where, "l", + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( "NOT (" /* ) */ ) - 1, "NOT (" /* ) */ ); rc = backsql_process_filter( bsi, f->f_not ); - backsql_strfcat( &bsi->flt_where, "c", /* ( */ ')' ); + backsql_strfcat( &bsi->bsi_flt_where, "c", /* ( */ ')' ); done = 1; break; @@ -397,7 +398,7 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f ) at = &oc_attr; backsql_strfcat( &bb, "cbc", '\'', - &bsi->oc->oc->soc_cname, + &bsi->bsi_oc->oc->soc_cname, '\'' ); at->sel_expr = bb.bb_val; @@ -416,7 +417,7 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f ) * selecting if there are descendants of the * candidate. */ - backsql_strfcat( &bsi->flt_where, "l", + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( "1=1" ) - 1, "1=1" ); if ( ad == slap_schema.si_ad_hasSubordinates ) { /* @@ -436,28 +437,29 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f ) goto done; } else { - at = backsql_ad2at( bsi->oc, ad ); + at = backsql_ad2at( bsi->bsi_oc, ad ); } if ( at == NULL ) { Debug( LDAP_DEBUG_TRACE, "backsql_process_filter(): " "attribute '%s' is not defined for objectclass '%s'\n", - ad->ad_cname.bv_val, BACKSQL_OC_NAME( bsi->oc ), 0 ); - backsql_strfcat( &bsi->flt_where, "l", + ad->ad_cname.bv_val, BACKSQL_OC_NAME( bsi->bsi_oc ), 0 ); + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( "1=0" ) - 1, "1=0" ); + bsi->bsi_status = LDAP_UNDEFINED_TYPE; goto impossible; } - backsql_merge_from_clause( &bsi->from, &at->from_tbls ); + backsql_merge_from_clause( &bsi->bsi_from, &at->from_tbls ); /* * need to add this attribute to list of attrs to load, - * so that we could do test_filter() later + * so that we can do test_filter() later */ backsql_attrlist_add( bsi, ad ); if ( at->join_where.bv_val != NULL - && strstr( bsi->join_where.bb_val.bv_val, at->join_where.bv_val ) == NULL ) { - backsql_strfcat( &bsi->join_where, "lb", + && strstr( bsi->bsi_join_where.bb_val.bv_val, at->join_where.bv_val ) == NULL ) { + backsql_strfcat( &bsi->bsi_join_where, "lb", (ber_len_t)sizeof( " AND " ) - 1, " AND ", &at->join_where ); } @@ -484,6 +486,26 @@ equality_match:; casefold = 1; } + /* + * objectClass inheritance: + * - a search for "person" will also return "inetOrgPerson" + * - a search for "top" will return everything + */ + if ( at == &oc_attr ) { + ObjectClass *oc = oc_bvfind( filter_value ); + + rc = is_object_subclass( oc, bsi->bsi_oc->oc ); + if ( rc ) { + backsql_strfcat( &bsi->bsi_flt_where, "l", + sizeof( "(1=1)" ) - 1, "(1=1)" ); + break; + + } else { + rc = -1; + goto impossible; + } + } + /* * maybe we should check type of at->sel_expr here somehow, * to know whether upper_func is applicable, but for now @@ -494,13 +516,13 @@ equality_match:; size_t start; if ( at->sel_expr_u.bv_val ) { - backsql_strfcat( &bsi->flt_where, "cbl", - '(', + backsql_strfcat( &bsi->bsi_flt_where, "cbl", + '(', /* ) */ &at->sel_expr_u, (ber_len_t)sizeof( "='" ) - 1, "='" ); } else { - backsql_strfcat( &bsi->flt_where, "cbcbl", + backsql_strfcat( &bsi->bsi_flt_where, "cbcbl", '(' /* ) */ , &bi->upper_func, '(' /* ) */ , @@ -509,17 +531,17 @@ equality_match:; /* ( */ ")='" ); } - start = bsi->flt_where.bb_val.bv_len; + start = bsi->bsi_flt_where.bb_val.bv_len; - backsql_strfcat( &bsi->flt_where, "bl", + backsql_strfcat( &bsi->bsi_flt_where, "bl", filter_value, (ber_len_t)sizeof( /* (' */ "')" ) - 1, /* (' */ "')" ); - ldap_pvt_str2upper( &bsi->flt_where.bb_val.bv_val[ start ] ); + ldap_pvt_str2upper( &bsi->bsi_flt_where.bb_val.bv_val[ start ] ); } else { - backsql_strfcat( &bsi->flt_where, "cblbl", + backsql_strfcat( &bsi->bsi_flt_where, "cblbl", '(', &at->sel_expr, (ber_len_t)sizeof( "='" ) - 1, "='", @@ -547,13 +569,13 @@ equality_match:; size_t start; if ( at->sel_expr_u.bv_val ) { - backsql_strfcat( &bsi->flt_where, "cbbc", + backsql_strfcat( &bsi->bsi_flt_where, "cbbc", '(', &at->sel_expr_u, &ordering, '\'' ); } else { - backsql_strfcat( &bsi->flt_where, "cbcbcbc", + backsql_strfcat( &bsi->bsi_flt_where, "cbcbcbc", '(' /* ) */ , &bi->upper_func, '(' /* ) */ , @@ -563,17 +585,17 @@ equality_match:; '\'' ); } - start = bsi->flt_where.bb_val.bv_len; + start = bsi->bsi_flt_where.bb_val.bv_len; - backsql_strfcat( &bsi->flt_where, "bl", + backsql_strfcat( &bsi->bsi_flt_where, "bl", filter_value, (ber_len_t)sizeof( /* (' */ "')" ) - 1, /* (' */ "')" ); - ldap_pvt_str2upper( &bsi->flt_where.bb_val.bv_val[ start ] ); + ldap_pvt_str2upper( &bsi->bsi_flt_where.bb_val.bv_val[ start ] ); } else { - backsql_strfcat( &bsi->flt_where, "cbbcbl", + backsql_strfcat( &bsi->bsi_flt_where, "cbbcbl", '(' /* ) */ , &at->sel_expr, &ordering, @@ -585,10 +607,12 @@ equality_match:; break; case LDAP_FILTER_PRESENT: - backsql_strfcat( &bsi->flt_where, "lbl", - (ber_len_t)sizeof( "NOT (" ) - 1, "NOT (", + backsql_strfcat( &bsi->bsi_flt_where, "lbl", + (ber_len_t)sizeof( "NOT (" /* ) */) - 1, + "NOT (", /* ) */ &at->sel_expr, - (ber_len_t)sizeof( " IS NULL)" ) - 1, " IS NULL)" ); + (ber_len_t)sizeof( /* ( */ " IS NULL)" ) - 1, + /* ( */ " IS NULL)" ); break; case LDAP_FILTER_SUBSTRINGS: @@ -608,13 +632,13 @@ equality_match:; size_t start; if ( at->sel_expr_u.bv_val ) { - backsql_strfcat( &bsi->flt_where, "cbl", - '(', + backsql_strfcat( &bsi->bsi_flt_where, "cbl", + '(', /* ) */ &at->sel_expr_u, (ber_len_t)sizeof( " LIKE '%" ) - 1, " LIKE '%" ); } else { - backsql_strfcat( &bsi->flt_where, "cbcbl", + backsql_strfcat( &bsi->bsi_flt_where, "cbcbl", '(' /* ) */ , &bi->upper_func, '(' /* ) */ , @@ -623,18 +647,18 @@ equality_match:; /* ( */ ") LIKE '%" ); } - start = bsi->flt_where.bb_val.bv_len; + start = bsi->bsi_flt_where.bb_val.bv_len; - backsql_strfcat( &bsi->flt_where, "bl", + backsql_strfcat( &bsi->bsi_flt_where, "bl", &f->f_av_value, (ber_len_t)sizeof( /* (' */ "%')" ) - 1, /* (' */ "%')" ); - ldap_pvt_str2upper( &bsi->flt_where.bb_val.bv_val[ start ] ); + ldap_pvt_str2upper( &bsi->bsi_flt_where.bb_val.bv_val[ start ] ); } else { - backsql_strfcat( &bsi->flt_where, "cblbl", - '(', + backsql_strfcat( &bsi->bsi_flt_where, "cblbl", + '(', /* ) */ &at->sel_expr, (ber_len_t)sizeof( " LIKE '%" ) - 1, " LIKE '%", @@ -647,7 +671,7 @@ equality_match:; default: /* unhandled filter type; should not happen */ assert( 0 ); - backsql_strfcat( &bsi->flt_where, "l", + backsql_strfcat( &bsi->bsi_flt_where, "l", (ber_len_t)sizeof( "1=1" ) - 1, "1=1" ); break; @@ -673,7 +697,7 @@ impossible: static int backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) { - backsql_info *bi = (backsql_info *)bsi->op->o_bd->be_private; + backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private; int rc; assert( query ); @@ -681,62 +705,62 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) query->bv_len = 0; Debug( LDAP_DEBUG_TRACE, "==>backsql_srch_query()\n", 0, 0, 0 ); - bsi->sel.bb_val.bv_val = NULL; - bsi->sel.bb_val.bv_len = 0; - bsi->sel.bb_len = 0; - bsi->from.bb_val.bv_val = NULL; - bsi->from.bb_val.bv_len = 0; - bsi->from.bb_len = 0; - bsi->join_where.bb_val.bv_val = NULL; - bsi->join_where.bb_val.bv_len = 0; - bsi->join_where.bb_len = 0; - bsi->flt_where.bb_val.bv_val = NULL; - bsi->flt_where.bb_val.bv_len = 0; - bsi->flt_where.bb_len = 0; - - backsql_strfcat( &bsi->sel, "lbcbc", + bsi->bsi_sel.bb_val.bv_val = NULL; + bsi->bsi_sel.bb_val.bv_len = 0; + bsi->bsi_sel.bb_len = 0; + bsi->bsi_from.bb_val.bv_val = NULL; + bsi->bsi_from.bb_val.bv_len = 0; + bsi->bsi_from.bb_len = 0; + bsi->bsi_join_where.bb_val.bv_val = NULL; + bsi->bsi_join_where.bb_val.bv_len = 0; + bsi->bsi_join_where.bb_len = 0; + bsi->bsi_flt_where.bb_val.bv_val = NULL; + bsi->bsi_flt_where.bb_val.bv_len = 0; + bsi->bsi_flt_where.bb_len = 0; + + backsql_strfcat( &bsi->bsi_sel, "lbcbc", (ber_len_t)sizeof( "SELECT DISTINCT ldap_entries.id," ) - 1, "SELECT DISTINCT ldap_entries.id,", - &bsi->oc->keytbl, + &bsi->bsi_oc->keytbl, '.', - &bsi->oc->keycol, + &bsi->bsi_oc->keycol, ',' ); if ( bi->strcast_func.bv_val ) { - backsql_strfcat( &bsi->sel, "blbl", + backsql_strfcat( &bsi->bsi_sel, "blbl", &bi->strcast_func, (ber_len_t)sizeof( "('" /* ') */ ) - 1, "('" /* ') */ , - &bsi->oc->oc->soc_cname, + &bsi->bsi_oc->oc->soc_cname, (ber_len_t)sizeof( /* (' */ "')" ) - 1, /* (' */ "')" ); } else { - backsql_strfcat( &bsi->sel, "cbc", + backsql_strfcat( &bsi->bsi_sel, "cbc", '\'', - &bsi->oc->oc->soc_cname, + &bsi->bsi_oc->oc->soc_cname, '\'' ); } - backsql_strfcat( &bsi->sel, "l", + backsql_strfcat( &bsi->bsi_sel, "l", (ber_len_t)sizeof( " AS objectClass,ldap_entries.dn AS dn" ) - 1, " AS objectClass,ldap_entries.dn AS dn" ); - backsql_strfcat( &bsi->from, "lb", + backsql_strfcat( &bsi->bsi_from, "lb", (ber_len_t)sizeof( " FROM ldap_entries," ) - 1, " FROM ldap_entries,", - &bsi->oc->keytbl ); + &bsi->bsi_oc->keytbl ); - backsql_strfcat( &bsi->join_where, "lbcbl", + backsql_strfcat( &bsi->bsi_join_where, "lbcbl", (ber_len_t)sizeof( " WHERE " ) - 1, " WHERE ", - &bsi->oc->keytbl, + &bsi->bsi_oc->keytbl, '.', - &bsi->oc->keycol, + &bsi->bsi_oc->keycol, (ber_len_t)sizeof( "=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND " ) - 1, "=ldap_entries.keyval AND ldap_entries.oc_map_id=? AND " ); - switch ( bsi->scope ) { + switch ( bsi->bsi_scope ) { case LDAP_SCOPE_BASE: if ( bi->upper_func.bv_val ) { - backsql_strfcat( &bsi->join_where, "blbcb", + backsql_strfcat( &bsi->bsi_join_where, "blbcb", &bi->upper_func, (ber_len_t)sizeof( "(ldap_entries.dn)=" ) - 1, "(ldap_entries.dn)=", @@ -744,21 +768,21 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) '?', &bi->upper_func_close ); } else { - backsql_strfcat( &bsi->join_where, "l", + backsql_strfcat( &bsi->bsi_join_where, "l", (ber_len_t)sizeof( "ldap_entries.dn=?" ) - 1, "ldap_entries.dn=?" ); } break; case LDAP_SCOPE_ONELEVEL: - backsql_strfcat( &bsi->join_where, "l", + backsql_strfcat( &bsi->bsi_join_where, "l", (ber_len_t)sizeof( "ldap_entries.parent=?" ) - 1, "ldap_entries.parent=?" ); break; case LDAP_SCOPE_SUBTREE: if ( bi->upper_func.bv_val ) { - backsql_strfcat( &bsi->join_where, "blbcb", + backsql_strfcat( &bsi->bsi_join_where, "blbcb", &bi->upper_func, (ber_len_t)sizeof( "(ldap_entries.dn) LIKE " ) - 1, "(ldap_entries.dn) LIKE ", @@ -766,7 +790,7 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) '?', &bi->upper_func_close ); } else { - backsql_strfcat( &bsi->join_where, "l", + backsql_strfcat( &bsi->bsi_join_where, "l", (ber_len_t)sizeof( "ldap_entries.dn LIKE ?" ) - 1, "ldap_entries.dn LIKE ?" ); } @@ -777,16 +801,16 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) assert( 0 ); } - rc = backsql_process_filter( bsi, bsi->filter ); + rc = backsql_process_filter( bsi, bsi->bsi_filter ); if ( rc > 0 ) { struct berbuf bb = BB_NULL; backsql_strfcat( &bb, "bbblb", - &bsi->sel.bb_val, - &bsi->from.bb_val, - &bsi->join_where.bb_val, + &bsi->bsi_sel.bb_val, + &bsi->bsi_from.bb_val, + &bsi->bsi_join_where.bb_val, (ber_len_t)sizeof( " AND " ) - 1, " AND ", - &bsi->flt_where.bb_val ); + &bsi->bsi_flt_where.bb_val ); *query = bb.bb_val; @@ -799,18 +823,18 @@ backsql_srch_query( backsql_srch_info *bsi, struct berval *query ) query->bv_val = NULL; } - free( bsi->sel.bb_val.bv_val ); - bsi->sel.bb_val.bv_len = 0; - bsi->sel.bb_len = 0; - free( bsi->from.bb_val.bv_val ); - bsi->from.bb_val.bv_len = 0; - bsi->from.bb_len = 0; - free( bsi->join_where.bb_val.bv_val ); - bsi->join_where.bb_val.bv_len = 0; - bsi->join_where.bb_len = 0; - free( bsi->flt_where.bb_val.bv_val ); - bsi->flt_where.bb_val.bv_len = 0; - bsi->flt_where.bb_len = 0; + free( bsi->bsi_sel.bb_val.bv_val ); + bsi->bsi_sel.bb_val.bv_len = 0; + bsi->bsi_sel.bb_len = 0; + free( bsi->bsi_from.bb_val.bv_val ); + bsi->bsi_from.bb_val.bv_len = 0; + bsi->bsi_from.bb_len = 0; + free( bsi->bsi_join_where.bb_val.bv_val ); + bsi->bsi_join_where.bb_val.bv_len = 0; + bsi->bsi_join_where.bb_len = 0; + free( bsi->bsi_flt_where.bb_val.bv_val ); + bsi->bsi_flt_where.bb_val.bv_len = 0; + bsi->bsi_flt_where.bb_len = 0; Debug( LDAP_DEBUG_TRACE, "<==backsql_srch_query() returns %s\n", query->bv_val ? query->bv_val : "NULL", 0, 0 ); @@ -823,7 +847,7 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) { backsql_oc_map_rec *oc = v_oc; backsql_srch_info *bsi = v_bsi; - backsql_info *bi = (backsql_info *)bsi->op->o_bd->be_private; + backsql_info *bi = (backsql_info *)bsi->bsi_op->o_bd->be_private; struct berval query; SQLHSTMT sth; RETCODE rc; @@ -833,23 +857,23 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) int i; int j; - int n_candidates = bsi->n_candidates; + int n_candidates = bsi->bsi_n_candidates; - bsi->status = LDAP_SUCCESS; + bsi->bsi_status = LDAP_SUCCESS; - Debug( LDAP_DEBUG_TRACE, "==>backsql_oc_get_candidates(): oc='%s'\n", + Debug( LDAP_DEBUG_TRACE, "==>backsql_oc_get_candidates(): oc='%s'\n", BACKSQL_OC_NAME( oc ), 0, 0 ); - if ( bsi->n_candidates == -1 ) { + if ( bsi->bsi_n_candidates == -1 ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "unchecked limit has been overcome\n", 0, 0, 0 ); /* should never get here */ assert( 0 ); - bsi->status = LDAP_ADMINLIMIT_EXCEEDED; + bsi->bsi_status = LDAP_ADMINLIMIT_EXCEEDED; return BACKSQL_STOP; } - bsi->oc = oc; + bsi->bsi_oc = oc; res = backsql_srch_query( bsi, &query ); if ( res ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " @@ -859,53 +883,66 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) * FIXME: need to separate errors from legally * impossible filters */ - bsi->status = LDAP_SUCCESS; - return BACKSQL_CONTINUE; + switch ( bsi->bsi_status ) { + case LDAP_SUCCESS: + case LDAP_UNDEFINED_TYPE: + case LDAP_NO_SUCH_OBJECT: + /* we are conservative... */ + default: + bsi->bsi_status = LDAP_SUCCESS; + /* try next */ + return BACKSQL_CONTINUE; + + case LDAP_ADMINLIMIT_EXCEEDED: + case LDAP_OTHER: + /* don't try any more */ + return BACKSQL_STOP; + } } if ( query.bv_val == NULL ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "could not construct query for objectclass '%s'\n", oc->oc->soc_cname.bv_val, 0, 0 ); - bsi->status = LDAP_SUCCESS; + bsi->bsi_status = LDAP_SUCCESS; return BACKSQL_CONTINUE; } Debug( LDAP_DEBUG_TRACE, "Constructed query: %s\n", query.bv_val, 0, 0 ); - rc = backsql_Prepare( bsi->dbh, &sth, query.bv_val, 0 ); + rc = backsql_Prepare( bsi->bsi_dbh, &sth, query.bv_val, 0 ); free( query.bv_val ); if ( rc != SQL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "error preparing query\n", 0, 0, 0 ); - backsql_PrintErrors( bi->db_env, bsi->dbh, sth, rc ); - bsi->status = LDAP_OTHER; + backsql_PrintErrors( bi->db_env, bsi->bsi_dbh, sth, rc ); + bsi->bsi_status = LDAP_OTHER; return BACKSQL_CONTINUE; } - Debug( LDAP_DEBUG_TRACE, "id: '%ld'\n", bsi->oc->id, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "id: '%ld'\n", bsi->bsi_oc->id, 0, 0 ); - if ( backsql_BindParamID( sth, 1, &bsi->oc->id ) != SQL_SUCCESS ) { + if ( backsql_BindParamID( sth, 1, &bsi->bsi_oc->id ) != SQL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "error binding objectclass id parameter\n", 0, 0, 0 ); - bsi->status = LDAP_OTHER; + bsi->bsi_status = LDAP_OTHER; return BACKSQL_CONTINUE; } - switch ( bsi->scope ) { + switch ( bsi->bsi_scope ) { case LDAP_SCOPE_BASE: Debug( LDAP_DEBUG_TRACE, "(base)dn: '%s'\n", - bsi->base_dn->bv_val, 0, 0 ); + bsi->bsi_base_dn->bv_val, 0, 0 ); - rc = backsql_BindParamStr( sth, 2, bsi->base_dn->bv_val, + rc = backsql_BindParamStr( sth, 2, bsi->bsi_base_dn->bv_val, BACKSQL_MAX_DN_LEN ); if ( rc != SQL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "error binding base_dn parameter\n", 0, 0, 0 ); - backsql_PrintErrors( bi->db_env, bsi->dbh, + backsql_PrintErrors( bi->db_env, bsi->bsi_dbh, sth, rc ); - bsi->status = LDAP_OTHER; + bsi->bsi_status = LDAP_OTHER; return BACKSQL_CONTINUE; } break; @@ -923,7 +960,7 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) * We do not accept DNs longer than BACKSQL_MAX_DN_LEN; * however this should be handled earlier */ - assert( bsi->base_dn->bv_len <= BACKSQL_MAX_DN_LEN ); + assert( bsi->bsi_base_dn->bv_len <= BACKSQL_MAX_DN_LEN ); /* * Sets the parameters for the SQL built earlier @@ -940,17 +977,17 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) */ if ( BACKSQL_HAS_LDAPINFO_DN_RU( bi ) ) { temp_base_dn[ 0 ] = '\0'; - for ( i = 0, j = bsi->base_dn->bv_len - 1; + for ( i = 0, j = bsi->bsi_base_dn->bv_len - 1; j >= 0; i++, j--) { - temp_base_dn[ i ] = bsi->base_dn->bv_val[ j ]; + temp_base_dn[ i ] = bsi->bsi_base_dn->bv_val[ j ]; } temp_base_dn[ i ] = '%'; temp_base_dn[ i + 1 ] = '\0'; } else { temp_base_dn[ 0 ] = '%'; - AC_MEMCPY( &temp_base_dn[ 1 ], bsi->base_dn->bv_val, - bsi->base_dn->bv_len + 1 ); + AC_MEMCPY( &temp_base_dn[ 1 ], bsi->bsi_base_dn->bv_val, + bsi->bsi_base_dn->bv_len + 1 ); } ldap_pvt_str2upper( temp_base_dn ); @@ -963,9 +1000,9 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "error binding base_dn parameter (2)\n", 0, 0, 0 ); - backsql_PrintErrors( bi->db_env, bsi->dbh, + backsql_PrintErrors( bi->db_env, bsi->bsi_dbh, sth, rc ); - bsi->status = LDAP_OTHER; + bsi->bsi_status = LDAP_OTHER; return BACKSQL_CONTINUE; } break; @@ -973,13 +1010,13 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) case LDAP_SCOPE_ONELEVEL: res = backsql_dn2id( bi, &base_id, - bsi->dbh, bsi->base_dn ); + bsi->bsi_dbh, bsi->bsi_base_dn ); if ( res != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "could not retrieve base_dn id%s\n", res == LDAP_NO_SUCH_OBJECT ? ": no such entry" : "", 0, 0 ); - bsi->status = res; + bsi->bsi_status = res; return BACKSQL_CONTINUE; } @@ -991,7 +1028,7 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) if ( rc != SQL_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "error binding base id parameter\n", 0, 0, 0 ); - bsi->status = LDAP_OTHER; + bsi->bsi_status = LDAP_OTHER; return BACKSQL_CONTINUE; } break; @@ -1001,9 +1038,9 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) if ( !BACKSQL_SUCCESS( rc ) ) { Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "error executing query\n", 0, 0, 0 ); - backsql_PrintErrors( bi->db_env, bsi->dbh, sth, rc ); + backsql_PrintErrors( bi->db_env, bsi->bsi_dbh, sth, rc ); SQLFreeStmt( sth, SQL_DROP ); - bsi->status = LDAP_OTHER; + bsi->bsi_status = LDAP_OTHER; return BACKSQL_CONTINUE; } @@ -1014,17 +1051,17 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) sizeof( backsql_entryID ) ); c_id->id = strtol( row.cols[ 0 ], NULL, 0 ); c_id->keyval = strtol( row.cols[ 1 ], NULL, 0 ); - c_id->oc_id = bsi->oc->id; + c_id->oc_id = bsi->bsi_oc->id; ber_str2bv( row.cols[ 3 ], 0, 1, &c_id->dn ); - c_id->next = bsi->id_list; - bsi->id_list = c_id; - bsi->n_candidates--; + c_id->next = bsi->bsi_id_list; + bsi->bsi_id_list = c_id; + bsi->bsi_n_candidates--; Debug( LDAP_DEBUG_TRACE, "backsql_oc_get_candidates(): " "added entry id=%ld, keyval=%ld dn='%s'\n", c_id->id, c_id->keyval, row.cols[ 3 ] ); - if ( bsi->n_candidates == -1 ) { + if ( bsi->bsi_n_candidates == -1 ) { break; } } @@ -1032,9 +1069,9 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) SQLFreeStmt( sth, SQL_DROP ); Debug( LDAP_DEBUG_TRACE, "<==backsql_oc_get_candidates(): %d\n", - n_candidates - bsi->n_candidates, 0, 0 ); + n_candidates - bsi->bsi_n_candidates, 0, 0 ); - return ( bsi->n_candidates == -1 ? BACKSQL_STOP : BACKSQL_CONTINUE ); + return ( bsi->bsi_n_candidates == -1 ? BACKSQL_STOP : BACKSQL_CONTINUE ); } int @@ -1170,12 +1207,12 @@ backsql_search( Operation *op, SlapReply *rs ) * of entries matching LDAP query filter and scope (or at least * candidates), and get the IDs */ - srch_info.n_candidates = ( isroot ? -2 : limit->lms_s_unchecked == -1 + srch_info.bsi_n_candidates = ( isroot ? -2 : limit->lms_s_unchecked == -1 ? -2 : limit->lms_s_unchecked ); avl_apply( bi->oc_by_oc, backsql_oc_get_candidates, &srch_info, BACKSQL_STOP, AVL_INORDER ); if ( !isroot && limit->lms_s_unchecked != -1 ) { - if ( srch_info.n_candidates == -1 ) { + if ( srch_info.bsi_n_candidates == -1 ) { rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED; send_ldap_result( op, rs ); goto done; @@ -1187,7 +1224,7 @@ backsql_search( Operation *op, SlapReply *rs ) * mentioned in attrs and filter), test it against full filter * and then send to client */ - for ( eid = srch_info.id_list; eid != NULL; + for ( eid = srch_info.bsi_id_list; eid != NULL; eid = backsql_free_entryID( eid, 1 ) ) { Attribute *hasSubordinate = NULL, *a = NULL; @@ -1347,7 +1384,7 @@ end_of_search:; rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL; } else { - rs->sr_err = srch_info.status; + rs->sr_err = srch_info.bsi_status; } send_ldap_result( op, rs ); @@ -1357,7 +1394,7 @@ end_of_search:; } done:; - ch_free( srch_info.attrs ); + ch_free( srch_info.bsi_attrs ); Debug( LDAP_DEBUG_TRACE, "<==backsql_search()\n", 0, 0, 0 ); return 0; diff --git a/servers/slapd/back-sql/util.h b/servers/slapd/back-sql/util.h index f3095db0a5..5282c1ae43 100644 --- a/servers/slapd/back-sql/util.h +++ b/servers/slapd/back-sql/util.h @@ -40,29 +40,35 @@ int backsql_entry_addattr( Entry *e, struct berval *at_name, struct berval *at_val, void *memctx ); typedef struct backsql_srch_info { - Operation *op; + Operation *bsi_op; int bsi_flags; #define BSQL_SF_ALL_OPER 0x0001 #define BSQL_SF_FILTER_HASSUBORDINATE 0x0002 - struct berval *base_dn; - int scope; - Filter *filter; - int slimit, tlimit; - time_t stoptime; - - backsql_entryID *id_list, *c_eid; - int n_candidates; - int abandon; - int status; - - backsql_oc_map_rec *oc; - struct berbuf sel, from, join_where, flt_where; - SQLHDBC dbh; - AttributeName *attrs; - - Entry *e; + struct berval *bsi_base_dn; + int bsi_scope; + Filter *bsi_filter; + int bsi_slimit, + bsi_tlimit; + time_t bsi_stoptime; + + backsql_entryID *bsi_id_list, + *bsi_c_eid; + int bsi_n_candidates; + int bsi_abandon; + int bsi_status; + + backsql_oc_map_rec *bsi_oc; + struct berbuf bsi_sel, + bsi_from, + bsi_join_where, + bsi_flt_where; + ObjectClass *bsi_filter_oc; + SQLHDBC bsi_dbh; + AttributeName *bsi_attrs; + + Entry *bsi_e; } backsql_srch_info; void backsql_init_search( backsql_srch_info *bsi,