"*slapConn", "*authcDN", "*authzDN", NULL };
static Filter generic_filter = { LDAP_FILTER_PRESENT };
+static struct berval generic_filterstr = BER_BVC("(objectclass=*)");
#define PROP_CONN 0
#define PROP_AUTHC 1
#endif
op.o_conn = conn;
op.o_connid = conn->c_connid;
+ op.o_req_dn = op.o_req_ndn;
op.ors_scope = LDAP_SCOPE_BASE;
op.ors_deref = LDAP_DEREF_NEVER;
op.ors_slimit = 1;
op.ors_filter = &generic_filter;
+ op.ors_filterstr = generic_filterstr;
op.o_bd->be_search( &op, &rs );
}
#endif
op.o_conn = conn;
op.o_connid = conn->c_connid;
+ op.o_req_dn = op.o_req_ndn;
op.ors_scope = LDAP_SCOPE_BASE;
op.ors_deref = LDAP_DEREF_NEVER;
op.ors_slimit = 1;
op.ors_filter = &generic_filter;
+ op.ors_filterstr = generic_filterstr;
op.o_bd->be_search( &op, &rs );
}
}
static int slap_parseURI( Operation *op, struct berval *uri,
- struct berval *searchbase, int *scope, Filter **filter )
+ struct berval *base, struct berval *nbase,
+ int *scope, Filter **filter, struct berval *fstr )
{
struct berval bv;
int rc;
LDAPURLDesc *ludp;
assert( uri != NULL && uri->bv_val != NULL );
- searchbase->bv_val = NULL;
- searchbase->bv_len = 0;
+ base->bv_val = NULL;
+ base->bv_len = 0;
+ nbase->bv_val = NULL;
+ nbase->bv_len = 0;
+ fstr->bv_val = NULL;
+ fstr->bv_len = 0;
*scope = -1;
*filter = NULL;
is_dn: bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
- rc = dnNormalize( 0, NULL, NULL, &bv, searchbase, op->o_tmpmemctx );
+ rc = dnNormalize( 0, NULL, NULL, &bv, nbase, op->o_tmpmemctx );
if( rc == LDAP_SUCCESS ) {
*scope = LDAP_SCOPE_BASE;
}
rc = LDAP_PROTOCOL_ERROR;
goto done;
}
+ ber_str2bv( ludp->lud_filter, 0, 0, fstr );
}
/* Grab the searchbase */
- bv.bv_val = ludp->lud_dn;
- bv.bv_len = strlen( bv.bv_val );
- rc = dnNormalize( 0, NULL, NULL, &bv, searchbase, op->o_tmpmemctx );
+ ber_str2bv( ludp->lud_dn, 0, 0, base );
+ rc = dnNormalize( 0, NULL, NULL, base, nbase, op->o_tmpmemctx );
done:
if( rc != LDAP_SUCCESS ) {
if( *filter ) filter_free_x( op, *filter );
+ base->bv_val = NULL;
+ base->bv_len = 0;
+ fstr->bv_val = NULL;
+ fstr->bv_len = 0;
+ } else {
+ /* Don't free these, return them to caller */
+ ludp->lud_filter = NULL;
+ ludp->lud_dn= NULL;
}
ldap_free_urldesc( ludp );
assertDN->bv_val, rule->bv_val, 0 );
#endif
- rc = slap_parseURI( opx, rule,
- &op.o_req_ndn, &op.oq_search.rs_scope, &op.oq_search.rs_filter );
+ rc = slap_parseURI( opx, rule, &op.o_req_dn,
+ &op.o_req_ndn, &op.oq_search.rs_scope, &op.oq_search.rs_filter,
+ &op.ors_filterstr );
if( rc != LDAP_SUCCESS ) goto CONCLUDED;
/* Massive shortcut: search scope == base */
#endif
op.o_conn = opx->o_conn;
op.o_connid = opx->o_connid;
+ op.o_req_dn = op.o_req_ndn;
op.o_bd->be_search( &op, &rs );
}
CONCLUDED:
+ if( op.o_req_dn.bv_len ) ch_free( op.o_req_dn.bv_val );
if( op.o_req_ndn.bv_len ) sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
if( op.oq_search.rs_filter ) filter_free_x( opx, op.oq_search.rs_filter );
+ if( op.ors_filterstr.bv_len ) ch_free( op.ors_filterstr.bv_val );
#ifdef NEW_LOGGING
LDAP_LOG( TRANSPORT, ENTRY,
goto FINISHED;
}
- rc = slap_parseURI( opx, ®out,
- &op.o_req_ndn, &op.oq_search.rs_scope, &op.oq_search.rs_filter );
+ rc = slap_parseURI( opx, ®out, &op.o_req_dn,
+ &op.o_req_ndn, &op.oq_search.rs_scope, &op.oq_search.rs_filter,
+ &op.ors_filterstr );
if( regout.bv_val ) sl_free( regout.bv_val, opx->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
goto FINISHED;
op.oq_search.rs_deref = LDAP_DEREF_NEVER;
op.oq_search.rs_slimit = 1;
op.oq_search.rs_attrsonly = 1;
+ op.o_req_dn = op.o_req_ndn;
op.o_bd->be_search( &op, &rs );
if( sasldn->bv_len ) {
opx->o_conn->c_authz_backend = op.o_bd;
}
- if( op.o_req_ndn.bv_len ) ch_free( op.o_req_ndn.bv_val );
+ if( op.o_req_dn.bv_len ) ch_free( op.o_req_dn.bv_val );
+ if( op.o_req_ndn.bv_len ) sl_free( op.o_req_ndn.bv_val, opx->o_tmpmemctx );
if( op.oq_search.rs_filter ) filter_free_x( opx, op.oq_search.rs_filter );
+ if( op.ors_filterstr.bv_len ) ch_free( op.ors_filterstr.bv_val );
#ifdef NEW_LOGGING
LDAP_LOG( TRANSPORT, ENTRY,