#51218 Issue 49487 - Cleanup unused code
Closed 2 years ago by spichugi. Opened 2 years ago by mreynolds.
mreynolds/389-ds-base issue49487  into  master

@@ -3614,12 +3614,6 @@ 

           * "don't know".

          */

          return (ACL_ERR);

- #if 0

-         if ( eval_read )

-             return LDAP_INSUFFICIENT_ACCESS;

-         else

-             return ACL_ERR;

- #endif

      }

  

      for (i = 0; i < c_evalContext->acle_numof_attrs; i++) {

@@ -84,16 +84,6 @@ 

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_MODRDN_FN, (void *)aclplugin_preop_modify);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_DELETE_FN, (void *)aclplugin_preop_modify);

  

- #if 0

-     /*

-      * XXXmcs: In order to support access control checking from

-      * extended operations, we need a SLAPI_PLUGIN_PRE_EXTENDED_FN hook.

-      * But today no such entry point exists.

-      */

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_EXTENDED_FN, (void*)aclplugin_preop_modify);

- #endif

- 

- 

      slapi_log_err(SLAPI_LOG_PLUGIN, plugin_name, "<= acl_preop_Init %d\n", rc);

      return (rc);

  }

@@ -166,43 +166,6 @@ 

                    "posix_group_task_destructor <--\n");

  }

  

- #if 0 /* NOT USED */

- static int

- posix_group_del_memberuid_callback(Slapi_Entry *e, void *callback_data)

- {

-     int rc = 0;

-     LDAPMod mod;

-     LDAPMod *mods[2];

-     char *val[2];

-     Slapi_PBlock *mod_pb = 0;

-     cb_data *the_cb_data = (cb_data *) callback_data;

- 

-     mod_pb = slapi_pblock_new();

- 

-     mods[0] = &mod;

-     mods[1] = 0;

- 

-     val[0] = 0; /* all */

-     val[1] = 0;

- 

-     mod.mod_op = LDAP_MOD_DELETE;

-     mod.mod_type = "memberuid";

-     mod.mod_values = val;

- 

-     slapi_modify_internal_set_pb_ext(mod_pb, slapi_entry_get_sdn(e), mods, 0, 0,

-                                      posix_winsync_get_plugin_identity(), 0);

- 

-     slapi_pblock_set(mod_pb, SLAPI_TXN, the_cb_data->txn);

-     slapi_modify_internal_pb(mod_pb);

- 

-     slapi_pblock_get(mod_pb, SLAPI_PLUGIN_INTOP_RESULT, &rc);

- 

-     slapi_pblock_destroy(mod_pb);

- 

-     return rc;

- }

- #endif

- 

  static int

  posix_group_fix_memberuid(char *dn, char *filter_str, void *txn)

  {

@@ -399,12 +399,6 @@ 

      int tries = 0;

      int use_flag = flag;

  

- #if 0 /* txn control seems not improving anything so turn it off */

-     if ( *(_pool->pl_dbenv) ) {

-         txn_begin( *(_pool->pl_dbenv), NULL, &txn, 0 );

-     }

- #endif

- 

      if (NULL == buf) {

          slapi_log_err(SLAPI_LOG_ERR, get_thread_private_agmtname(),

                        "clcache_load_buffer_bulk - NULL buf\n");
@@ -466,12 +460,6 @@ 

                        tries);

      }

  

- #if 0 /* txn control seems not improving anything so turn it off */

-     if ( txn ) {

-         txn->commit ( txn, DB_TXN_NOSYNC );

-     }

- #endif

- 

      PR_Unlock(buf->buf_busy_list->bl_lock);

  

      buf->buf_record_ptr = NULL;

@@ -434,21 +434,6 @@ 

      testBackupRestore();

  

      testLDIF();

- 

- /* testTrimming ();*/

- 

- #if 0

-     /* xxxPINAKI */

-     /* these tests are not working correctly...the call to db->put() */

-     /* just hangs forever */

-     slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,

-                     "Starting single threaded performance measurement ...\n");

-     testPerformance ();

- 

-     slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name_cl,

-                     "Starting multi threaded performance measurement ...\n");

-     testPerformanceMT ();

- #endif

  }

  

  static int

@@ -981,11 +981,6 @@ 

  static void

  views_cache_create_inclusion_filter(viewEntry *pView)

  {

- #if 0

-     viewEntry *head = theCache.pCacheViews;

- #endif

-     /*    viewEntry *current; */

-     /*    Slapi_Filter *view_filter; */

      char *view_filter_str;

  

      if (pView->includeChildViewsFilter) {
@@ -993,59 +988,15 @@ 

          slapi_filter_free(pView->includeChildViewsFilter, 1);

          pView->includeChildViewsFilter = 0;

      }

- #if 0

-     for(current = head; current != NULL; current = current->list.pNext)

-     {

-         Slapi_DN *viewDN;

-         Slapi_RDN *viewRDN;

-         char *viewRDNstr;

-         char *buf = 0;

-         Slapi_Filter *viewSubFilter;

- 

-         /* if this is this a descendent, ignore it */

-         if(slapi_dn_issuffix(current->pDn,pView->pDn) && !(current == pView))

-             continue;

- 

-         viewDN = slapi_sdn_new_dn_byref(current->pDn);

-         viewRDN = slapi_rdn_new();

- 

-         slapi_sdn_get_rdn(viewDN,viewRDN);

-         viewRDNstr = (char *)slapi_rdn_get_rdn(viewRDN);

- 

-         buf = slapi_ch_calloc(1, strlen(viewRDNstr) + 11 ); /* 3 for filter */

-         sprintf(buf, "(%s)", viewRDNstr );

-         viewSubFilter = slapi_str2filter( buf );

-         if (!viewSubFilter) {

-             slapi_log_err(SLAPI_LOG_ERR, VIEWS_PLUGIN_SUBSYSTEM,

-                             "views_cache_create_inclusion_filter - View filter [%s] in entry [%s] is invalid\n",

-                             buf, current->pDn);

-         }

- 

-         if(pView->includeChildViewsFilter && viewSubFilter)

-             pView->includeChildViewsFilter = slapi_filter_join_ex( LDAP_FILTER_OR, pView->includeChildViewsFilter, viewSubFilter, 0 );

-         else

-             pView->includeChildViewsFilter = viewSubFilter;

- 

-         slapi_ch_free((void **)&buf);

-         slapi_sdn_free(&viewDN);

-         slapi_rdn_free(&viewRDN);

  

-         child_count++;

-     }

- #endif

- 

-     /* exclude all other view entries but decendents */

-     /*    pView->includeChildViewsFilter = slapi_filter_join_ex( LDAP_FILTER_NOT, pView->includeChildViewsFilter, NULL, 0 );

- */

      /* it seems reasonable to include entries which

-      * may not fit the view decription but which

+      * may not fit the view description but which

       * are actually *contained* in the view

       * therefore we use parentids for the view

       * filter

       */

  

- 

-     /* add decendents */

+     /* add descendants */

      pView->includeChildViewsFilter = views_cache_create_descendent_filter(pView, PR_TRUE);

  

      /* add this view */
@@ -1059,39 +1010,6 @@ 

      PR_smprintf_free(view_filter_str);

      view_filter_str = NULL;

  

-     /* and make sure the this applies only to views */

- 

-     /*    if(pView->includeChildViewsFilter)

-     {*/

-     /*  Not necessary since we now use entryid in the filter,

-     so all will be views anyway, and the less sub-filters

-     the better

-         view_filter_str = strdup("(objectclass=" VIEW_OBJECTCLASS ")");

-         view_filter = slapi_str2filter( view_filter_str );

- */

-     /* child views first because entryid indexed

-          * and makes evaluation faster when a bunch

-          * of indexed filter evaluations with only one

-          * target are evaluated first rather than an

-          * indexed filter which will provide many entries

-          * that may trigger an index evaluation short

-          * circuit.  i.e. if one of the child filters is

-          * true then we have one entry, if not, then we

-          * have used indexes completely to determine that

-          * no entry matches and (objectclass=nsview) is never

-          * evaluated.

-          * I should imagine this will hold for all but the

-          * very deepest, widest view trees when subtree

-          * searches are performed from the top

-          */

-     /*        pView->includeChildViewsFilter = slapi_filter_join_ex( LDAP_FILTER_AND, pView->includeChildViewsFilter, view_filter, 0 );

-     }

-     else

-     {

-         view_filter_str = strdup("(objectclass=nsviewincludenone)");  */ /* hackery to get the right result */

- /*        pView->includeChildViewsFilter = slapi_str2filter( view_filter_str );

-     }

- */

  #ifdef _VIEW_DEBUG_FILTERS

      slapi_filter_to_string(pView->includeChildViewsFilter, pView->includeChildViewsFilter_str, sizeof(pView->includeChildViewsFilter_str));

  #endif

@@ -128,82 +128,6 @@ 

      AS_UNLOCK_WRITE(oid2asi_lock);

  }

  

- 

- #if 0

- static int

- check_oid( const char *oid ) {

- 

-   int i = 0, length_oid = 0, rc = 0;

- 

-   if ( oid == NULL) {

-     /* this is bad */

-     slapi_log_err(SLAPI_LOG_ERR, "check_oid", "NULL passed to check_oid\n");

-     return 0;

-   }

- 

-   length_oid = strlen(oid);

-   if (length_oid < 4) {

-     /* this is probably bad */

-     slapi_log_err(SLAPI_LOG_ERR, "check_oid", "Bad oid %s passed to check_oid\n",oid);

-     return 0;

-   }

- 

-   rc = strcasecmp(oid+(length_oid-4), "-oid");

- 

-   if ( 0 == rc ) {

-     return 1;

-   }

- 

-   /* If not, the OID must begin and end with a digit, and contain only

-      digits and dots */

- 

-   if ( !isdigit(oid[0]) ||

-        !isdigit(oid[length_oid-1]) ) {

-     slapi_log_err(SLAPI_LOG_ERR, "check_oid", "Non numeric oid %s passed to check_oid\n",oid);

-     return 0;

-   }

- 

-   /* check to see that it contains only digits and dots */

-   for ( i = 0; i < length_oid; i++ ) {

-     if ( !isdigit(oid[i]) && oid[i] != '.'  ){

-       slapi_log_err(SLAPI_LOG_ERR, "check_oid", "Non numeric oid %s passed to check_oid\n",oid);

-       return 0;

-     }

-   }

- 

-   /* The oid is OK if we're here */

-   return 1;

- 

- 

- }

- #endif

- 

- #define NBUCKETS(ht) (1 << (PL_HASH_BITS - (ht)->shift))

- 

- #if 0

- static int

- attr_syntax_check_oids()

- {

-     int ii = 0;

-     int nbad = 0;

-     AS_LOCK_READ(oid2asi_lock);

-     ii = NBUCKETS(oid2asi);

-     for (;ii;--ii) {

-         PLHashEntry *he = oid2asi->buckets[ii-1];

-         for (; he; he = he->next) {

-             if (!check_oid(he->key)) {

-                 slapi_log_err(SLAPI_LOG_ERR, "attr_syntax_check_oids", "bad oid %s in bucket %d\n",

-                           he->key, ii-1);

-                 nbad++;

-             }

-         }

-     }

- 

-     AS_UNLOCK_READ(oid2asi_lock);

-     return nbad;

- }

- #endif

- 

  void

  attr_syntax_free(struct asyntaxinfo *a)

  {

@@ -341,71 +341,3 @@ 

  

      return rval;

  }

- 

- /* Here's the upgrade process :

-     Delete all the keys from the parentid index

-     Scan the id2entry file:

-         Remove any hassubordinates attribute present

-         Update the parentid index, maintaining a hash of high-count parents

-     Scan the newly created parentid index updating the subordinatecount attributes.

- 

-     Most of the functionality is implemented in the import code.

-  */

- #if 0

- static int upgrade_db_3x_40(backend *be)

- {

-     struct ldbminfo *li = (struct ldbminfo *) be->be_database->plg_private;

-     int ret = 0;

-     back_txn        txn;

- 

-     static char* indexes_modified[] = {"parentid", "numsubordinates", NULL};

- 

-     slapi_log_err(SLAPI_LOG_WARNING, "upgrade_db_3x_40",

-         "WARNING: Detected a database older than this server, upgrading data...\n");

- 

-     dblayer_txn_init(li,&txn);

-     ret = dblayer_txn_begin(li,NULL,&txn);

-     if (0 != ret) {

-         ldbm_nasty("upgrade_db_3x_40",filename,69,ret);

-         goto error;

-     }

-     ret = indexfile_delete_all_keys(be,"parentid",&txn);

-     if (0 != ret) {

-         ldbm_nasty("upgrade_db_3x_40",filename,70,ret);

-         goto error;

-     }

- 

-     {

-         Slapi_Mods smods;

-            slapi_mods_init(&smods,1);

-         /* Mods are to remove the hassubordinates attribute */

-         slapi_mods_add(&smods, LDAP_MOD_DELETE, "hassubordinates", 0, NULL);

-         /* This function takes care of generating the subordinatecount attribute and indexing it */

-         ret = indexfile_primary_modifyall(be,slapi_mods_get_ldapmods_byref(&smods),indexes_modified,&txn);

-         slapi_mods_done(&smods);

-     }

- 

-     if (0 != ret) {

-         ldbm_nasty("upgrade_db_3x_40",filename,61,ret);

-     }

- 

- error:

-     if (0 != ret ) {

-         dblayer_txn_abort(li,&txn);

-     } else {

-         ret = dblayer_txn_commit(li,&txn);

-         if (0 != ret) {

-             ldbm_nasty("upgrade_db_3x_40",filename,60,ret);

-         } else {

-             /* Now update DBVERSION file */

-         }

-     }

-     if (0 == ret) {

-         slapi_log_err(SLAPI_LOG_INFO, "upgrade_db_3x_40", "...upgrade complete.\n");

-     } else {

-         slapi_log_err(SLAPI_LOG_ERR, "upgrade_db_3x_40", "Attempt to upgrade the older database FAILED.\n");

-     }

-     return ret;

- }

- 

- #endif

@@ -1800,150 +1800,6 @@ 

      return index_range_read_ext(pb, be, type, indextype, operator, val, nextval, range, txn, err, 0);

  }

  

- /* DBDB: this function is never actually called */

- #if 0

- static int

- addordel_values(

-     backend *be,

-     DB            *db,

-     char        *type,

-     const char        *indextype,

-     struct berval    **vals,

-     ID            id,

-     int            flags,        /* BE_INDEX_ADD, etc */

-     back_txn        *txn,

-     struct attrinfo    *a,

-     int *idl_disposition,

-     void *buffer_handle

- )

- {

-     int    rc = 0;

-     int  i = 0;

-     DBT    key = {0};

-     DB_TXN    *db_txn = NULL;

-     size_t    plen, vlen, len;

-     char    *tmpbuf = NULL;

-     size_t    tmpbuflen = 0;

-     char    *realbuf;

-     char    *prefix;

- 

-     slapi_log_err(SLAPI_LOG_TRACE, "addordel_values", "%s_values\n",

-            (flags & BE_INDEX_ADD) ? "add" : "del");

- 

-     prefix = index_index2prefix( indextype );

- 

-     if (prefix == NULL) {

-         slapi_log_err(SLAPI_LOG_ERR, "addordel_values", "%s_values: NULL prefix\n",

-             (flags & BE_INDEX_ADD) ? "add" : "del");

-         return( -1 );

-     }

- 

-     if ( vals == NULL ) {

-         key.dptr  = prefix;

-         key.dsize = strlen( prefix ) + 1; /* include null terminator */

-         key.flags = DB_DBT_MALLOC;

-         if (NULL != txn) {

-             db_txn = txn->back_txn_txn;

-         }

- 

-         if (flags & BE_INDEX_ADD) {

-             rc = idl_insert_key( be, db, &key, id, db_txn, a, idl_disposition );

-         } else {

-             rc = idl_delete_key( be, db, &key, id, db_txn, a );

-             /* check for no such key/id - ok in some cases */

-             if ( rc == DB_NOTFOUND || rc == -666 ) {

-                 rc = 0;

-             }

-         }

- 

-         if ( rc != 0)

-         {

-             ldbm_nasty("addordel_values", errmsg, 1096, rc);

-         }

-         index_free_prefix (prefix);

-         if (NULL != key.dptr && prefix != key.dptr)

-             slapi_ch_free( (void**)&key.dptr );

-         slapi_log_err(SLAPI_LOG_TRACE, "addordel_values", "%s_values %d\n",

-                (flags & BE_INDEX_ADD) ? "add" : "del", rc);

-         return( rc );

-     }

- 

-     plen = strlen( prefix );

-     for ( i = 0; vals[i] != NULL; i++ ) {

-         vlen = vals[i]->bv_len;

-         len = plen + vlen;

- 

-         if ( len < tmpbuflen ) {

-             realbuf = tmpbuf;

-         } else {

-             tmpbuf = slapi_ch_realloc( tmpbuf, len + 1 );

-             tmpbuflen = len + 1;

-             realbuf = tmpbuf;

-         }

- 

-         memcpy( realbuf, prefix, plen );

-         memcpy( realbuf+plen, vals[i]->bv_val, vlen );

-         realbuf[len] = '\0';

-         key.dptr = realbuf;

-         key.size = plen + vlen + 1;

-                 /* should be okay to use USERMEM here because we know what

-                  * the key is and it should never return a different value

-                  * than the one we pass in.

-                  */

-         key.flags = DB_DBT_USERMEM;

-                 key.ulen = tmpbuflen;

-         if (slapi_is_loglevel_set(LDAP_DEBUG_TRACE)) {

-             char encbuf[BUFSIZ];

- 

-             slapi_log_err(SLAPI_LOG_TRACE, "addordel_values", "%s_value(\"%s\")\n",

-                    (flags & BE_INDEX_ADD) ? "add" : "del",

-                    encoded (&key, encbuf));

-         }

- 

-         if (NULL != txn) {

-             db_txn = txn->back_txn_txn;

-         }

- 

-         if ( flags & BE_INDEX_ADD ) {

-             if (buffer_handle) {

-                 rc = index_buffer_insert(buffer_handle,&key,id,be,db_txn,a);

-                 if (rc == -2) {

-                     rc = idl_insert_key( be, db, &key, id, db_txn, a, idl_disposition );

-                 }

-             } else {

-                 rc = idl_insert_key( be, db, &key, id, db_txn, a, idl_disposition );

-             }

-         } else {

-             rc = idl_delete_key( be, db, &key, id, db_txn, a );

-             /* check for no such key/id - ok in some cases */

-             if ( rc == DB_NOTFOUND || rc == -666 ) {

-                 rc = 0;

-             }

-         }

-         if ( rc != 0 ) {

-             ldbm_nasty("addordel_values", errmsg, 1100, rc);

-             break;

-         }

-         if ( NULL != key.dptr && realbuf != key.dptr) {    /* realloc'ed */

-             tmpbuf = key.dptr;

-             tmpbuflen = key.size;

-         }

-     }

-     index_free_prefix (prefix);

-     if ( tmpbuf != NULL ) {

-         slapi_ch_free( (void**)&tmpbuf );

-     }

- 

-     if ( rc != 0 )

-     {

-         ldbm_nasty("addordel_values", errmsg, 1110, rc);

-     }

-     slapi_log_err(SLAPI_LOG_TRACE, "addordel_values", "%s_values %d\n",

-         (flags & BE_INDEX_ADD) ? "add" : "del", rc);

-     return( rc );

- }

- #endif

- 

  static int

  addordel_values_sv(

      backend *be,

@@ -110,12 +110,8 @@ 

                             (void *)ldbm_back_search);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN,

                             (void *)ldbm_back_next_search_entry);

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN,

-                            (void *)ldbm_back_next_search_entry_ext);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN,

                             (void *)ldbm_back_prev_search_results);

-     rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_ENTRY_RELEASE_FN,

-                            (void *)ldbm_back_entry_release);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN,

                             (void *)ldbm_back_search_results_release);

      rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_DB_COMPARE_FN,

@@ -205,12 +205,6 @@ 

      ldbm_instance_config_add_index_entry(inst, e, flags);

      slapi_entry_free(e);

  

- #if 0 /* don't need copiedfrom */

-     e = ldbm_instance_init_config_entry("copiedfrom","pres",0 ,0);

-     ldbm_instance_config_add_index_entry(inst, e, flags);

-     slapi_entry_free(e);

- #endif

- 

      e = ldbm_instance_init_config_entry(LDBM_NUMSUBORDINATES_STR, "pres", 0, 0, 0);

      ldbm_instance_config_add_index_entry(inst, e, flags);

      slapi_entry_free(e);

@@ -967,25 +967,7 @@ 

                          goto error_return;

                      }

                  }

- #if 0 /* The entryrdn element is already deleted in the index_addordel_entry */

-                 retval = entryrdn_index_entry(be, e, BE_INDEX_DEL, &txn);

-                 if (DB_LOCK_DEADLOCK == retval) {

-                     slapi_log_err(SLAPI_LOG_BACKLDBM,

-                                 "ldbm_back_delete", "(deleting entryrdn) DB_LOCK_DEADLOCK\n");

-                     /* Retry txn */

-                     continue;

-                 }

-                 if (0 != retval) {

-                     slapi_log_err(SLAPI_LOG_ERR,

-                                 "ldbm_back_delete", "(deleting entryrdn) failed, err=%d %s\n",

-                                 retval,

-                                 (msg = dblayer_strerror( retval )) ? msg : "" );

-                     if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1;

-                     DEL_SET_ERROR(ldap_result_code,

-                                   LDAP_OPERATIONS_ERROR, retry_count);

-                     goto error_return;

-                 }

- #endif

+ 

                  retval = entryrdn_index_entry(be, tombstone, BE_INDEX_ADD, &txn);

                  if (DB_LOCK_DEADLOCK == retval) {

                      slapi_log_err(SLAPI_LOG_BACKLDBM,

@@ -79,10 +79,6 @@ 

  static void _entryrdn_dump_rdn_elem(rdn_elem *elem);

  #endif

  static int _entryrdn_open_index(backend *be, struct attrinfo **ai, DB **dbp);

- #if 0 /* not used */

- static char *_entryrdn_encrypt_key(backend *be, const char *key, struct attrinfo *ai);

- static char *_entryrdn_decrypt_key(backend *be, const char *key, struct attrinfo *ai);

- #endif

  static int _entryrdn_get_elem(DBC *cursor, DBT *key, DBT *data, const char *comp_key, rdn_elem **elem, DB_TXN *db_txn);

  static int _entryrdn_get_tombstone_elem(DBC *cursor, Slapi_RDN *srdn, DBT *key, const char *comp_key, rdn_elem **elem, DB_TXN *db_txn);

  static int _entryrdn_put_data(DBC *cursor, DBT *key, DBT *data, char type, DB_TXN *db_txn);
@@ -1619,88 +1615,6 @@ 

      return rc;

  }

  

- #if 0 /* not used */

- /*

-  * We don't support attribute encryption for entryrdn.

-  * Since there is no way to encrypt RDN in the main db id2entry,

-  * encrypting/decrypting entryrdn does not add any benefit to the server.

-  */

- static berval *

- _entryrdn_encrypt_key(backend *be, const char *key, struct attrinfo *ai)

- {

-     int rc = 0;

-     struct berval val = {0};

-     struct berval *encrypted_val = NULL;

-     char *encrypted = NULL;

- 

-     slapi_log_err(SLAPI_LOG_TRACE, "_entryrdn_encrypt_key",

-                                      "--> _entryrdn_encrypt_key\n");

- 

-     if (NULL == key) {

-         slapi_log_err(SLAPI_LOG_ERR, "_entryrdn_encrypt_key", "Empty key\n");

-         goto bail;

-     }

-     if (NULL == be || NULL == key || NULL == ai) {

-         slapi_log_err(SLAPI_LOG_ERR, "_entryrdn_encrypt_key",

-                     "Param error: Empty %s\n",

-                     NULL==be?"be":NULL==key?"key":

-                     NULL==ai?"attrinfo":"unknown");

-         goto bail;

-     }

-     val.bv_val = (void *)key;

-     val.bv_len = strlen(key);

-     rc = attrcrypt_encrypt_index_key(be, ai, &val, &encrypted_val);

-     if (NULL == encrypted_val) {

-         slapi_log_err(SLAPI_LOG_ERR, "_entryrdn_encrypt_key",

-                         "Failed to encrypt index key for %s\n", key);

-     }

- bail:

-     slapi_log_err(SLAPI_LOG_TRACE, "_entryrdn_encrypt_key",

-                                      "<-- _entryrdn_encrypt_key\n");

-     return encrypted_val;

- }

- 

- static char *

- _entryrdn_decrypt_key(backend *be, const char *key, struct attrinfo *ai)

- {

-     int rc = 0;

-     struct berval val = {0};

-     struct berval *decrypted_val = NULL;

-     char *decrypted = NULL;

- 

-     slapi_log_err(SLAPI_LOG_TRACE, "_entryrdn_decrypt_key",

-                                      "--> _entryrdn_decrypt_key\n");

- 

-     if (NULL == key) {

-         slapi_log_err(SLAPI_LOG_ERR, "_entryrdn_decrypt_key", "Empty key\n");

-         goto bail;

-     }

-     if (NULL == be || NULL == key || NULL == ai) {

-         slapi_log_err(SLAPI_LOG_ERR, "_entryrdn_decrypt_key",

-                     "Param error: Empty %s\n",

-                     NULL==be?"be":NULL==key?"key":

-                     NULL==ai?"attrinfo":"unknown");

-         goto bail;

-     }

-     val.bv_val = (void *)key;

-     val.bv_len = strlen(key);

-     rc = attrcrypt_decrypt_index_key(be, ai, &val, &decrypted_val);

-     if (decrypted_val) {

-         /* null terminated string */

-         decrypted = slapi_ch_strdup(decrypted_val->bv_val);

-         ber_bvfree(decrypted_val);

-         goto bail;

-     }

-     slapi_log_err(SLAPI_LOG_ERR, "_entryrdn_decrypt_key",

-             "Failed to decrypt index key for %s\n", key);

- 

- bail:

-     slapi_log_err(SLAPI_LOG_TRACE, "_entryrdn_decrypt_key",

-                                      "<-- _detryrdn_encrypt_key\n");

-     return decrypted;

- }

- #endif

- 

  /* Notes:

   * 1) data->data must be located in the data area (not in the stack).

   *    If c_get reallocate the memory, the given data is freed.

@@ -1248,22 +1248,6 @@ 

  }

  

  static int grok_filter(struct slapi_filter *f);

- #if 0

- /* Helper for grok_filter() */

- static int

- grok_filter_list(struct slapi_filter    *flist)

- {

-     struct slapi_filter    *f;

- 

-     /* Scan the clauses of the AND filter, if any of them fails the grok, then we fail */

-     for ( f = flist; f != NULL; f = f->f_next ) {

-         if ( !grok_filter(f) ) {

-                 return( 0 );

-         }

-     }

-     return( 1 );

- }

- #endif

  

  /* Helper function for can_skip_filter_test() */

  static int
@@ -1382,22 +1366,6 @@ 

      return rc;

  }

  

- 

- /*

-  * Return the next entry in the result set.  The entry is returned

-  * in the pblock.

-  * Returns 0 normally.  If -1 is returned, it means that some

-  * exceptional condition, e.g. timelimit exceeded has occurred,

-  * and this routine has sent a result to the client.  If zero

-  * is returned and no entry is available in the PBlock, then

-  * we've iterated through all the entries.

-  */

- int

- ldbm_back_next_search_entry(Slapi_PBlock *pb)

- {

-     return ldbm_back_next_search_entry_ext(pb, 0);

- }

- 

  /* The reference on the target_entry (base search) is stored in the operation

   * This is to prevent additional cache find/return that require cache lock.

   *
@@ -1419,8 +1387,17 @@ 

      }

  }

  

+ /*

+  * Return the next entry in the result set.  The entry is returned

+  * in the pblock.

+  * Returns 0 normally.  If -1 is returned, it means that some

+  * exceptional condition, e.g. timelimit exceeded has occurred,

+  * and this routine has sent a result to the client.  If zero

+  * is returned and no entry is available in the PBlock, then

+  * we've iterated through all the entries.

+  */

  int

- ldbm_back_next_search_entry_ext(Slapi_PBlock *pb, int use_extension)

+ ldbm_back_next_search_entry(Slapi_PBlock *pb)

  {

      backend *be;

      ldbm_instance *inst;
@@ -1520,15 +1497,15 @@ 

      /* Return to the cache the entry we handed out last time */

      /* If we are using the extension, the front end will tell

       * us when to do this so we don't do it now */

-     if (sr->sr_entry && !use_extension) {

+     if (sr->sr_entry) {

          non_target_cache_return(op, &inst->inst_cache, &(sr->sr_entry));

          sr->sr_entry = NULL;

      }

  

-     if (sr->sr_vlventry != NULL && !use_extension) {

-         /* This empty entry was handed out last time because the ACL check failed on a VLV Search. */

-         /* The empty entry has a pointer to the cache entry dn... make sure we don't free the dn */

-         /* which belongs to the cache entry. */

+     if (sr->sr_vlventry != NULL) {

+         /* This empty entry was handed out last time because the ACL check failed on a VLV Search.

+          * The empty entry has a pointer to the cache entry dn... make sure we don't free the dn

+          * which belongs to the cache entry. */

          slapi_entry_free(sr->sr_vlventry);

          sr->sr_vlventry = NULL;

      }
@@ -1542,9 +1519,6 @@ 

          /* check for abandon */

          if (slapi_op_abandoned(pb) || (NULL == sr)) {

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);

-             if (use_extension) {

-                 slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL);

-             }

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, NULL);

              delete_search_result_set(pb, &sr);

              rc = SLAPI_FAIL_GENERAL;
@@ -1552,15 +1526,11 @@ 

          }

  

          /*

-          * Check this only every few iters to prevent smashing the clock api?

+          * Check time limit, Check this only every few iters to prevent smashing the clock api?

           */

-         /* check time limit */

          if (slapi_timespec_expire_check(&expire_time) == TIMER_EXPIRED) {

-             slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_next_search_entry_ext", "LDAP_TIMELIMIT_EXCEEDED\n");

+             slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_next_search_entry", "LDAP_TIMELIMIT_EXCEEDED\n");

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);

-             if (use_extension) {

-                 slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL);

-             }

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, NULL);

              delete_search_result_set(pb, &sr);

              rc = SLAPI_FAIL_GENERAL;
@@ -1570,9 +1540,6 @@ 

          /* check lookthrough limit */

          if (llimit != -1 && sr->sr_lookthroughcount >= llimit) {

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);

-             if (use_extension) {

-                 slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL);

-             }

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, NULL);

              delete_search_result_set(pb, &sr);

              rc = SLAPI_FAIL_GENERAL;
@@ -1610,9 +1577,6 @@ 

              /* No more entries */

              /* destroy back_search_result_set */

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);

-             if (use_extension) {

-                 slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL);

-             }

              slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, NULL);

              delete_search_result_set(pb, &sr);

              op->o_reverse_search_state = 0;
@@ -1642,18 +1606,17 @@ 

          }

          if (e == NULL) {

              if (err != 0 && err != DB_NOTFOUND) {

-                 slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry_ext", "next_search_entry db err %d\n",

-                               err);

+                 slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry",

+                         "next_search_entry db err %d\n", err);

                  if (LDBM_OS_ERR_IS_DISKFULL(err)) {

                      /* disk full in the middle of returning search results

-                      * is gonna be traumatic.  unavoidable.

-                      */

+                      * is gonna be traumatic.  unavoidable. */

                      slapi_send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL);

                      rc = return_on_disk_full(li);

                      goto bail;

                  }

              }

-             slapi_log_err(SLAPI_LOG_ARGS, "ldbm_back_next_search_entry_ext", "candidate %lu not found\n",

+             slapi_log_err(SLAPI_LOG_ARGS, "ldbm_back_next_search_entry", "candidate %lu not found\n",

                            (u_long)id);

              if (err == DB_NOTFOUND) {

                  /* Since we didn't really look at this entry, we should
@@ -1661,8 +1624,7 @@ 

                   * If we didn't do this, it would be possible to go over the

                   * lookthrough limit when there are fewer entries in the database

                   * than the lookthrough limit.  This could happen on an ALLIDS

-                  * search after adding a bunch of entries and then deleting

-                  * them. */

+                  * search after adding a bunch of entries and then deleting them. */

                  --sr->sr_lookthroughcount;

              }

              continue;
@@ -1678,23 +1640,20 @@ 

          if (!managedsait && slapi_entry_attr_find(e->ep_entry, "ref", &attr) == 0) {

              Slapi_Value **refs = attr_get_present_values(attr);

              if (refs == NULL || refs[0] == NULL) {

-                 slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry_ext", "null ref in (%s)\n",

+                 slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry", "null ref in (%s)\n",

                                backentry_get_ndn(e));

              } else if (slapi_sdn_scope_test(backentry_get_sdn(e), basesdn, scope)) {

-                 if (use_extension) {

-                     slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, e);

-                 }

                  slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, e->ep_entry);

                  rc = 0;

                  goto bail;

              }

          } else {

              /*

-            * As per slapi_filter_test:

-            * 0  filter matched

-            * -1 filter did not match

-            * >0 an ldap error code

-            */

+              * As per slapi_filter_test:

+              * 0  filter matched

+              * -1 filter did not match

+              * >0 an ldap error code

+              */

              int filter_test = -1;

              int is_bulk_import = operation_is_flag_set(op, OP_FLAG_BULK_IMPORT);

  
@@ -1706,25 +1665,26 @@ 

                          !filter_flag_is_set(filter, SLAPI_FILTER_LDAPSUBENTRY)) ||

                         (slapi_entry_flag_is_set(e->ep_entry, SLAPI_ENTRY_FLAG_TOMBSTONE) &&

                          ((!isroot && !filter_flag_is_set(filter, SLAPI_FILTER_RUV)) ||

-                          !filter_flag_is_set(filter, SLAPI_FILTER_TOMBSTONE)))) {

+                          !filter_flag_is_set(filter, SLAPI_FILTER_TOMBSTONE))))

+             {

                  /* If the entry is an LDAP subentry and filter don't filter subentries OR

-              * the entry is a TombStone and filter don't filter Tombstone

-              * don't return the entry.  We make a special case to allow a non-root user

-              * to search for the RUV entry using a filter of:

-              *

-              *     "(&(objectclass=nstombstone)(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff))"

-              *

-              * For this RUV case, we let the ACL check apply.

-              */

+                  * the entry is a TombStone and filter don't filter Tombstone

+                  * don't return the entry.  We make a special case to allow a non-root user

+                  * to search for the RUV entry using a filter of:

+                  *

+                  *     "(&(objectclass=nstombstone)(nsuniqueid=ffffffff-ffffffff-ffffffff-ffffffff))"

+                  *

+                  * For this RUV case, we let the ACL check apply.

+                  */

                  /* ugaston - we don't want to mistake this filter failure with the one below due to ACL,

-              * because whereas the former should be read as 'no entry must be returned', the latter

-              * might still lead to return an empty entry. */

+                  * because whereas the former should be read as 'no entry must be returned', the latter

+                  * might still lead to return an empty entry. */

                  filter_test = -1;

              } else {

                  /* it's a regular entry, check if it matches the filter, and passes the ACL check */

                  if (0 != (sr->sr_flags & SR_FLAG_CAN_SKIP_FILTER_TEST)) {

                      /* Since we do access control checking in the filter test (?Why?) we need to check access now */

-                     slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry_ext",

+                     slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry",

                                    "Bypassing filter test\n");

                      if (ACL_CHECK_FLAG) {

                          filter_test = slapi_vattr_filter_test_ext(pb, e->ep_entry, filter, ACL_CHECK_FLAG, 1 /* Only perform access checking, thank you */);
@@ -1734,12 +1694,12 @@ 

                      if (li->li_filter_bypass_check) {

                          int ft_rc;

  

-                         slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry_ext", "Checking bypass\n");

+                         slapi_log_err(SLAPI_LOG_FILTER, "ldbm_back_next_search_entry", "Checking bypass\n");

                          ft_rc = slapi_vattr_filter_test(pb, e->ep_entry, filter,

                                                          ACL_CHECK_FLAG);

                          if (filter_test != ft_rc) {

                              /* Oops ! This means that we thought we could bypass the filter test, but noooo... */

-                             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry_ext",

+                             slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_next_search_entry",

                                            "Filter bypass ERROR on entry %s\n", backentry_get_ndn(e));

                              filter_test = ft_rc; /* Fix the error */

                          }
@@ -1769,29 +1729,23 @@ 

                          slapi_pblock_set(pb, SLAPI_SEARCH_SIZELIMIT, &slimit);

                          if (op_is_pagedresults(op)) {

                              /*

-                           * On Simple Paged Results search,

-                           * sizelimit is appied to each page.

-                           */

+                              * On Simple Paged Results search,

+                              * sizelimit is appied to each page.

+                              */

                              pagedresults_set_sizelimit(conn, op, slimit, pr_idx);

                          }

                          sr->sr_current_sizelimit = slimit;

                      }

                      if ((filter_test != 0) && sr->sr_virtuallistview) {

                          /* Slapi Filter Test failed.

-                       * Must be that the ACL check failed.

-                       * Send back an empty entry.

-                       */

+                          * Must be that the ACL check failed.

+                          * Send back an empty entry.

+                          */

                          sr->sr_vlventry = slapi_entry_alloc();

                          slapi_entry_init(sr->sr_vlventry, slapi_ch_strdup(slapi_entry_get_dn_const(e->ep_entry)), NULL);

                          e->ep_vlventry = sr->sr_vlventry;

-                         if (use_extension) {

-                             slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, e);

-                         }

                          slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, sr->sr_vlventry);

                      } else {

-                         if (use_extension) {

-                             slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, e);

-                         }

                          slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, e->ep_entry);

                      }

                      rc = 0;
@@ -1821,9 +1775,6 @@ 

      /* check for the final abandon */

      if (slapi_op_abandoned(pb)) {

          slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE, &estimate);

-         if (use_extension) {

-             slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, NULL);

-         }

          slapi_pblock_set(pb, SLAPI_SEARCH_RESULT_ENTRY, NULL);

          delete_search_result_set(pb, &sr);

          rc = SLAPI_FAIL_GENERAL;
@@ -1930,26 +1881,3 @@ 

      /* passing NULL pb forces to delete the search result set */

      delete_search_result_set(NULL, (back_search_result_set **)sr);

  }

- 

- int

- ldbm_back_entry_release(Slapi_PBlock *pb, void *backend_info_ptr)

- {

-     backend *be;

-     ldbm_instance *inst;

- 

-     if (backend_info_ptr == NULL)

-         return 1;

- 

-     slapi_pblock_get(pb, SLAPI_BACKEND, &be);

-     inst = (ldbm_instance *)be->be_instance_info;

- 

-     if (((struct backentry *)backend_info_ptr)->ep_vlventry != NULL) {

-         /* This entry was created during a vlv search whose acl check failed.  It needs to be

-          * freed here */

-         slapi_entry_free(((struct backentry *)backend_info_ptr)->ep_vlventry);

-         ((struct backentry *)backend_info_ptr)->ep_vlventry = NULL;

-     }

-     CACHE_RETURN(&inst->inst_cache, (struct backentry **)&backend_info_ptr);

- 

-     return 0;

- }

@@ -472,8 +472,6 @@ 

  int ldbm_back_upgradedb(Slapi_PBlock *pb);

  int ldbm_back_dbverify(Slapi_PBlock *pb);

  int ldbm_back_next_search_entry(Slapi_PBlock *pb);

- int ldbm_back_next_search_entry_ext(Slapi_PBlock *pb, int use_extension);

- int ldbm_back_entry_release(Slapi_PBlock *pb, void *backend_info_ptr);

  void ldbm_back_search_results_release(void **search_results);

  int ldbm_back_init(Slapi_PBlock *pb);

  void ldbm_back_prev_search_results(Slapi_PBlock *pb);
@@ -531,17 +529,6 @@ 

  int indexfile_primary_modifyall(backend *be, LDAPMod **mods_to_perform, char **indexes_to_update, back_txn *txn);

  

  /*

-  * bedse.c

-  */

- #if 0

- int bedse_init(void);

- int bedse_search(Slapi_PBlock *pb);

- struct dse_callback *bedse_register_callback(int operation, const Slapi_DN *base, int scope, const char *filter, int (*fn)(Slapi_PBlock *,Slapi_Entry *,Slapi_Entry *,int*,char*,void *), void *fn_arg);

- void bedse_remove_callback(int operation, const Slapi_DN *base, int scope, const char *filter, int (*fn)(Slapi_PBlock *,Slapi_Entry *,Slapi_Entry *,int*,char*,void *));

- int bedse_add_index_entry(int argc, char **argv);

- #endif

- 

- /*

   * ldbm_search.c

   */

  Slapi_Filter *create_onelevel_filter(Slapi_Filter *filter, const struct backentry *e, int managedsait, Slapi_Filter **fid2kids, Slapi_Filter **focref, Slapi_Filter **fand, Slapi_Filter **forr);

@@ -406,14 +406,6 @@ 

      return rc;

  }

  

- #if 0

- static int attr_value_compare(struct berval *value_a, struct berval *value_b)

- {

-     /* return value_cmp(value_a,value_b,syntax,3); */

-     return strcasecmp(value_a->bv_val, value_b->bv_val);

- }

- #endif

- 

  struct berval *

  attr_value_lowest(struct berval **values, value_compare_fn_type compare_fn)

  {

@@ -41,17 +41,6 @@ 

      slapi_ch_free((void **)p);

  }

  

- #if 0

- static void

- vlv_key_copy(const struct vlv_key *p1,struct vlv_key *p2)

- {

-     p2->keymem= p1->keymem;

-     p2->key.data= slapi_ch_realloc(p2->key.data,p2->keymem);

-     strcpy(p2->key.data, p1->key.data);

-     p2->key.size= p1->key.size;

- }

- #endif

- 

  /*

   * Add an attribute value to the end of a composite key.

   */

@@ -617,47 +617,6 @@ 

      return return_value;

  }

  

- 

- #if 0

- /*

-  * rbyrne: This is version of the above using the slapi_build_control_from_berval()

-  * I'll enable this afterwards.

-  * Build an allocated LDAPv3 control from a BerElement.

-  * Returns an LDAP error code.

-  */

- int

- slapi_build_control( char *oid, BerElement *ber,

-     char iscritical, LDAPControl **ctrlp )

- {

-     int rc = 0;

-     int return_value = LDAP_SUCCESS;

-     struct berval *bvp = NULL;

- 

-     PR_ASSERT( NULL != oid && NULL != ctrlp );

- 

-     if ( NULL == ber ) {

-         bvp = NULL;

-     } else {

-         /* allocate struct berval with contents of the BER encoding */

-         rc = ber_flatten( ber, &bvp );

-         if ( -1 == rc ) {

-             return_value = LDAP_NO_MEMORY;

-             goto loser;

-         }

-     }

- 

-     return_value = slapi_build_control_from_berval( oid, bvp, iscritical,

-                                             ctrlp);

-     if ( bvp != NULL ) {

-         ldap_memfree(bvp); /* free container, but not contents */

-         bvp = NULL;

-     }

- 

- loser:

-     return return_value;

- }

- #endif

- 

  /*

   * Build an allocated LDAPv3 control from a berval. Returns an LDAP error code.

   */

file modified
+3 -12
@@ -2300,14 +2300,11 @@ 

  static void

  set_shutdown(int sig __attribute__((unused)))

  {

- /* don't log anything from a signal handler:

+     /* don't log anything from a signal handler:

       * you could be holding a lock when the signal was trapped.  more

       * specifically, you could be holding the logfile lock (and deadlock

       * yourself).

       */

- #if 0

-     slapi_log_err(SLAPI_LOG_INFO, "slapd_daemon", "slapd got shutdown signal\n");

- #endif

      if (g_get_shutdown() == 0) {

          g_set_shutdown(SLAPI_SHUTDOWN_SIGNAL);

      }
@@ -2323,14 +2320,11 @@ 

  void

  slapd_do_nothing(int sig)

  {

- /* don't log anything from a signal handler:

+     /* don't log anything from a signal handler:

       * you could be holding a lock when the signal was trapped.  more

       * specifically, you could be holding the logfile lock (and deadlock

       * yourself).

       */

- #if 0

-     slapi_log_err(SLAPI_LOG_TRACE, "slapd_daemon", "slapd got SIGUSR1\n");

- #endif

      (void)SIGNAL(SIGUSR1, slapd_do_nothing);

  

  #if 0
@@ -2348,14 +2342,11 @@ 

  {

      WAITSTATUSTYPE status;

  

- /* don't log anything from a signal handler:

+     /* don't log anything from a signal handler:

       * you could be holding a lock when the signal was trapped.  more

       * specifically, you could be holding the logfile lock (and deadlock

       * yourself).

       */

- #if 0

-         slapi_log_err(SLAPI_LOG_ARGS, "slapd_daemon", "listener: catching SIGCHLD\n");

- #endif

  #ifdef USE_WAITPID

      while (waitpid((pid_t)-1, 0, WAIT_FLAGS) > 0)

  #else     /* USE_WAITPID */

@@ -3177,13 +3177,6 @@ 

                      slapi_log_err(SLAPI_LOG_TRACE, "slapi_entry_add_rdn_values",

                                    "RDN value is not identical to entry value for type %s in entry %s\n",

                                    type, dn ? dn : "<null>");

- #if 0

-                     /*

-                      * This would be the right thing to do except that

-                      * it breaks our own clients.

-                      */

-                     rc = LDAP_TYPE_OR_VALUE_EXISTS;

- #endif

                  }

                  /* exact same ava already present in entry, that's OK */

              }

@@ -781,21 +781,6 @@ 

      slapi_ch_free((void **)&f);

  }

  

- #if 0

- static void

- filter_list_insert( struct slapi_filter **into, struct slapi_filter *from )

- {

-     struct slapi_filter *f;

-     if (into == NULL || from == NULL) return;

-     if (*into != NULL) {

-     for (f = from; f->f_next != NULL; f = f->f_next);

-     f->f_next = *into;

-     }

-     *into = from;

- }

- #endif

- 

- 

  struct slapi_filter *

  slapi_filter_join(int ftype, struct slapi_filter *f1, struct slapi_filter *f2)

  {

@@ -36,15 +36,6 @@ 

      return (0);

  }

  

- #if 0

- static

- int _getopt_ext_done()

- {

-     _getopt_ext_done_long = 1;

-     return(0);

- }

- #endif

- 

  static int

  _getopt_ext_find(int argc __attribute__((unused)),

                   char **argv,

@@ -11,11 +11,6 @@ 

  #include <config.h>

  #endif

  

- #if 0

- int detached;

- int error_logfp;

- #endif

- 

  main()

  {

      ldbm_back_bind();
@@ -31,15 +26,3 @@ 

      ldbm_back_init();

      ldbm_back_close();

  }

- 

- #if 0

- slapi_access_allowed(){}

- send_ldap_result(){}

- slapi_op_abandoned(){}

- be_issuffix(){}

- slapi_pw_find(){}

- send_ldap_search_entry(){}

- slapi_pblock_get(){}

- slapi_pblock_set(){}

- slapi_acl_check_mods(){}

- #endif

file modified
-13
@@ -2432,9 +2432,6 @@ 

      buffer[sizeof(buffer) - 1] = '\0';

  

      if (fp)

- #if 0

-         LOG_WRITE_NOW(fp, buffer, strlen(buffer), header_len, err);

- #else

          do {

              int size = strlen(buffer);

              (err) = 0;
@@ -2446,7 +2443,6 @@ 

              /* Should be a flush in here ?? Yes because PR_SYNC doesn't work ! */

              PR_Sync(fp);

          } while (0);

- #endif

          else /* stderr is always unbuffered */

              fprintf(stderr, "%s", buffer);

  
@@ -5058,15 +5054,6 @@ 

      return lbi;

  }

  

- #if 0

- /* for some reason, we never call this. */

- static void log_destroy_buffer(LogBufferInfo *lbi)

- {

-     slapi_ch_free((void *)&(lbi->top));

-     slapi_ch_free((void *)&lbi);

- }

- #endif

- 

  /*

   Some notes about this function. It is written the

   way it is for performance reasons.

@@ -955,42 +955,6 @@ 

      return result;

  }

  

- #if 0

- /* defined but not used */

- /*

-  * Description:

-  * A first attempt at walking over the mapping tree and making sure things

-  * make sense.  Right now it just makes sure that each parent node has a

-  * subtree that is the suffix of its children's subtrees.  This function

-  * is called recursively.

-  *

-  * Arguments:

-  * The root node of the mapping tree.

-  *

-  * Returns:

-  * Nothing - it just prints warnings.  This should probably change.

-  */

- static void

- mapping_tree_node_validate(mapping_tree_node *node)

- {

-     mapping_tree_node *child_entry;

- 

-     /* Call this function for all of nodes children */

-     for (child_entry = node->mtn_children; child_entry; child_entry = child_entry->mtn_brother) {

-         mapping_tree_node_validate(child_entry);

-     }

- 

-     if (node->mtn_parent) {

-         if (!slapi_sdn_issuffix(node->mtn_subtree, node->mtn_parent->mtn_subtree)) {

-             slapi_log_err(SLAPI_LOG_WARNING, "mapping_tree_node_validate",

-                 "Invalid mapping tree.  %s can not be a child of %s\n",

-                 slapi_sdn_get_ndn(node->mtn_subtree),

-                 slapi_sdn_get_ndn(node->mtn_parent->mtn_subtree));

-         }

-     }

- }

- #endif

- 

  static void

  mtn_free_referral_in_node(mapping_tree_node *node)

  {

@@ -163,15 +163,6 @@ 

      return (0);

  }

  

- #if 0

- static int

- _mr_free(struct matchingRuleList **mrl /*, int freeEntry */)

- {

-     slapi_ch_free((void **)mrl);

-     return(0);

- }

- #endif

- 

  int

  slapi_matchingrule_register(Slapi_MatchingRuleEntry *mrule)

  {

@@ -43,9 +43,6 @@ 

  /* Forward declarations */

  static int modify_internal_pb(Slapi_PBlock *pb);

  static void op_shared_modify(Slapi_PBlock *pb, int pw_change, char *old_pw);

- #if 0 /* not used */

- static void remove_mod (Slapi_Mods *smods, const char *type, Slapi_Mods *smod_unhashed);

- #endif

  static int op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_Mods *smods);

  static int hash_rootpw(LDAPMod **mods);

  static int valuearray_init_bervalarray_unhashed_only(struct berval **bvals, Slapi_Value ***cvals);
@@ -1124,24 +1121,6 @@ 

      return n;

  }

  

- #if 0 /* not used */

- static void remove_mod (Slapi_Mods *smods, const char *type, Slapi_Mods *smod_unhashed)

- {

-     LDAPMod *mod;

-     Slapi_Mod smod;

- 

-     for (mod = slapi_mods_get_first_mod(smods);    mod; mod = slapi_mods_get_next_mod(smods))

-     {

-         if (strcasecmp (mod->mod_type, type) == 0)

-         {

-             slapi_mod_init_byval (&smod, mod);

-             slapi_mods_add_smod(smod_unhashed, &smod);

-             slapi_mods_remove (smods);

-         }

-     }

- }

- #endif

- 

  static int

  op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_Mods *smods)

  {

file modified
+1 -145
@@ -1124,6 +1124,7 @@ 

  

      return 0;

  }

+ 

  static void

  send_entry(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Operation *operation, char **attrs, int attrsonly, int *pnentries)

  {
@@ -1150,151 +1151,6 @@ 

                  }

  }

  

- #if 0

- /* Loops through search entries and sends them to the client.

-  * returns -1 on error, 0 if result packet was sent or 1 if

-  * result packet wasn't sent

-  */

- static int

- iterate_with_lookahead(Slapi_PBlock *pb, Slapi_Backend *be, int send_result, int *pnentries)

- {

-     int rc;

-     int attrsonly;

-     int done = 0;

-     Slapi_Entry *e;

-     void *backend_info_ptr;

-     Slapi_Entry *next_e;

-     void *next_backend_info_ptr;

-     char **attrs = NULL;

-     int send_result_status = 0;

- 

-     slapi_pblock_get(pb, SLAPI_SEARCH_ATTRS, &attrs);

-     slapi_pblock_get(pb, SLAPI_SEARCH_ATTRSONLY, &attrsonly);

- 

-     /* setup for the loop */

-     rc = be->be_next_search_entry_ext(pb, 1);

-     if (rc < 0)

-     {

-         /*

-          * Some exceptional condition occurred.  Results

-          * have been sent, so we're finished.

-          */

-         if (rc == SLAPI_FAIL_DISKFULL)

-         {

-             operation_out_of_disk_space();

-         }

-         return -1;

-     }

- 

-     slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_ENTRY, &next_e);

-     slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, &next_backend_info_ptr);

-     if (NULL == next_e)

-     {

-         /* no entries */

-         done = 1;

-     }

- 

-     backend_info_ptr = NULL;

- 

-     /* Done setting up the loop, now here it comes */

- 

-     while (!done)

-     {

-         /* Allow the backend to free the entry we just finished using */

-         /* It is ok to call this when backend_info_ptr is NULL */

-         be->be_entry_release(pb, backend_info_ptr);

-         e = next_e;

-         backend_info_ptr = next_backend_info_ptr;

- 

-         rc = be->be_next_search_entry_ext(pb, 1);

-         if (rc < 0)

-         {

-             /*

-              * Some exceptional condition occurred.  Results

-              * have been sent, so we're finished.

-              */

-             if (rc == SLAPI_FAIL_DISKFULL)

-             {

-                 operation_out_of_disk_space();

-             }

-             return -1;

-         }

-         else

-         {

-             slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_ENTRY, &next_e);

-             slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_ENTRY_EXT, &next_backend_info_ptr);

-             if (next_e == NULL)

-             {

-                 /* no more entries */

-                 done = 1;

-             }

-         }

- 

-         if (process_entry(pb, e, send_result))

-         {

-             /* shouldn't  send this entry */

-             continue;

-         }

- 

-         /*

-          * It's a regular entry, or it's a referral and

-          * managedsait control is on.  In either case, send the entry.

-          */

-         if (done)

-         {

-             struct berval **urls = NULL;

-             /* Send the entry and the result at the same time */

-             slapi_pblock_get(pb, SLAPI_SEARCH_REFERRALS, &urls);

-             rc = send_ldap_search_entry_ext(pb, e, NULL, attrs, attrsonly, 1,

-                                             (*pnentries)+1, urls);

-             if (rc == 1)

-             {

-                 /* this means we didn't have access to the entry. Since the

-                  * entry was not sent, we need to send the done packet.

-                  */

-                 send_result_status = 1;

-             }

-         }

-         else

-         {

-             /* Send the entry */

-             rc = send_ldap_search_entry(pb, e, NULL, attrs,

-                         attrsonly);

-         }

-         switch (rc)

-         {

-             case 0:        /* entry sent ok */

-                 (*pnentries)++;

-                 slapi_pblock_set(pb, SLAPI_NENTRIES, pnentries);

-                 break;

-             case 1:        /* entry not sent */

-                 break;

-             case -1:    /* connection closed */

-                 /*

-                  * mark the operation as abandoned so the backend

-                  * next entry function gets called again and has

-                  * a chance to clean things up.

-                  */

-                 operation->o_status = SLAPI_OP_STATUS_ABANDONED;

-                 break;

-         }

-     }

- 

-     be->be_entry_release(pb, backend_info_ptr);

-     if (*pnentries == 0 || send_result_status)

-     {

-         /* We didn't send the result done message so the caller

-          * must send it */

-         return 1;

-     }

-     else

-     {

-         /* The result message has been sent */

-         return 0;

-     }

- }

- #endif

- 

  /* Loops through search entries and sends them to the client.

   * returns -1 on error or 1 if result packet wasn't sent.

   * This function never returns 0 because it doesn't send

@@