ITS#9651 ldapmodify: add -i option for interval between ops

This commit is contained in:
Howard Chu 2021-08-26 15:40:33 +01:00
parent 405e6b3152
commit c5241b49af
2 changed files with 28 additions and 1 deletions

View File

@ -94,6 +94,8 @@ static int process_response(
int res,
const struct berval *dn );
static long interval;
static struct timeval interval_tv;
static int txn = 0;
static int txnabort = 0;
struct berval *txn_id = NULL;
@ -113,6 +115,7 @@ usage( void )
fprintf( stderr, _(" -E [!]ext=extparam modify extensions"
" (! indicate s criticality)\n"));
fprintf( stderr, _(" -f file read operations from `file'\n"));
fprintf( stderr, _(" -i time wait `time' microseconds between operations\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,
@ -125,7 +128,7 @@ usage( void )
const char options[] = "aE:rS:"
"cd:D:e:f:h:H:IMnNO:o:p:P:QR:U:vVw:WxX:y:Y:Z";
"cd:D:e:f:h:H:i:IMnNO:o:p:P:QR:U:vVw:WxX:y:Y:Z";
int
handle_private_option( int i )
@ -187,6 +190,19 @@ handle_private_option( int i )
ldapadd = 1;
break;
case 'i': /* interval */
{
char *next;
interval = strtol( optarg, &next, 10 );
if ( !next || *next ) {
fprintf( stderr, "%s: unable to parse interval \"%s\"\n", prog, optarg);
exit(EXIT_FAILURE);
}
interval_tv.tv_usec = interval % 1000000;
interval_tv.tv_sec = interval / 1000000;
}
break;
case 'r': /* replace (obsolete) */
break;
@ -296,6 +312,10 @@ main( int argc, char **argv )
memcpy( rejbuf, rbuf, len+1 );
}
if ( interval ) {
select( 0, NULL, NULL, NULL, &interval_tv );
}
rc = process_ldif_rec( rbuf, lineno );
lineno = nextline+1;

View File

@ -21,6 +21,8 @@ ldapmodify, ldapadd \- LDAP modify entry and LDAP add entry tools
[\c
.BI \-f \ file\fR]
[\c
.BI \-i \ time\fR]
[\c
.BI \-S \ file\fR]
[\c
.BR \-M [ M ]]
@ -77,6 +79,8 @@ ldapmodify, ldapadd \- LDAP modify entry and LDAP add entry tools
[\c
.BI \-f \ file\fR]
[\c
.BI \-i \ time\fR]
[\c
.BI \-S \ file\fR]
[\c
.BR \-M [ M ]]
@ -171,6 +175,9 @@ reporting an error.
Read the entry modification information from \fIfile\fP instead of from
standard input.
.TP
.BI \-i \ time
Wait \fItime\fP microseconds before issuing an operation.
.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