static int txn = 0;
static int txnabort = 0;
struct berval *txn_id = NULL;
+static unsigned long jumpline;
void
usage( void )
fprintf( stderr, _(" -E [!]ext=extparam modify extensions"
" (! indicate s criticality)\n"));
fprintf( stderr, _(" -f file read operations from `file'\n"));
+ fprintf( stderr, _(" -j lineno jump to lineno before processing\n"));
fprintf( stderr, _(" -M enable Manage DSA IT control (-MM to make critical)\n"));
fprintf( stderr, _(" -P version protocol version (default: 3)\n"));
fprintf( stderr,
const char options[] = "aE:rS:"
- "cd:D:e:f:H:IMnNO:o:P:QR:U:vVw:WxX:y:Y:Z";
+ "cd:D:e:f:H:Ij:MnNO:o:P:QR:U:vVw:WxX:y:Y:Z";
int
handle_private_option( int i )
ldapadd = 1;
break;
+ case 'j': /* jump */
+ {
+ char *next;
+ jumpline = strtoul( optarg, &next, 10 );
+ if ( !next || *next ) {
+ fprintf( stderr, "%s: unable to parse jump line number \"%s\"\n", prog, optarg);
+ exit(EXIT_FAILURE);
+ }
+ }
+ break;
+
case 'r': /* replace (obsolete) */
break;
while (( rc == 0 || contoper ) && ( ldifrc = ldif_read_record( ldiffp, &nextline,
&rbuf, &lmax )) > 0 )
{
+ if ( lineno < jumpline )
+ goto next;
+
if ( rejfp ) {
len = strlen( rbuf );
if (( rejbuf = (char *)ber_memalloc( len+1 )) == NULL ) {
}
rc = process_ldif_rec( rbuf, lineno );
- lineno = nextline+1;
if ( rc ) retval = rc;
if ( rc && rejfp ) {
- fprintf(rejfp, _("# Error: %s (%d)"), ldap_err2string(rc), rc);
+ fprintf(rejfp, _("# Error: %s (%d) (line=%lu)"), ldap_err2string(rc), rc, lineno);
matched_msg = NULL;
ldap_get_option(ld, LDAP_OPT_MATCHED_DN, &matched_msg);
}
if (rejfp) ber_memfree( rejbuf );
+
+next:
+ lineno = nextline+1;
}
ber_memfree( rbuf );
[\c
.BI \-f \ file\fR]
[\c
+.BI \-j \ lineno\fR]
+[\c
.BI \-S \ file\fR]
[\c
.BR \-M [ M ]]
[\c
.BI \-f \ file\fR]
[\c
+.BI \-j \ lineno\fR]
+[\c
.BI \-S \ file\fR]
[\c
.BR \-M [ M ]]
Read the entry modification information from \fIfile\fP instead of from
standard input.
.TP
+.BI \-j \ lineno
+Jump to the specified line number in the LDIF file before processing any entries.
+This allows a load that was aborted due to errors in the input LDIF to be resumed
+after the errors are corrected.
+.TP
.BI \-S \ file
Add or change records which were skipped due to an error are written to \fIfile\fP
and the error message returned by the server is added as a comment. Most useful in