X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldap%2Fsearch.c;h=41b397a9da22dd2cdef2c9535414219f59671768;hb=71e35141e151b7ca602c7a4638c35260f65d946d;hp=e2990e81d87ee05876cdc6c0ddef43623dc965b9;hpb=a9c902a7ca3e46f9437063ccfd98777bd3e93b15;p=openldap diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index e2990e81d8..41b397a9da 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -1,7 +1,7 @@ /* search.c - ldap backend search function */ /* $OpenLDAP$ */ /* - * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ /* This is an altered version */ @@ -110,12 +110,14 @@ ldap_back_search( /* if requested limit higher than hard limit, abort */ if ( !isroot && tlimit > limit->lms_t_hard ) { /* no hard limit means use soft instead */ - if ( limit->lms_t_hard == 0 && tlimit > limit->lms_t_soft ) { + if ( limit->lms_t_hard == 0 + && limit->lms_t_soft > -1 + && tlimit > limit->lms_t_soft ) { tlimit = limit->lms_t_soft; /* positive hard limit means abort */ } else if ( limit->lms_t_hard > 0 ) { - send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, + send_ldap_result( conn, op, LDAP_ADMINLIMIT_EXCEEDED, NULL, NULL, NULL, NULL ); rc = 0; goto finish; @@ -128,12 +130,14 @@ ldap_back_search( /* if requested limit higher than hard limit, abort */ if ( !isroot && slimit > limit->lms_s_hard ) { /* no hard limit means use soft instead */ - if ( limit->lms_s_hard == 0 && slimit > limit->lms_s_soft ) { + if ( limit->lms_s_hard == 0 + && limit->lms_s_soft > -1 + && slimit > limit->lms_s_soft ) { slimit = limit->lms_s_soft; /* positive hard limit means abort */ } else if ( limit->lms_s_hard > 0 ) { - send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, + send_ldap_result( conn, op, LDAP_ADMINLIMIT_EXCEEDED, NULL, NULL, NULL, NULL ); rc = 0; goto finish; @@ -231,7 +235,7 @@ ldap_back_search( #else /* !ENABLE_REWRITE */ filterstr, #endif /* !ENABLE_REWRITE */ - 0); + BACKLDAP_MAP); if ( mapped_filter == NULL ) { #ifdef ENABLE_REWRITE mapped_filter = mfilter.bv_val; @@ -246,7 +250,7 @@ ldap_back_search( } #endif /* ENABLE_REWRITE */ - mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, 0); + mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, BACKLDAP_MAP); if ( mapped_attrs == NULL && attrs) { for (count=0; attrs[count].an_name.bv_val; count++); mapped_attrs = ch_malloc( (count+1) * sizeof(char *)); @@ -487,8 +491,8 @@ ldap_send_entry( attrp = &ent.e_attrs; while ( ber_scanf( &ber, "{m", &a ) != LBER_ERROR ) { - ldap_back_map(&li->at_map, &a, &mapped, 1); - if (mapped.bv_val == NULL) + ldap_back_map(&li->at_map, &a, &mapped, BACKLDAP_REMAP); + if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') continue; attr = (Attribute *)ch_malloc( sizeof(Attribute) ); if (attr == NULL) @@ -532,8 +536,9 @@ ldap_send_entry( for ( last = 0; attr->a_vals[last].bv_val; last++ ) ; for ( i = 0, bv = attr->a_vals; bv->bv_val; bv++, i++ ) { - ldap_back_map(&li->oc_map, bv, &mapped, 1); - if (mapped.bv_val == NULL) { + ldap_back_map(&li->oc_map, bv, &mapped, + BACKLDAP_REMAP); + if (mapped.bv_val == NULL || mapped.bv_val[0] == '\0') { LBER_FREE(bv->bv_val); bv->bv_val = NULL; if (--last < 0)