Changed search attrs from struct berval ** to AttributeName *

This commit is contained in:
Howard Chu 2001-12-31 11:35:52 +00:00
parent 9405761404
commit 743c402265
32 changed files with 191 additions and 166 deletions

View file

@ -202,7 +202,7 @@ parse_acl(
}
} else if ( strncasecmp( left, "attr", 4 ) == 0 ) {
a->acl_attrs = str2bvec( a->acl_attrs,
a->acl_attrs = str2anlist( a->acl_attrs,
right, "," );
} else {
fprintf( stderr,
@ -1271,13 +1271,17 @@ void
acl_free( AccessControl *a )
{
Access *n;
AttributeName *an;
if ( a->acl_filter )
filter_free( a->acl_filter );
if ( a->acl_dn_pat.bv_len )
free ( a->acl_dn_pat.bv_val );
if ( a->acl_attrs )
ber_bvecfree( a->acl_attrs );
for (; a->acl_attrs; a->acl_attrs = an) {
an = a->acl_attrs->an_next;
free( a->acl_attrs->an_name.bv_val );
free( a->acl_attrs );
}
for (; a->acl_access; a->acl_access = n) {
n = a->acl_access->a_next;
access_free( a->acl_access );
@ -1482,15 +1486,16 @@ print_acl( Backend *be, AccessControl *a )
}
if ( a->acl_attrs != NULL ) {
int i, first = 1;
int first = 1;
AttributeName *an;
to++;
fprintf( stderr, " attrs=" );
for ( i = 0; a->acl_attrs[i] != NULL; i++ ) {
for ( an = a->acl_attrs; an; an=an->an_next ) {
if ( ! first ) {
fprintf( stderr, "," );
}
fputs( a->acl_attrs[i]->bv_val, stderr );
fputs( an->an_name.bv_val, stderr );
first = 0;
}
fprintf( stderr, "\n" );

View file

@ -282,27 +282,25 @@ int is_ad_subtype(
int ad_inlist(
AttributeDescription *desc,
struct berval **attrs )
AttributeName *attrs )
{
int i;
for( i=0; attrs[i] != NULL; i++ ) {
for( ; attrs; attrs=attrs->an_next ) {
ObjectClass *oc;
AttributeDescription *ad = NULL;
const char *text;
int rc;
rc = slap_bv2ad( attrs[i], &ad, &text );
if( rc == LDAP_SUCCESS ) {
rc = is_ad_subtype( desc, ad );
if( rc ) return 1;
if ( attrs->an_desc ) {
if ( is_ad_subtype( desc, attrs->an_desc ))
return 1;
continue;
}
/*
* EXTENSION: see if requested description is an object class
* if so, return attributes which the class requires/allows
*/
oc = oc_bvfind( attrs[i] );
oc = oc_bvfind( &attrs->an_name );
if( oc != NULL ) {
if ( oc == slap_schema.si_oc_extensibleObject ) {
/* extensibleObject allows the return of anything */
@ -399,3 +397,60 @@ int slap_bv2undef_ad(
return LDAP_SUCCESS;
}
int
an_find(
AttributeName *a,
struct berval *s
)
{
if( a == NULL ) return 0;
for ( ; a; a=a->an_next ) {
if ( a->an_name.bv_len != s->bv_len) continue;
if ( strcasecmp( s->bv_val, a->an_name.bv_val ) == 0 ) {
return( 1 );
}
}
return( 0 );
}
/* Convert a delimited string into a list of AttributeNames; Add on
* to an existing list if it was given.
*/
AttributeName *
str2anlist( AttributeName *an, const char *in, const char *brkstr )
{
char *str;
char *s;
char *lasts;
const char *text;
AttributeName *a, *anew;
/* protect the input string from strtok */
str = ch_strdup( in );
/* find last element in list */
for (a = an; a && a->an_next; a=a->an_next);
for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
s != NULL;
s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
{
anew = ch_malloc( sizeof( AttributeName ) );
anew->an_next = NULL;
anew->an_desc = NULL;
ber_str2bv(s, 0, 1, &anew->an_name);
slap_bv2ad(&anew->an_name, &anew->an_desc, &text);
if (!an) {
an = anew;
} else {
a->an_next = anew;
}
a = anew;
}
free( str );
return( an );
}

View file

@ -40,7 +40,7 @@ bdb_search(
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;

View file

@ -30,7 +30,7 @@ dnssrv_back_search(
int time,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly )
{
int i;

View file

@ -112,7 +112,7 @@ ldap_back_map_filter(
char **
ldap_back_map_attrs(
struct ldapmap *at_map,
struct berval **a,
AttributeName *a,
int remap
);

View file

@ -429,29 +429,30 @@ ldap_back_map_filter(
char **
ldap_back_map_attrs(
struct ldapmap *at_map,
struct berval **a,
AttributeName *a,
int remap
)
{
int i, j, count;
int i;
char *mapped, **na;
AttributeName *an;
if (a == NULL)
return(NULL);
for (count = 0; a[count] != NULL; count++) {
for (i = 0, an=a; an; an=an->an_next, i++) {
/* */
}
na = (char **)ch_calloc( count + 1, sizeof(char *) );
na = (char **)ch_calloc( i + 1, sizeof(char *) );
if (na == NULL)
return(NULL);
for (i = 0, j = 0; i < count; i++) {
mapped = ldap_back_map(at_map, a[i]->bv_val, remap);
for (i = 0, an=a; an; an=an->an_next) {
mapped = ldap_back_map(at_map, an->an_name.bv_val, remap);
if (mapped != NULL) {
na[j] = mapped;
j++;
na[i] = mapped;
i++;
}
}
return(na);

View file

@ -47,7 +47,7 @@
#include "back-ldap.h"
static void ldap_send_entry( Backend *be, Operation *op, struct ldapconn *lc,
LDAPMessage *e, struct berval **attrs, int attrsonly );
LDAPMessage *e, AttributeName *attrs, int attrsonly );
int
ldap_back_search(
@ -62,7 +62,7 @@ ldap_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{
@ -223,10 +223,11 @@ ldap_back_search(
mapped_attrs = ldap_back_map_attrs(&li->at_map, attrs, 0);
if ( mapped_attrs == NULL && attrs) {
for (count=0; attrs[count]; count++);
AttributeName *an;
for (count=0, an=attrs; an; an=an->an_next,count++);
mapped_attrs = ch_malloc( (count+1) * sizeof(char *));
for (count=0; attrs[count]; count++) {
mapped_attrs[count] = attrs[count]->bv_val;
for (count=0, an=attrs; an; an=an->an_next,count++) {
mapped_attrs[count] = an->an_name.bv_val;
}
mapped_attrs[count] = NULL;
}
@ -365,7 +366,7 @@ ldap_send_entry(
Operation *op,
struct ldapconn *lc,
LDAPMessage *e,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -25,7 +25,7 @@ ldbm_back_operational(
Connection *conn,
Operation *op,
Entry *e,
struct berval **attrs,
AttributeName *attrs,
int opattrs,
Attribute **a )
{

View file

@ -37,7 +37,7 @@ ldbm_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly )
{
struct ldbminfo *li = (struct ldbminfo *) be->be_private;

View file

@ -84,7 +84,7 @@ meta_send_entry(
struct metaconn *lc,
int i,
LDAPMessage *e,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
);
@ -107,7 +107,7 @@ meta_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{
@ -351,10 +351,11 @@ meta_back_search(
mapped_attrs = ldap_back_map_attrs( &li->targets[ i ]->at_map,
attrs, 0 );
if ( mapped_attrs == NULL && attrs) {
for ( count = 0; attrs[ count ]; count++ );
AttributeName *an;
for ( count=0, an=attrs; an; an=an->an_next, count++ );
mapped_attrs = ch_malloc( ( count + 1 ) * sizeof(char *));
for ( count = 0; attrs[ count ]; count++ ) {
mapped_attrs[ count ] = attrs[ count ]->bv_val;
for ( count=0, an=attrs; an; an=an->an_next, count++ ) {
mapped_attrs[ count ] = an->an_name.bv_val;
}
mapped_attrs[ count ] = NULL;
}
@ -572,7 +573,7 @@ meta_send_entry(
struct metaconn *lc,
int target,
LDAPMessage *e,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -330,8 +330,8 @@ conn_create(
c->c_currentber ? "r" : "",
c->c_writewaiter ? "w" : "",
c->c_ops != NULL ? "x" : "",
c->c_pending_ops != NULL ? "p" : "",
STAILQ_EMPTY( &c->c_ops ) ? "" : "x",
STAILQ_EMPTY( &c->c_pending_ops ) ? "" : "p",
connection_state2str( c->c_conn_state ),
c->c_sasl_bind_in_progress ? "S" : "",

View file

@ -25,7 +25,7 @@ monitor_back_operational(
Connection *conn,
Operation *op,
Entry *e,
struct berval **attrs,
AttributeName *attrs,
int opattrs,
Attribute **a )
{

View file

@ -51,7 +51,7 @@ monitor_send_children(
Connection *conn,
Operation *op,
Filter *filter,
struct berval **attrs,
AttributeName *attrs,
int attrsonly,
Entry *e_parent,
int sub,
@ -150,7 +150,7 @@ monitor_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -34,7 +34,7 @@ passwd_back_search(
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -39,7 +39,7 @@ perl_back_search(
int timelimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{
@ -48,6 +48,7 @@ perl_back_search(
int err = 0;
char *matched = NULL, *info = NULL;
PerlBackend *perl_back = (PerlBackend *)be->be_private;
AttributeName *an;
Entry *e;
char *buf;
int i;
@ -65,8 +66,8 @@ perl_back_search(
XPUSHs(sv_2mortal(newSViv( timelimit )));
XPUSHs(sv_2mortal(newSViv( attrsonly )));
for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
XPUSHs(sv_2mortal(newSVpv( attrs[i]->bv_val , 0)));
for ( an = attrs; an; an = an->an_next ) {
XPUSHs(sv_2mortal(newSVpv( an->an_name.bv_val , 0)));
}
PUTBACK;

View file

@ -33,14 +33,14 @@ shell_back_abandon(
if ( si->si_abandon == NULL ) {
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
pid = -1;
for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
STAILQ_FOREACH( o, &conn->c_ops, o_next ) {
if ( o->o_msgid == msgid ) {
pid = (pid_t) o->o_private;
break;
}
}
if( pid == -1 ) {
for ( o = conn->c_pending_ops; o != NULL; o = o->o_next ) {
STAILQ_FOREACH( o, &conn->c_pending_ops, o_next ) {
if ( o->o_msgid == msgid ) {
pid = (pid_t) o->o_private;
break;

View file

@ -23,7 +23,7 @@ read_and_send_results(
Connection *conn,
Operation *op,
FILE *fp,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -28,13 +28,14 @@ shell_back_search(
int time,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{
struct shellinfo *si = (struct shellinfo *) be->be_private;
int i;
FILE *rfp, *wfp;
AttributeName *an;
if ( si->si_search == NULL ) {
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
@ -61,8 +62,8 @@ shell_back_search(
fprintf( wfp, "filter: %s\n", filterstr );
fprintf( wfp, "attrsonly: %d\n", attrsonly ? 1 : 0 );
fprintf( wfp, "attrs:%s", attrs == NULL ? " all" : "" );
for ( i = 0; attrs != NULL && attrs[i] != NULL; i++ ) {
fprintf( wfp, " %s", attrs[i]->bv_val );
for ( an = attrs; an; an=an->an_next ) {
fprintf( wfp, " %s", an->an_name.bv_val );
}
fprintf( wfp, "\n" );
fclose( wfp );

View file

@ -42,7 +42,7 @@ extern int read_and_send_results LDAP_P((
struct slap_conn *conn,
struct slap_op *op,
FILE *fp,
struct berval **attrs,
AttributeName *attrs,
int attrsonly));
LDAP_END_DECL

View file

@ -46,9 +46,9 @@ int backsql_attrlist_add(backsql_srch_info *bsi,char *at_name)
void backsql_init_search(backsql_srch_info *bsi,backsql_info *bi,char *nbase,int scope,
int slimit,int tlimit,time_t stoptime,Filter *filter,
SQLHDBC dbh,BackendDB *be,Connection *conn,Operation *op,struct berval **attrs)
SQLHDBC dbh,BackendDB *be,Connection *conn,Operation *op,AttributeName *attrs)
{
struct berval **p;
AttributeName *p;
bsi->base_dn=nbase;
bsi->scope=scope;
bsi->slimit=slimit;
@ -62,11 +62,11 @@ void backsql_init_search(backsql_srch_info *bsi,backsql_info *bi,char *nbase,int
{
bsi->attrs=(char**)ch_calloc(1,sizeof(char*));
bsi->attrs[0]=NULL;
for(p=attrs;*p!=NULL;p++)
backsql_attrlist_add(bsi,(*p)->bv_val);
for(p=attrs;p!=NULL;p=p->an_next)
backsql_attrlist_add(bsi,p->an_name.bv_val);
}
else
bsi->attrs=attrs;
bsi->attrs=NULL;
bsi->abandon=0;
bsi->id_list=NULL;
bsi->stoptime=stoptime;
@ -518,7 +518,7 @@ SQL_SUCCESS)
int backsql_search(BackendDB *be,Connection *conn,Operation *op,
const char *base, const char *nbase, int scope,int deref,int slimit,int tlimit,
Filter *filter, const char *filterstr,struct berval **attrs,int attrsonly)
Filter *filter, const char *filterstr,AttributeName *attrs,int attrsonly)
{
backsql_info *bi=(backsql_info*)be->be_private;
SQLHDBC dbh;

View file

@ -57,7 +57,7 @@ int interp_send_results (
Connection * conn,
Operation * op,
char *result,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
);

View file

@ -29,7 +29,7 @@ tcl_back_search (
int timelimit,
Filter * filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{
@ -38,6 +38,7 @@ tcl_back_search (
struct tclinfo *ti = (struct tclinfo *) be->be_private;
char **sattrs = NULL;
Entry *e;
AttributeName *an;
if (ti->ti_search == NULL) {
send_ldap_result (conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
@ -45,11 +46,11 @@ tcl_back_search (
return (-1);
}
for (i = 0; attrs != NULL && attrs[i] != NULL; i++);
for (i = 0, an = attrs; an != NULL; an=an->an_next, i++);
if (i > 0) {
sattrs = ch_malloc( (i+1) * sizeof(char *));
for (i = 0; attrs[i]; i++)
sattrs[i] = attrs[i]->bv_val;
for (i = 0, an = attrs; an; an=an->an_next, i++)
sattrs[i] = an->an_name.bv_val;
sattrs[i] = NULL;
attrs_tcl = Tcl_Merge (i, sattrs);
free(sattrs);
@ -82,7 +83,7 @@ tcl_back_search (
Debug (LDAP_DEBUG_SHELL, "tcl_search_error: %s\n", results,
0, 0);
} else {
interp_send_results (be, conn, op, results, NULL, 0);
interp_send_results (be, conn, op, results, attrs, 0);
}
if (err != LDAP_SUCCESS)

View file

@ -26,7 +26,7 @@ interp_send_results (
Connection * conn,
Operation * op,
char *result,
char **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -1078,7 +1078,7 @@ Attribute *backend_operational(
Connection *conn,
Operation *op,
Entry *e,
struct berval **attrs,
AttributeName *attrs,
int opattrs )
{
Attribute *a = NULL, **ap = &a;

View file

@ -260,7 +260,7 @@ glue_back_search (
int tlimit,
Filter *filter,
const char *filterstr,
struct berval **attrs,
AttributeName *attrs,
int attrsonly
)
{

View file

@ -124,26 +124,6 @@ charray_inlist(
return( 0 );
}
int
bvec_inlist(
struct berval **a,
struct berval *s
)
{
int i;
if( a == NULL ) return 0;
for ( i = 0; a[i] != NULL; i++ ) {
if ( a[i]->bv_len != s->bv_len) continue;
if ( strcasecmp( s->bv_val, a[i]->bv_val ) == 0 ) {
return( 1 );
}
}
return( 0 );
}
char **
charray_dup( char **a )
{
@ -199,53 +179,6 @@ str2charray( const char *str_in, const char *brkstr )
return( res );
}
/* Convert a delimited string into an array of bervals; Add on
* to an existing array if it was given.
*/
struct berval **
str2bvec( struct berval **vec, const char *in, const char *brkstr )
{
char *str;
struct berval **res;
char *s;
char *lasts;
int i, old;
/* protect the input string from strtok */
str = ch_strdup( in );
for (old = 0; vec && vec[old]; old++);
i = 1;
for ( s = str; *s; s++ ) {
if ( strchr( brkstr, *s ) != NULL ) {
i++;
}
}
if (vec) {
res = (struct berval **) ch_realloc( vec, (old + i + 1) * sizeof(struct berval *) );
vec = res + old;
} else {
res = (struct berval **) ch_malloc( (i + 1) * sizeof(struct berval *) );
vec = res;
}
i = 0;
for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
s != NULL;
s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
{
vec[i++] = ber_bvstrdup( s );
}
vec[i] = NULL;
free( str );
return( res );
}
int
charray_strcmp( const char **a1, const char **a2 )
{

View file

@ -1218,13 +1218,13 @@ connection_input(
char *cdn = NULL;
#endif
if ( conn->c_currentber == NULL && (conn->c_currentber = ber_alloc_t(0))
if ( conn->c_currentber == NULL && (conn->c_currentber = ber_alloc())
== NULL ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
"connection_input: conn %d ber_alloc_t failed.\n", conn->c_connid ));
"connection_input: conn %d ber_alloc failed.\n", conn->c_connid ));
#else
Debug( LDAP_DEBUG_ANY, "ber_alloc_t failed\n", 0, 0, 0 );
Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
#endif
return -1;
}

View file

@ -37,7 +37,7 @@ LDAP_SLAPD_F (int) is_ad_subtype LDAP_P((
LDAP_SLAPD_F (int) ad_inlist LDAP_P((
AttributeDescription *desc,
struct berval **attrs ));
AttributeName *attrs ));
LDAP_SLAPD_F (int) slap_str2undef_ad LDAP_P((
const char *,
@ -53,6 +53,10 @@ LDAP_SLAPD_F (AttributeDescription *) ad_find_lang LDAP_P((
AttributeType *type,
struct berval *lang ));
LDAP_SLAPD_F (AttributeName *) str2anlist LDAP_P(( AttributeName *an,
const char *str, const char *brkstr ));
LDAP_SLAPD_F (int) an_find LDAP_P(( AttributeName *a, struct berval *s ));
/*
* acl.c
*/
@ -225,7 +229,7 @@ LDAP_SLAPD_F (Attribute *) backend_operational(
Connection *conn,
Operation *op,
Entry *e,
struct berval **attrs,
AttributeName *attrs,
int opattrs );
@ -271,8 +275,6 @@ LDAP_SLAPD_F (void) charray_free LDAP_P(( char **array ));
LDAP_SLAPD_F (int) charray_inlist LDAP_P(( char **a, const char *s ));
LDAP_SLAPD_F (char **) charray_dup LDAP_P(( char **a ));
LDAP_SLAPD_F (char **) str2charray LDAP_P(( const char *str, const char *brkstr ));
LDAP_SLAPD_F (struct berval **) str2bvec LDAP_P(( struct berval **vec,
const char *str, const char *brkstr ));
LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
@ -281,9 +283,6 @@ LDAP_SLAPD_F (void) bvarray_free LDAP_P(( struct berval *a ));
LDAP_SLAPD_F (char *) slap_strcopy LDAP_P((
char *dst, const char *src ));
LDAP_SLAPD_F (int) bvec_inlist LDAP_P((
struct berval **a,
struct berval *s ));
/*
* controls.c
@ -664,7 +663,7 @@ LDAP_SLAPD_F (int) send_search_reference LDAP_P((
LDAP_SLAPD_F (int) send_search_entry LDAP_P((
Backend *be, Connection *conn, Operation *op,
Entry *e, struct berval **attrs, int attrsonly,
Entry *e, AttributeName *attrs, int attrsonly,
LDAPControl **ctrls ));
LDAP_SLAPD_F (int) str2result LDAP_P(( char *s,

View file

@ -618,7 +618,7 @@ send_search_entry(
Connection *conn,
Operation *op,
Entry *e,
struct berval **attrs,
AttributeName *attrs,
int attrsonly,
LDAPControl **ctrls
)
@ -707,11 +707,11 @@ send_search_entry(
/* check for special all user attributes ("*") type */
userattrs = ( attrs == NULL ) ? 1
: bvec_inlist( attrs, &AllUser );
: an_find( attrs, &AllUser );
/* check for special all operational attributes ("+") type */
opattrs = ( attrs == NULL ) ? 0
: bvec_inlist( attrs, &AllOper );
: an_find( attrs, &AllOper );
for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
AttributeDescription *desc = a->a_desc;

View file

@ -38,7 +38,7 @@ do_search(
struct berval nbase = { 0, NULL };
struct berval fstr = { 0, NULL };
Filter *filter = NULL;
struct berval **attrs = NULL;
AttributeName an, *al = NULL, *alast, *anew;
Backend *be;
int rc;
const char *text;
@ -156,7 +156,26 @@ do_search(
/* attributes */
if ( ber_scanf( op->o_ber, /*{*/ "{V}}", &attrs ) == LBER_ERROR ) {
if ( ber_scanf( op->o_ber, "{" /*}*/ ) == LBER_ERROR ) {
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding attrs error" );
rc = SLAPD_DISCONNECT;
goto return_results;
}
while ( ber_scanf( op->o_ber, "o", &an.an_name ) != LBER_ERROR) {
anew = ch_malloc(sizeof(AttributeName));
anew->an_next = NULL;
anew->an_name = an.an_name;
anew->an_desc = NULL;
slap_bv2ad( &anew->an_name, &anew->an_desc, &text );
if (!al) {
al = anew;
} else {
alast->an_next = anew;
}
alast = anew;
}
if ( ber_scanf( op->o_ber, /*{{*/ "}}" ) == LBER_ERROR ) {
send_ldap_disconnect( conn, op,
LDAP_PROTOCOL_ERROR, "decoding attrs error" );
rc = SLAPD_DISCONNECT;
@ -185,13 +204,13 @@ do_search(
#endif
if ( attrs != NULL ) {
for ( i = 0; attrs[i] != NULL; i++ ) {
if ( al != NULL ) {
for ( anew = al; anew; anew=anew->an_next ) {
#ifdef NEW_LOGGING
LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
"do_search: %s", attrs[i]->bv_val ));
"do_search: %s", anew->an_name.bv_val ));
#else
Debug( LDAP_DEBUG_ARGS, " %s", attrs[i]->bv_val, 0, 0 );
Debug( LDAP_DEBUG_ARGS, " %s", anew->an_name.bv_val, 0, 0 );
#endif
}
@ -255,7 +274,7 @@ do_search(
if( rc == LDAP_COMPARE_TRUE ) {
send_search_entry( NULL, conn, op,
entry, attrs, attrsonly, NULL );
entry, al, attrsonly, NULL );
}
entry_free( entry );
@ -311,7 +330,7 @@ do_search(
if ( be->be_search ) {
(*be->be_search)( be, conn, op, &pbase, &nbase,
scope, deref, sizelimit,
timelimit, filter, fstr.bv_val, attrs, attrsonly );
timelimit, filter, fstr.bv_val, al, attrsonly );
} else {
send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
NULL, "operation not supported within namingContext", NULL, NULL );
@ -324,8 +343,10 @@ return_results:;
if( fstr.bv_val != NULL) free( fstr.bv_val );
if( filter != NULL) filter_free( filter );
if ( attrs != NULL ) {
ber_bvecfree( attrs );
for (; al; al=anew ) {
anew = al->an_next;
free(al->an_name.bv_val);
free(al);
}
return rc;

View file

@ -456,6 +456,12 @@ typedef struct slap_attr_desc {
#define SLAP_DESC_BINARY 0x1U
} AttributeDescription;
typedef struct slap_attr_name {
struct slap_attr_name *an_next;
struct berval an_name;
AttributeDescription *an_desc;
} AttributeName;
#define slap_ad_is_lang(ad) ( (ad)->ad_lang.bv_len != 0 )
#define slap_ad_is_binary(ad) ( (int)((ad)->ad_flags & SLAP_DESC_BINARY) ? 1 : 0 )
@ -825,7 +831,7 @@ typedef struct slap_acl {
slap_style_t acl_dn_style;
regex_t acl_dn_re;
struct berval acl_dn_pat;
struct berval **acl_attrs;
AttributeName *acl_attrs;
/* "by" part: list of who has what access to the entries */
Access *acl_access;
@ -1047,7 +1053,7 @@ typedef int (BI_op_search) LDAP_P((BackendDB *bd,
int scope, int deref,
int slimit, int tlimit,
Filter *f, const char *filterstr,
struct berval **attrs, int attrsonly));
AttributeName *attrs, int attrsonly));
typedef int (BI_op_compare)LDAP_P((BackendDB *bd,
struct slap_conn *c, struct slap_op *o,
struct berval *dn, struct berval *ndn,
@ -1109,7 +1115,7 @@ typedef int (BI_acl_attribute) LDAP_P((Backend *bd,
typedef int (BI_operational) LDAP_P((Backend *bd,
struct slap_conn *c, struct slap_op *o,
Entry *e, struct berval **attrs, int opattrs, Attribute **a ));
Entry *e, AttributeName *attrs, int opattrs, Attribute **a ));
typedef int (BI_connection_init) LDAP_P((BackendDB *bd,
struct slap_conn *c));

View file

@ -108,7 +108,7 @@ send_search_entry(
Connection *conn,
Operation *op,
Entry *e,
struct berval **attrs,
AttributeName *attrs,
int attrsonly,
LDAPControl **ctrls
)