]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/index.c
Change overlapping `strcpy( x, y )' to `SAFEMEMCPY( x, y, strlen( y ) + 1 )'
[openldap] / servers / slapd / back-ldbm / index.c
index dbe549b924b334ae9dfc983abc19d183d13c0924..4fe0f98871be164b46059ab43547db22c078096b 100644 (file)
 #include "slap.h"
 #include "back-ldbm.h"
 
-extern char            *first_word();
-extern char            *next_word();
-extern char            *phonetic();
-extern IDList          *idl_fetch();
-extern IDList          *idl_allids();
-extern struct dbcache  *ldbm_cache_open();
-
-int    index_add_values();
-
-static int     add_value();
-static int     index2prefix();
+static int     add_value(Backend *be, struct dbcache *db, char *type, int indextype, char *val, ID id);
+static int     index2prefix(int indextype);
 
 int
 index_add_entry(
@@ -41,7 +32,7 @@ index_add_entry(
         * with index_add_values() call
         */
 
-       bv.bv_val = strdup( e->e_dn );
+       bv.bv_val = ch_strdup( e->e_dn );
        bv.bv_len = strlen( bv.bv_val );
        (void) dn_normalize_case( bv.bv_val );
        bvals[0] = &bv;
@@ -65,18 +56,20 @@ index_add_entry(
 int
 index_add_mods(
     Backend    *be,
-    LDAPMod    *mods,
+    LDAPModList        *ml,
     ID         id
 )
 {
        int     rc;
 
-       for ( ; mods != NULL; mods = mods->mod_next ) {
-               switch ( mods->mod_op & ~LDAP_MOD_BVALUES ) {
+       for ( ; ml != NULL; ml = ml->ml_next ) {
+               LDAPMod *mod = &ml->ml_mod;
+
+               switch ( mod->mod_op & ~LDAP_MOD_BVALUES ) {
                case LDAP_MOD_ADD:
                case LDAP_MOD_REPLACE:
-                       rc = index_add_values( be, mods->mod_type,
-                           mods->mod_bvalues, id );
+                       rc = index_add_values( be, mod->mod_type,
+                           mod->mod_bvalues, id );
                        break;
 
                case LDAP_MOD_DELETE:
@@ -120,7 +113,7 @@ index_read(
        if ( ! (indextype & indexmask) ) {
                idl =  idl_allids( be );
                Debug( LDAP_DEBUG_TRACE,
-                   "<= index_read %d candidates (allids - not indexed)\n",
+                   "<= index_read %lu candidates (allids - not indexed)\n",
                    idl ? idl->b_nids : 0, 0, 0 );
                return( idl );
        }
@@ -160,7 +153,7 @@ index_read(
 
        ldbm_cache_close( be, db );
 
-       Debug( LDAP_DEBUG_TRACE, "<= index_read %d candidates\n",
+       Debug( LDAP_DEBUG_TRACE, "<= index_read %lu candidates\n",
            idl ? idl->b_nids : 0, 0, 0 );
        return( idl );
 }
@@ -231,7 +224,7 @@ index_add_values(
 )
 {
        char            *val, *p, *code, *w;
-       int             i, j, len;
+       unsigned        i, j, len;
        int             indexmask, syntax;
        char            buf[SUBLEN + 1];
        char            vbuf[BUFSIZ];