442
442
if (mctx.mode & STRING)
443
443
(void) randomString (tttctx, mctx.bindDNNbDigit);
445
rnd (tttctx->buf2, mctx.bindDNLow, mctx.bindDNHigh, mctx.bindDNNbDigit);
445
rnd (tttctx->buf2, mctx.bindDNLow, mctx.bindDNHigh, (mctx.mod2 & M2_NOZEROPAD) ? 0 : mctx.bindDNNbDigit);
448
448
* First, randomize the bind DN.
732
732
connectToLDAP(thread_context *tttctx, const char *bufBindDN, const char *bufPasswd, unsigned int mode, unsigned int mod2)
735
const char *mech = LDAP_SASL_SIMPLE;
736
735
struct berval cred = {0, NULL};
737
736
int v2v3 = LDAP_VERSION3;
738
const char *binddn = NULL;
739
737
const char *passwd = NULL;
740
738
#if defined(USE_OPENLDAP)
741
739
char *ldapurl = NULL;
992
987
if ((mod2 & M2_RANDOM_SASLAUTHID) && tttctx) {
993
988
rnd (tttctx->buf2, mctx.sasl_authid_low, mctx.sasl_authid_high,
994
mctx.sasl_authid_nbdigit);
989
(mctx.mod2 & M2_NOZEROPAD) ? 0 : mctx.sasl_authid_nbdigit);
995
990
strncpy (&(tttctx->bufSaslAuthid[tttctx->startSaslAuthid]),
996
991
tttctx->buf2, mctx.sasl_authid_nbdigit);
997
992
my_saslauthid = tttctx->bufSaslAuthid;
1324
1319
num = field->cnt;
1325
1320
field->cnt++; /* Next value for next loop */
1327
sprintf (tttctx->buf2, "%0*d", field->nb, num);
1322
sprintf (tttctx->buf2, "%0*d", (mctx.mod2 & M2_NOZEROPAD) ? 0 : field->nb, num);
1328
1323
strcat (attrib->buf, tttctx->buf2);
1329
1324
if (field->var != -1)
1330
1325
strcpy (object->var[field->var], tttctx->buf2);
1347
1342
num = field->cnt;
1348
1343
field->cnt++; /* Next value for next loop */
1350
sprintf (tttctx->buf2, "%0*d", field->nb, num);
1345
sprintf (tttctx->buf2, "%0*d", (mctx.mod2 & M2_NOZEROPAD) ? 0 : field->nb, num);
1351
1346
strcat (attrib->buf, tttctx->buf2);
1352
1347
if (field->var != -1)
1353
1348
strcpy (object->var[field->var], tttctx->buf2);
1359
1354
strcpy (object->var[field->var], field->dlf->str[num]);
1361
1356
case HOW_RND_NUMBER:
1362
rnd (tttctx->buf2, field->low, field->high, field->nb);
1357
rnd (tttctx->buf2, field->low, field->high, (mctx.mod2 & M2_NOZEROPAD) ? 0 : field->nb);
1363
1358
strcat (attrib->buf, tttctx->buf2);
1364
1359
if (field->var != -1)
1365
1360
strcpy (object->var[field->var], tttctx->buf2);
1430
1425
(void) randomString (tttctx, mctx.baseDNNbDigit);
1432
1427
rnd (tttctx->buf2, mctx.baseDNLow, mctx.baseDNHigh, /*JLS 14-11-00*/
1433
mctx.baseDNNbDigit); /*JLS 14-11-00*/
1428
(mctx.mod2 & M2_NOZEROPAD) ? 0 : mctx.baseDNNbDigit); /*JLS 14-11-00*/
1434
1429
strncpy (&(tttctx->bufBaseDN[tttctx->startBaseDN]),
1435
1430
tttctx->buf2, mctx.baseDNNbDigit);
1436
1431
if (mctx.mode & VERY_VERBOSE)
1481
1476
(void) randomString (tttctx, mctx.randomNbDigit);
1483
1478
rnd (tttctx->buf2, mctx.randomLow, mctx.randomHigh, /*JLS 14-11-00*/
1484
mctx.randomNbDigit); /*JLS 14-11-00*/
1479
(mctx.mod2 & M2_NOZEROPAD) ? 0 : mctx.randomNbDigit); /*JLS 14-11-00*/
1485
1480
strncpy (&(tttctx->bufFilter[tttctx->startRandom]),
1486
tttctx->buf2, mctx.randomNbDigit);
1481
tttctx->buf2, mctx.randomNbDigit);
1482
if ((mctx.mod2 & M2_NOZEROPAD) && mctx.randomTail) {
1483
strcat(tttctx->bufFilter, mctx.randomTail);
1487
1485
if (mctx.mode & VERY_VERBOSE)
1488
1486
printf ("ldclt[%d]: %s: random mode:filter=\"%s\"\n",
1489
1487
mctx.pid, tttctx->thrdId, tttctx->bufFilter);
1493
1491
if (mctx.mode & COMMON_COUNTER) /*JLS 14-03-01*/
1494
1492
{ /*JLS 14-03-01*/
1495
int val; /*JLS 14-03-01*/
1496
val = incrementCommonCounter (tttctx); /*JLS 14-03-01*/
1493
int val = incrementCommonCounter (tttctx); /*JLS 14-03-01*/
1497
1494
if (val == -1) /*JLS 14-03-01*/
1498
1495
return (-1); /*JLS 14-03-01*/
1499
sprintf (tttctx->buf2, "%0*d", mctx.randomNbDigit, val);/*JLS 14-03-01*/
1496
sprintf (tttctx->buf2, "%0*d", (mctx.mod2 & M2_NOZEROPAD) ? 0 : mctx.randomNbDigit, val);/*JLS 14-03-01*/
1500
1497
} /*JLS 14-03-01*/
1501
else /*JLS 14-03-01*/
1504
if (tttctx->lastVal > mctx.randomHigh)
1506
if (!(mctx.mode & NOLOOP))
1507
tttctx->lastVal = mctx.randomLow;
1511
* Well, there is no clean way to exit. Let's use the error
1512
* condition and hope all will be ok.
1514
printf ("ldclt[%d]: %s: Hit top incrementeal value\n",
1515
mctx.pid, tttctx->thrdId);
1519
sprintf (tttctx->buf2, "%0*d", mctx.randomNbDigit, tttctx->lastVal);
1498
else if ((mctx.mode & NOLOOP) && ((tttctx->lastVal + mctx.incr) > mctx.randomHigh))
1501
* Well, there is no clean way to exit. Let's use the error
1502
* condition and hope all will be ok.
1504
printf ("ldclt[%d]: %s: Hit top incremental value %d > %d\n",
1505
mctx.pid, tttctx->thrdId, (tttctx->lastVal + mctx.incr), mctx.randomHigh);
1510
tttctx->lastVal = incr_and_wrap(tttctx->lastVal, mctx.randomLow, mctx.randomHigh, mctx.incr);
1511
sprintf (tttctx->buf2, "%0*d", (mctx.mod2 & M2_NOZEROPAD) ? 0 : mctx.randomNbDigit, tttctx->lastVal);
1520
1512
} /*JLS 14-03-01*/
1522
1514
strncpy (&(tttctx->bufFilter[tttctx->startRandom]), tttctx->buf2,
1523
1515
mctx.randomNbDigit);
1516
if ((mctx.mod2 & M2_NOZEROPAD) && mctx.randomTail) {
1517
strcat(tttctx->bufFilter, mctx.randomTail);
1524
1519
if (mctx.mode & VERY_VERBOSE)
1525
1520
printf ("ldclt[%d]: %s: incremental mode:filter=\"%s\"\n",
1526
1521
mctx.pid, tttctx->thrdId, tttctx->bufFilter);
3975
3972
} /*end of message retriving */
3976
3973
} /* end of verbose mode */
3975
if ((mctx.srch_nentries > -1) && (mctx.srch_nentries != nentries)) {
3976
printf ("Error: search returned %d entries not the requested %d entries\n", nentries, mctx.srch_nentries);
3978
3980
if (incrementNbOpers (tttctx) < 0)/* Memorize operation */