]> git.sur5r.net Git - openldap/commitdiff
more cleanup; small improvements
authorPierangelo Masarati <ando@openldap.org>
Tue, 15 Apr 2003 23:11:31 +0000 (23:11 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 15 Apr 2003 23:11:31 +0000 (23:11 +0000)
servers/slapd/back-sql/bind.c
servers/slapd/back-sql/entry-id.c
servers/slapd/back-sql/other.c
servers/slapd/back-sql/search.c

index fd3515d1f7c294a54959ba9ee5718f075385441b..74dd71a2d963d35428f820a4043009c01838cdf0 100644 (file)
@@ -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(): "
index 725367a9c96f25a1e1397603e6f93f80f8e0260e..deb7c6a05121d3a7a5632fc853aa27b6f1802fdb 100644 (file)
@@ -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;
                        }
index 5e53fd5f1d28efbfb2bbd423cc17e2b5d0ee8245..acca1a6982118a1ccf72c8a5419b63ac4f5a841f 100644 (file)
@@ -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(): "
index d235f8f995a3cedf0b5b9644526a5727c7227b4d..77f6e895371ddc0dc174cb58c855ecda56c3b4cb 100644 (file)
@@ -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;