]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/tools/ldif2ldbm.c
Updated some items
[openldap] / servers / slapd / tools / ldif2ldbm.c
index 0686e58bb85dcbd4193d183359eee911b58fdb62..9cbdf52b378f9573bed46b992a53e29ccbdde2e4 100644 (file)
 #define ID2CHILDRENCMD         "ldif2id2children"
 #define MAXARGS                100
 
-int            ldap_debug;
-int            ldap_syslog;
-int            ldap_syslog_level;
-long           num_entries_sent;
-long           num_bytes_sent;
-int            active_threads;
-char           *default_referral;
-time_t         currenttime;
-pthread_t      listener_tid;
-pthread_mutex_t        num_sent_mutex;
-pthread_mutex_t        entry2str_mutex;
-pthread_mutex_t        active_threads_mutex;
-pthread_mutex_t        new_conn_mutex;
-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 );
 
@@ -62,7 +41,7 @@ main( int argc, char **argv )
 {
        int             i, stop, status;
        char            *linep, *buf, *sbindir;
-       char            *args[10];
+       char            *args[MAXARGS];
        char            buf2[20], buf3[20];
        char            line[BUFSIZ];
        char            cmd[MAXPATHLEN];
@@ -70,6 +49,7 @@ main( int argc, char **argv )
        int             lmax, lcur;
        int             dbnum;
        ID              id;
+       int             rc;
        Backend         *be = NULL;
        struct ldbminfo *li;
        struct berval   bv;
@@ -124,8 +104,13 @@ main( int argc, char **argv )
         * initialize stuff and figure out which backend we're dealing with
         */
 
-       init();
-       read_config( tailorfile, &be, NULL );
+       rc = slap_init(SLAP_TOOL_MODE, "ldif2ldbm");
+       if (rc != 0 ) {
+               fprintf( stderr, "ldif2ldbm: slap_init failed!\n");
+               exit(1);
+       }
+
+       read_config( tailorfile );
 
        if ( dbnum == -1 ) {
                for ( dbnum = 0; dbnum < nbackends; dbnum++ ) {
@@ -146,6 +131,9 @@ main( int argc, char **argv )
                fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum );
                exit( 1 );
        }
+
+       slap_startup(dbnum);
+
        be = &backends[dbnum];
 
        /* disable write sync'ing */
@@ -281,10 +269,13 @@ main( int argc, char **argv )
                        lcur = 0;
                }
        }
-       (*be->be_close)( be );
+
+       slap_shutdown(dbnum);
 
        wait4kids( -1 );
 
+       slap_destroy();
+
        exit( 0 );
 }