From 0c67c0493bfc2a639c89f827c7085785be90c38e Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 15 Apr 2003 23:11:31 +0000 Subject: [PATCH] more cleanup; small improvements --- servers/slapd/back-sql/bind.c | 6 +++++- servers/slapd/back-sql/entry-id.c | 21 ++++++--------------- servers/slapd/back-sql/other.c | 2 +- servers/slapd/back-sql/search.c | 18 ++---------------- 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/servers/slapd/back-sql/bind.c b/servers/slapd/back-sql/bind.c index fd3515d1f7..74dd71a2d9 100644 --- a/servers/slapd/back-sql/bind.c +++ b/servers/slapd/back-sql/bind.c @@ -29,6 +29,7 @@ backsql_bind( Operation *op, SlapReply *rs ) Entry *e, user_entry; Attribute *a; backsql_srch_info bsi; + AttributeName anlist[2]; int rc; Debug( LDAP_DEBUG_TRACE, "==>backsql_bind()\n", 0, 0, 0 ); @@ -74,8 +75,11 @@ backsql_bind( Operation *op, SlapReply *rs ) return 1; } + anlist[0].an_name = password->ad_cname; + anlist[0].an_desc = password; + anlist[1].an_name.bv_val = NULL; backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE, - -1, -1, -1, NULL, dbh, op, NULL ); + -1, -1, -1, NULL, dbh, op, anlist ); e = backsql_id2entry( &bsi, &user_entry, &user_id ); if ( e == NULL ) { Debug( LDAP_DEBUG_TRACE, "backsql_bind(): " diff --git a/servers/slapd/back-sql/entry-id.c b/servers/slapd/back-sql/entry-id.c index 725367a9c9..deb7c6a051 100644 --- a/servers/slapd/back-sql/entry-id.c +++ b/servers/slapd/back-sql/entry-id.c @@ -370,8 +370,6 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) e->e_attrs = NULL; e->e_private = NULL; - /* if ( bsi->base_dn != NULL)??? */ - e->e_id = eid->id; if ( bsi->attrs != NULL ) { @@ -380,16 +378,7 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) for ( i = 0; bsi->attrs[ i ].an_name.bv_val; i++ ) { AttributeName *attr = &bsi->attrs[ i ]; - if ( attr->an_desc == ad_oc -#if 0 /* FIXME: what is 0.10 ? */ - || !BACKSQL_NCMP( &attr->an_name, &bv_n_0_10 ) -#endif - ) { -#if 0 - backsql_entry_addattr( bsi->e, - &bv_n_objectclass, - BACKSQL_OC_NAME( bsi->oc ) ); -#endif + if ( attr->an_desc == ad_oc ) { continue; } @@ -438,10 +427,12 @@ backsql_id2entry( backsql_srch_info *bsi, Entry *e, backsql_entryID *eid ) return NULL; } - if ( bsi->bsi_flags | BSQL_SF_ALL_OPER + if ( ( bsi->bsi_flags | BSQL_SF_ALL_OPER ) || an_find( bsi->attrs, &AllOper ) ) { - if ( attr_merge_normalize_one( bsi->e, ad_soc, &soc, - bsi->op->o_tmpmemctx ) ) { + rc = attr_merge_normalize_one( bsi->e, + slap_schema.si_ad_structuralObjectClass, + &soc, bsi->op->o_tmpmemctx ); + if ( rc != LDAP_SUCCESS ) { entry_free( e ); return NULL; } diff --git a/servers/slapd/back-sql/other.c b/servers/slapd/back-sql/other.c index 5e53fd5f1d..acca1a6982 100644 --- a/servers/slapd/back-sql/other.c +++ b/servers/slapd/back-sql/other.c @@ -57,7 +57,7 @@ backsql_compare( Operation *op, SlapReply *rs ) anlist[0].an_desc = op->oq_compare.rs_ava->aa_desc; anlist[1].an_name.bv_val = NULL; backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE, - -1, -1, -1, NULL, dbh, op, anlist); + -1, -1, -1, NULL, dbh, op, anlist ); e = backsql_id2entry( &bsi, &user_entry, &user_id ); if ( e == NULL ) { Debug( LDAP_DEBUG_TRACE, "backsql_compare(): " diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index d235f8f995..77f6e89537 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -84,7 +84,7 @@ backsql_attrlist_add( backsql_srch_info *bsi, AttributeDescription *ad ) void backsql_init_search( backsql_srch_info *bsi, - struct berval *nbase, + struct berval *base, int scope, int slimit, int tlimit, @@ -96,7 +96,7 @@ backsql_init_search( { AttributeName *p; - bsi->base_dn = nbase; + bsi->base_dn = base; bsi->scope = scope; bsi->slimit = slimit; bsi->tlimit = tlimit; @@ -989,20 +989,6 @@ backsql_oc_get_candidates( void *v_oc, void *v_bsi ) int backsql_search( Operation *op, SlapReply *rs ) - /* - BackendDB *be, - Connection *conn, - Operation *op, - struct berval *base, - struct berval *nbase, - int scope, - int deref, - int slimit, - int tlimit, - Filter *filter, - struct berval *filterstr, - AttributeName *attrs, - int attrsonly ) */ { backsql_info *bi = (backsql_info *)op->o_bd->be_private; SQLHDBC dbh; -- 2.39.5