]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/tools/ldif2ldbm.c
Apply --disable-crypt & -disable-cleartext fixes from devel.
[openldap] / servers / slapd / tools / ldif2ldbm.c
index 01ae4fbd2165730d7311ea5872efe224231a8e99..41b93676b0167f4fa4dab41071e2282a22fdef50 100644 (file)
@@ -3,13 +3,16 @@
 #include <stdio.h>
 
 #include <ac/string.h>
+#include <ac/ctype.h>
 #include <ac/socket.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
 
 #include <sys/param.h>
 
+#include "ldapconfig.h"
 #include "../slap.h"
 #include "../back-ldbm/back-ldbm.h"
-#include "ldapconfig.h"
 #include "ldif.h"
 
 #define INDEXCMD               "ldif2index"
 #define ID2CHILDRENCMD         "ldif2id2children"
 #define MAXARGS                100
 
-extern int             nbackends;
-extern Backend *backends;
-extern int             ldap_debug;
-
 int            ldap_debug;
 int            ldap_syslog;
 int            ldap_syslog_level;
-int            global_schemacheck;
-int            num_entries_sent;
-int            num_bytes_sent;
+long           num_entries_sent;
+long           num_bytes_sent;
 int            active_threads;
 char           *default_referral;
-struct objclass        *global_oc;
 time_t         currenttime;
 pthread_t      listener_tid;
 pthread_mutex_t        num_sent_mutex;
@@ -40,6 +37,9 @@ pthread_mutex_t       currenttime_mutex;
 pthread_mutex_t        replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
+#ifdef SLAPD_CRYPT
+pthread_mutex_t        crypt_mutex;
+#endif
 
 static void fork_child( char *prog, char *args[] );
 static void    wait4kids( int nkidval );
@@ -49,7 +49,7 @@ static char   *tailorfile;
 static char    *inputfile;
 static int      maxkids = 1;
 static int      nkids;
+
 static void
 usage( char *name )
 {
@@ -57,6 +57,7 @@ usage( char *name )
        exit( 1 );
 }
 
+int
 main( int argc, char **argv )
 {
        int             i, stop, status;
@@ -70,10 +71,10 @@ main( int argc, char **argv )
        int             dbnum;
        ID              id;
        Backend         *be = NULL;
+       struct ldbminfo *li;
        struct berval   bv;
        struct berval   *vals[2];
        Avlnode         *avltypes = NULL;
-       extern char     *optarg;
 
        sbindir = DEFAULT_SBINDIR;
        tailorfile = SLAPD_DEFAULT_CONFIGFILE;
@@ -147,6 +148,10 @@ main( int argc, char **argv )
        }
        be = &backends[dbnum];
 
+       /* disable write sync'ing */
+       li = (struct ldbminfo *) be->be_private;
+       li->li_dbcachewsync = 0;
+
        /*
         * generate the id2entry index
         */
@@ -225,6 +230,9 @@ main( int argc, char **argv )
                int             vlen, indexmask, syntaxmask;
                Datum           key, data;
 
+               memset( &key, 0, sizeof( key ));
+               memset( &data, 0, sizeof( data ));
+
                if ( fgets( line, sizeof(line), stdin ) != NULL ) {
                        int     len;