Backend *be,
Connection *conn,
Operation *op,
- Entry *e,
+ Attribute *a,
MatchingRuleAssertion *mra,
char ***e_flags
);
Backend *be,
Connection *conn,
Operation *op,
- Entry *e,
+ Attribute *a,
ValuesReturnFilter *f,
char ***e_flags
);
Backend *be,
Connection *conn,
Operation *op,
- Entry *e,
+ Attribute *a,
AttributeDescription *desc,
char ***e_flags
);
Backend *be,
Connection *conn,
Operation *op,
- Entry *e,
+ Attribute *a,
AttributeAssertion *ava,
int type,
char ***e_flags
Backend *be,
Connection *conn,
Operation *op,
- Entry *e,
+ Attribute *a,
char ***e_flags
)
{
#else
Debug( LDAP_DEBUG_FILTER, " EQUALITY\n", 0, 0, 0 );
#endif
- rc = test_ava_vrFilter( be, conn, op, e, f->f_ava,
+ rc = test_ava_vrFilter( be, conn, op, a, f->f_ava,
LDAP_FILTER_EQUALITY, e_flags );
if( rc == -1 ) {
return rc;
Debug( LDAP_DEBUG_FILTER, " SUBSTRINGS\n", 0, 0, 0 );
#endif
- rc = test_substrings_vrFilter( be, conn, op, e,
+ rc = test_substrings_vrFilter( be, conn, op, a,
f, e_flags );
if( rc == -1 ) {
return rc;
#else
Debug( LDAP_DEBUG_FILTER, " PRESENT\n", 0, 0, 0 );
#endif
- rc = test_presence_vrFilter( be, conn, op, e,
+ rc = test_presence_vrFilter( be, conn, op, a,
f->f_desc, e_flags );
if( rc == -1 ) {
return rc;
break;
case LDAP_FILTER_GE:
- rc = test_ava_vrFilter( be, conn, op, e, f->f_ava,
+ rc = test_ava_vrFilter( be, conn, op, a, f->f_ava,
LDAP_FILTER_GE, e_flags );
if( rc == -1 ) {
return rc;
break;
case LDAP_FILTER_LE:
- rc = test_ava_vrFilter( be, conn, op, e, f->f_ava,
+ rc = test_ava_vrFilter( be, conn, op, a, f->f_ava,
LDAP_FILTER_LE, e_flags );
if( rc == -1 ) {
return rc;
#else
Debug( LDAP_DEBUG_FILTER, " EXT\n", 0, 0, 0 );
#endif
- rc = test_mra_vrFilter( be, conn, op, e,
+ rc = test_mra_vrFilter( be, conn, op, a,
f->f_mra, e_flags );
if( rc == -1 ) {
return rc;
static int
test_ava_vrFilter(
- Backend *be,
+ Backend *be,
Connection *conn,
- Operation *op,
- Entry *e,
+ Operation *op,
+ Attribute *a,
AttributeAssertion *ava,
- int type,
- char ***e_flags
+ int type,
+ char ***e_flags
)
{
int i, j;
- Attribute *a;
-
- if ( !access_allowed( be, conn, op, e,
- ava->aa_desc, &ava->aa_value, ACL_SEARCH, NULL ) )
- {
- return LDAP_INSUFFICIENT_ACCESS;
- }
- for (a = e->e_attrs, i=0; a != NULL; a = a->a_next, i++ ) {
+ for ( i=0; a != NULL; a = a->a_next, i++ ) {
MatchingRule *mr;
struct berval *bv;
static int
test_presence_vrFilter(
- Backend *be,
- Connection *conn,
- Operation *op,
- Entry *e,
- AttributeDescription *desc,
- char ***e_flags
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Attribute *a,
+ AttributeDescription *desc,
+ char ***e_flags
)
{
int i, j;
- Attribute *a;
- if ( !access_allowed( be, conn, op, e, desc, NULL, ACL_SEARCH, NULL ) ) {
- return LDAP_INSUFFICIENT_ACCESS;
- }
-
- for (a = e->e_attrs, i=0; a != NULL; a = a->a_next, i++ ) {
+ for ( i=0; a != NULL; a = a->a_next, i++ ) {
struct berval *bv;
if ( !is_ad_subtype( a->a_desc, desc ) ) {
static int
test_substrings_vrFilter(
- Backend *be,
- Connection *conn,
- Operation *op,
- Entry *e,
- ValuesReturnFilter *f,
- char ***e_flags
+ Backend *be,
+ Connection *conn,
+ Operation *op,
+ Attribute *a,
+ ValuesReturnFilter *f,
+ char ***e_flags
)
{
int i, j;
- Attribute *a;
-
- if ( !access_allowed( be, conn, op, e,
- f->f_sub_desc, NULL, ACL_SEARCH, NULL ) )
- {
- return LDAP_INSUFFICIENT_ACCESS;
- }
- for (a = e->e_attrs, i=0; a != NULL; a = a->a_next, i++ ) {
+ for ( i=0; a != NULL; a = a->a_next, i++ ) {
MatchingRule *mr = a->a_desc->ad_type->sat_substr;
struct berval *bv;
Backend *be,
Connection *conn,
Operation *op,
- Entry *e,
+ Attribute *a,
MatchingRuleAssertion *mra,
char ***e_flags
)
{
int i, j;
- Attribute *a;
-
- if( !access_allowed( be, conn, op, e,
- mra->ma_desc, &mra->ma_value, ACL_SEARCH, NULL ) )
- {
- return LDAP_INSUFFICIENT_ACCESS;
- }
- for (a = e->e_attrs, i=0; a != NULL; a = a->a_next, i++ ) {
+ for ( i=0; a != NULL; a = a->a_next, i++ ) {
struct berval *bv;
if ( !is_ad_subtype( a->a_desc, mra->ma_desc ) ) {
e_flags[i] = a_flags;
}
- if ( op->vrFilter != NULL ){
+ if ( op->vrFilter != NULL ){
- rc = filter_matched_values(be, conn, op, e, &e_flags) ;
+ rc = filter_matched_values(be, conn, op, e->e_attrs, &e_flags) ;
if ( rc == -1 ) {
#ifdef NEW_LOGGING
/* eventually will loop through generated operational attributes */
/* only have subschemaSubentry implemented */
aa = backend_operational( be, conn, op, e, attrs, opattrs );
+
+ for ( a = aa, i=0; a != NULL; a = a->a_next ) i++;
+ e_flags = ch_malloc ( i * sizeof(a_flags) );
- for (a = aa ; a != NULL; a = a->a_next ) {
+ for ( a = aa, i=0; a != NULL; a = a->a_next, i++ ) {
+ for ( j = 0; a->a_vals[j].bv_val != NULL; j++ );
+
+ a_flags = ch_calloc ( j, sizeof(char) );
+ /* If no ValuesReturnFilter control return everything */
+ if ( op->vrFilter == NULL ){
+ memset(a_flags, 1, j);
+ }
+ e_flags[i] = a_flags;
+ }
+
+ if ( op->vrFilter != NULL ){
+
+ rc = filter_matched_values(be, conn, op, aa, &e_flags) ;
+
+ if ( rc == -1 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+ "send_search_entry: conn %lu "
+ "matched values filtering failed\n",
+ conn ? conn->c_connid : 0 ));
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "matched values filtering failed\n", 0, 0, 0 );
+#endif
+ ber_free( ber, 1 );
+
+ /* free e_flags */
+ for ( a = aa, i=0; a != NULL; a = a->a_next, i++ ) {
+ free( e_flags[i] );
+ }
+ free( e_flags );
+
+ send_ldap_result( conn, op, LDAP_OTHER,
+ NULL, "matched values filtering error",
+ NULL, NULL );
+ goto error_return;
+ }
+ }
+
+ for (a = aa, j=0; a != NULL; a = a->a_next, j++ ) {
AttributeDescription *desc = a->a_desc;
if ( attrs == NULL ) {
ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding description error", NULL, NULL );
+ /* free e_flags */
+ for ( a = aa, i=0; a != NULL; a = a->a_next, i++ ) {
+ free( e_flags[i] );
+ }
+ free( e_flags );
+
attrs_free( aa );
goto error_return;
}
continue;
}
+ if ( e_flags[j][i] == 0 ){
+ continue;
+ }
+
if (( rc = ber_printf( ber, "O", &a->a_vals[i] )) == -1 ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encoding values error",
NULL, NULL );
+ /* free e_flags */
+ for ( a = aa, i=0; a != NULL; a = a->a_next, i++ ) {
+ free( e_flags[i] );
+ }
+ free( e_flags );
+
attrs_free( aa );
goto error_return;
}
ber_free_buf( ber );
send_ldap_result( conn, op, LDAP_OTHER,
NULL, "encode end error", NULL, NULL );
+ /* free e_flags */
+ for ( a = aa, i=0; a != NULL; a = a->a_next, i++ ) {
+ free( e_flags[i] );
+ }
+ free( e_flags );
+
attrs_free( aa );
goto error_return;
}
}
- attrs_free( aa );
+ /* free e_flags */
+ for ( a = aa, i=0; a != NULL; a = a->a_next, i++ ) {
+ free( e_flags[i] );
+ }
+ free( e_flags );
+ attrs_free( aa );
rc = ber_printf( ber, /*{{{*/ "}N}N}" );
#ifdef LDAP_CONNECTIONLESS