#define ID2CHILDRENCMD "ldif2id2children"
#define MAXARGS 100
-int ldap_debug;
-int ldap_syslog;
-int ldap_syslog_level;
-int global_schemacheck;
-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;
-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;
-
static void fork_child( char *prog, char *args[] );
static void wait4kids( int nkidval );
{
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];
int lmax, lcur;
int dbnum;
ID id;
+ int rc;
Backend *be = NULL;
struct ldbminfo *li;
struct berval bv;
* 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++ ) {
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 */
int vlen, indexmask, syntaxmask;
Datum key, data;
- memset( &key, 0, sizeof( key ));
- memset( &data, 0, sizeof( data ));
+ ldbm_datum_init( key );
+ ldbm_datum_init( data );
if ( fgets( line, sizeof(line), stdin ) != NULL ) {
int len;
lcur = 0;
}
}
- (*be->be_close)( be );
+
+ slap_shutdown(dbnum);
wait4kids( -1 );
+ slap_destroy();
+
exit( 0 );
}