]> git.sur5r.net Git - openldap/commitdiff
Use of slap_schema.si_ad_entryUUID in bdb_psearch()
authorJong Hyuk Choi <jongchoi@openldap.org>
Mon, 28 Oct 2002 23:57:54 +0000 (23:57 +0000)
committerJong Hyuk Choi <jongchoi@openldap.org>
Mon, 28 Oct 2002 23:57:54 +0000 (23:57 +0000)
servers/slapd/Makefile.in
servers/slapd/back-bdb/lcup.c
servers/slapd/main.c
servers/slapd/proto-slap.h

index 1214f558128eb40c39d71a73b29e6088cda8562b..717b91dc7050bdc08269440676b9e01c0c938937 100644 (file)
@@ -19,7 +19,7 @@ SRCS  = main.c daemon.c connection.c search.c filter.c add.c cr.c \
                schemaparse.c ad.c at.c mr.c syntax.c oc.c saslauthz.c \
                oidm.c starttls.c index.c sets.c referral.c \
                root_dse.c sasl.c module.c suffixalias.c mra.c mods.c \
-               limits.c backglue.c operational.c matchedValues.c lcup.c \
+               limits.c backglue.c operational.c matchedValues.c \
                $(@PLAT@_SRCS)
 
 OBJS   = main.o daemon.o connection.o search.o filter.o add.o cr.o \
@@ -32,7 +32,7 @@ OBJS  = main.o daemon.o connection.o search.o filter.o add.o cr.o \
                schemaparse.o ad.o at.o mr.o syntax.o oc.o saslauthz.o \
                oidm.o starttls.o index.o sets.o referral.o \
                root_dse.o sasl.o module.o suffixalias.o mra.o mods.o \
-               limits.o backglue.o operational.o matchedValues.o lcup.o \
+               limits.o backglue.o operational.o matchedValues.o \
                $(@PLAT@_OBJS)
 
 LDAP_INCDIR= ../../include
index 3fe65aa605a569bc521970f7b5ed0b6d5f3cc402..4897f4e2c4d37b789e3513ee19e4a79c31f13a44 100644 (file)
@@ -1,4 +1,5 @@
 /* lcup.c - lcup operations */
+/* $OpenLDAP$ */
 /*
  * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -123,14 +124,21 @@ bdb_psearch(
        Filter          *filter    = LDAP_LIST_FIRST(&ps_op->psearch_spec)->filter;
        struct berval *filterstr = LDAP_LIST_FIRST(&ps_op->psearch_spec)->filterstr;
        int             attrsonly  = LDAP_LIST_FIRST(&ps_op->psearch_spec)->attrsonly;
-       AttributeName   *attrs;
+       AttributeName   uuid_attr[2];
+       AttributeName   *attrs = uuid_attr;
 
        if ( psearch_type != LCUP_PSEARCH_BY_DELETE &&
                psearch_type != LCUP_PSEARCH_BY_SCOPEOUT )
        {
                attrs = LDAP_LIST_FIRST(&ps_op->psearch_spec)->attrs;
        } else {
-               attrs = uuid_attr;
+               attrs[0].an_desc = slap_schema.si_ad_entryUUID;
+               attrs[0].an_oc = NULL;
+               ber_dupbv( &attrs[0].an_name, &attrs[0].an_desc->ad_cname );
+               attrs[1].an_desc = NULL;
+               attrs[1].an_oc = NULL;
+               attrs[1].an_name.bv_len = 0;
+               attrs[1].an_name.bv_val = NULL;
        }
 
 #ifdef NEW_LOGGING
@@ -149,6 +157,9 @@ bdb_psearch(
        default:
                send_ldap_result( ps_conn, ps_op, rc=LDAP_OTHER,
                        NULL, "internal error", NULL, NULL );
+               if ( psearch_type == LCUP_PSEARCH_BY_DELETE ||
+                    psearch_type == LCUP_PSEARCH_BY_SCOPEOUT )
+                       ch_free( attrs[0].an_name.bv_val );
                return rc;
        }
 
@@ -185,6 +196,9 @@ dn2entry_retry:
                send_ldap_result( ps_conn, ps_op, LDAP_BUSY,
                        NULL, "ldap server busy", NULL, NULL );
                LOCK_ID_FREE( bdb->bi_dbenv, locker );
+               if ( psearch_type == LCUP_PSEARCH_BY_DELETE ||
+                    psearch_type == LCUP_PSEARCH_BY_SCOPEOUT )
+                       ch_free( attrs[0].an_name.bv_val );
                return LDAP_BUSY;
        case DB_LOCK_DEADLOCK:
        case DB_LOCK_NOTGRANTED:
@@ -201,6 +215,9 @@ dn2entry_retry:
                send_ldap_result( ps_conn, ps_op, rc=LDAP_OTHER,
                        NULL, "internal error", NULL, NULL );
                LOCK_ID_FREE( bdb->bi_dbenv, locker );
+               if ( psearch_type == LCUP_PSEARCH_BY_DELETE ||
+                    psearch_type == LCUP_PSEARCH_BY_SCOPEOUT )
+                       ch_free( attrs[0].an_name.bv_val );
                return rc;
        }
 
@@ -237,6 +254,9 @@ dn2entry_retry:
                LOCK_ID_FREE( bdb->bi_dbenv, locker );
                if ( refs ) ber_bvarray_free( refs );
                if ( matched_dn.bv_val ) ber_memfree( matched_dn.bv_val );
+               if ( psearch_type == LCUP_PSEARCH_BY_DELETE ||
+                    psearch_type == LCUP_PSEARCH_BY_SCOPEOUT )
+                       ch_free( attrs[0].an_name.bv_val );
                return rc;
        }
 
@@ -274,6 +294,9 @@ dn2entry_retry:
                LOCK_ID_FREE( bdb->bi_dbenv, locker );
                ber_bvarray_free( refs );
                ber_memfree( matched_dn.bv_val );
+               if ( psearch_type == LCUP_PSEARCH_BY_DELETE ||
+                    psearch_type == LCUP_PSEARCH_BY_SCOPEOUT )
+                       ch_free( attrs[0].an_name.bv_val );
                return 1;
        }
 
@@ -735,88 +758,91 @@ dn2entry_retry:
                                                ber_dupbv( &ctrls[0]->ldctl_value, bv );
                                                
                                                result = send_search_entry( be, ps_conn, ps_op,
-                                                       e, attrs, attrsonly, ctrls);
+                                                               e, attrs, attrsonly, ctrls);
 
-                                               ch_free( ctrls[0]->ldctl_value.bv_val );
-                                               ch_free( ctrls[0] );
-                                               ber_free( ber, 1 );
-                                               ber_bvfree( bv );
+                                                       ch_free( ctrls[0]->ldctl_value.bv_val );
+                                                       ch_free( ctrls[0] );
+                                                       ber_free( ber, 1 );
+                                                       ber_bvfree( bv );
 
-                                               if ( psearch_type == LCUP_PSEARCH_BY_MODIFY ) {
-                                                       struct psid_entry* psid_e;
-                                                       LDAP_LIST_FOREACH( psid_e, &op->premodify_list,
-                                                               link)
-                                                       {
-                                                               if( psid_e->ps ==
-                                                                       LDAP_LIST_FIRST(&ps_op->psearch_spec))
+                                                       if ( psearch_type == LCUP_PSEARCH_BY_MODIFY ) {
+                                                               struct psid_entry* psid_e;
+                                                               LDAP_LIST_FOREACH( psid_e, &op->premodify_list,
+                                                                       link)
                                                                {
-                                                                       LDAP_LIST_REMOVE(psid_e, link);
-                                                                       break;
+                                                                       if( psid_e->ps ==
+                                                                               LDAP_LIST_FIRST(&ps_op->psearch_spec))
+                                                                       {
+                                                                               LDAP_LIST_REMOVE(psid_e, link);
+                                                                               break;
+                                                                       }
                                                                }
+                                                               if (psid_e != NULL) free (psid_e);
                                                        }
-                                                       if (psid_e != NULL) free (psid_e);
-                                               }
 
-                                       } else if ( psearch_type == LCUP_PSEARCH_BY_PREMODIFY ) {
-                                               struct psid_entry* psid_e;
-                                               psid_e = (struct psid_entry *) calloc (1,
-                                                       sizeof(struct psid_entry));
-                                               psid_e->ps = LDAP_LIST_FIRST(&ps_op->psearch_spec);
-                                               LDAP_LIST_INSERT_HEAD( &op->premodify_list,
-                                                       psid_e, link );
+                                               } else if ( psearch_type == LCUP_PSEARCH_BY_PREMODIFY ) {
+                                                       struct psid_entry* psid_e;
+                                                       psid_e = (struct psid_entry *) calloc (1,
+                                                               sizeof(struct psid_entry));
+                                                       psid_e->ps = LDAP_LIST_FIRST(&ps_op->psearch_spec);
+                                                       LDAP_LIST_INSERT_HEAD( &op->premodify_list,
+                                                               psid_e, link );
 
-                                       } else {
-                                               printf("Error !\n");
+                                               } else {
+                                                       printf("Error !\n");
+                                               }
                                        }
-                               }
 
-                               switch (result) {
-                               case 0:         /* entry sent ok */
-                                       nentries++;
-                                       break;
-                               case 1:         /* entry not sent */
-                                       break;
-                               case -1:        /* connection closed */
-                                       rc = LDAP_OTHER;
-                                       goto done;
+                                       switch (result) {
+                                       case 0:         /* entry sent ok */
+                                               nentries++;
+                                               break;
+                                       case 1:         /* entry not sent */
+                                               break;
+                                       case -1:        /* connection closed */
+                                               rc = LDAP_OTHER;
+                                               goto done;
+                                       }
                                }
+                       } else {
+#ifdef NEW_LOGGING
+                               LDAP_LOG ( OPERATION, RESULTS,
+                                       "bdb_search: %ld scope not okay\n", (long) id, 0, 0);
+#else
+                               Debug( LDAP_DEBUG_TRACE,
+                                       "bdb_search: %ld scope not okay\n", (long) id, 0, 0 );
+#endif
                        }
                } else {
 #ifdef NEW_LOGGING
                        LDAP_LOG ( OPERATION, RESULTS,
-                               "bdb_search: %ld scope not okay\n", (long) id, 0, 0);
+                               "bdb_search: %ld does match filter\n", (long) id, 0, 0);
 #else
                        Debug( LDAP_DEBUG_TRACE,
-                               "bdb_search: %ld scope not okay\n", (long) id, 0, 0 );
+                               "bdb_search: %ld does match filter\n",
+                               (long) id, 0, 0 );
 #endif
                }
-       } else {
-#ifdef NEW_LOGGING
-               LDAP_LOG ( OPERATION, RESULTS,
-                       "bdb_search: %ld does match filter\n", (long) id, 0, 0);
-#else
-               Debug( LDAP_DEBUG_TRACE,
-                       "bdb_search: %ld does match filter\n",
-                       (long) id, 0, 0 );
-#endif
-       }
 
-test_done:
-       rc = LDAP_SUCCESS;
+       test_done:
+               rc = LDAP_SUCCESS;
 
-done:
-       if ( csnfeq.f_ava != NULL && csnfeq.f_av_value.bv_val != NULL ) {
-               ch_free( csnfeq.f_av_value.bv_val );
-       }
-       
-       if ( csnfge.f_ava != NULL && csnfge.f_av_value.bv_val != NULL ) {
-               ch_free( csnfge.f_av_value.bv_val );
-       }
+       done:
+               if ( csnfeq.f_ava != NULL && csnfeq.f_av_value.bv_val != NULL ) {
+                       ch_free( csnfeq.f_av_value.bv_val );
+               }
+               
+               if ( csnfge.f_ava != NULL && csnfge.f_av_value.bv_val != NULL ) {
+                       ch_free( csnfge.f_av_value.bv_val );
+               }
 
-       LOCK_ID_FREE( bdb->bi_dbenv, locker );
+               LOCK_ID_FREE( bdb->bi_dbenv, locker );
 
-       if( v2refs ) ber_bvarray_free( v2refs );
-       if( realbase.bv_val ) ch_free( realbase.bv_val );
+               if( v2refs ) ber_bvarray_free( v2refs );
+               if( realbase.bv_val ) ch_free( realbase.bv_val );
+               if ( psearch_type == LCUP_PSEARCH_BY_DELETE ||
+                    psearch_type == LCUP_PSEARCH_BY_SCOPEOUT )
+                       ch_free( attrs[0].an_name.bv_val );
 
        return rc;
 }
index 879588cbc2d83f4cf58d8d14c17c6b3beb923076..bda792fbf84ae5785885c99288fd3f7a3dc549df 100644 (file)
@@ -395,10 +395,6 @@ int main( int argc, char **argv )
                goto destroy;
        }
 
-#ifdef LDAP_CLIENT_UPDATE
-       build_uuid_attr();
-#endif
-
 #ifdef HAVE_TLS
        /* Library defaults to full certificate checking. This is correct when
         * a client is verifying a server because all servers should have a
index b4e2a7d597e84212dd913b1da269fb0881a6c133..441007c0bb0546f45d8573254a5013a3ccb2491e 100644 (file)
@@ -1052,16 +1052,6 @@ LDAP_SLAPD_F (int) value_add_one LDAP_P((
        BerVarray *vals,
        struct berval *addval ));
 
-#ifdef LDAP_CLIENT_UPDATE
-/*
- * lcup.c
- */
-
-extern AttributeName uuid_attr[2];
-
-LDAP_SLAPD_F (int) build_uuid_attr LDAP_P ((void));
-#endif
-
 /*
  * Other...
  */