Add -r support to crlutil for multiple iterations

This commit is contained in:
jpierre%netscape.com 2002-09-17 00:28:42 +00:00
Родитель 411c8c7d0e
Коммит 45c8746dd4
1 изменённых файлов: 37 добавлений и 27 удалений

Просмотреть файл

@ -289,6 +289,7 @@ static void Usage(char *progName)
fprintf(stderr, "%-20s \t 1 - SEC_CRL_TYPE\n", " ");
fprintf(stderr, "\n%-20s Bypass CA certificate checks.\n", "-B");
fprintf(stderr, "\n%-20s Partial decode for faster operation.\n", "-p");
fprintf(stderr, "%-20s Repeat the operation.\n", "-r <iterations>");
exit(-1);
}
@ -315,6 +316,8 @@ int main(int argc, char **argv)
PRInt32 importOptions = CRL_IMPORT_DEFAULT_OPTIONS;
PRBool test = PR_FALSE;
PRBool erase = PR_FALSE;
PRInt32 i = 0;
PRInt32 iterations = 1;
progName = strrchr(argv[0], '/');
progName = progName ? progName+1 : argv[0];
@ -330,7 +333,7 @@ int main(int argc, char **argv)
/*
* Parse command line arguments
*/
optstate = PL_CreateOptState(argc, argv, "BCDILP:d:i:n:pt:u:TE");
optstate = PL_CreateOptState(argc, argv, "BCDILP:d:i:n:pt:u:TEr:");
while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
switch (optstate->option) {
case '?':
@ -391,6 +394,13 @@ int main(int argc, char **argv)
decodeOptions |= CRL_DECODE_SKIP_ENTRIES;
break;
case 'r': {
const char* str = optstate->value;
if (str && atoi(str)>0)
iterations = atoi(str);
}
break;
case 't': {
char *type;
@ -429,12 +439,11 @@ int main(int argc, char **argv)
return (-1);
}
for (i=0; i<iterations; i++) {
/* Read in the private key info */
if (deleteCRL)
DeleteCRL (certHandle, nickName, crlType);
else if (listCRL) {
int i = 0;
for (i=0; i<10; i++)
ListCRL (certHandle, nickName, crlType);
}
else if (importCRL) {
@ -458,5 +467,6 @@ int main(int argc, char **argv)
ListCRLNames (certHandle, crlType, PR_FALSE);
}
#endif
}
return (rv);
}