+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
#include "../slap.h"
+#include "../back-ldbm/back-ldbm.h"
-#define DEFAULT_CONFIGFILE "/usr/local/etc/slapd.conf"
-#define MAXARGS 100
+#include "ldapconfig.h"
+#include "ldif.h"
-extern void attr_index_config();
-extern char *str_getline();
-extern char *attr_normalize();
-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;
-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;
+#define MAXARGS 100
static void
usage( char *name )
exit( 1 );
}
+int
main( int argc, char **argv )
{
int i, cargc, indb, stop;
int lmax, lcur, indexmask, syntaxmask;
int dbnum;
unsigned long id;
- Backend *be;
+ Backend *be = NULL;
+ struct ldbminfo *li;
struct berval bv;
struct berval *vals[2];
- extern char *optarg;
inputfile = NULL;
- tailorfile = DEFAULT_CONFIGFILE;
+ tailorfile = SLAPD_DEFAULT_CONFIGFILE;
dbnum = -1;
while ( (i = getopt( argc, argv, "d:f:i:n:" )) != EOF ) {
switch ( i ) {
fprintf( stderr, "No ldbm database found in config file\n" );
exit( 1 );
}
- } else if ( dbnum < 1 || dbnum > nbackends ) {
+ } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
fprintf( stderr, "Database number selected via -n is out of range\n" );
fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
exit( 1 );
}
be = &backends[dbnum];
+ /* disable write sync'ing */
+ li = (struct ldbminfo *) be->be_private;
+ li->li_dbcachewsync = 0;
+
attr_masks( be->be_private, attr, &indexmask, &syntaxmask );
if ( indexmask == 0 ) {
exit( 0 );
}
if ( line[0] == '\n' || stop && buf && *buf ) {
if ( *buf != '\n' ) {
- id++;
+ if (isdigit(*buf)) {
+ id = atol(buf);
+ } else {
+ id++;
+ }
s = buf;
elineno = 0;
while ( (linep = str_getline( &s )) != NULL ) {