Fix for bug 340909 . Add batch command to usage. r=nelson
git-svn-id: svn://10.0.0.236/trunk@199561 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
356dd8b6c3
commit
5dd322ef79
@ -997,6 +997,7 @@ Usage(char *progName)
|
||||
FPS "Usage: %s -T [-d certdir] [-P dbprefix] [-h token-name] [-f pwfile]\n", progName);
|
||||
FPS "\t%s -A -n cert-name -t trustargs [-d certdir] [-P dbprefix] [-a] [-i input]\n",
|
||||
progName);
|
||||
FPS "\t%s -B -i batch-file\n", progName);
|
||||
FPS "\t%s -C [-c issuer-name | -x] -i cert-request-file -o cert-file\n"
|
||||
"\t\t [-m serial-number] [-w warp-months] [-v months-valid]\n"
|
||||
"\t\t [-f pwfile] [-d certdir] [-P dbprefix] [-1] [-2] [-3] [-4] [-5]\n"
|
||||
@ -1045,6 +1046,8 @@ static void LongUsage(char *progName)
|
||||
|
||||
FPS "%-15s Add a certificate to the database (create if needed)\n",
|
||||
"-A");
|
||||
FPS "%-15s Run a series of certutil commands from a batch file\n", "-B");
|
||||
FPS "%-20s Specify the batch file\n", " -i batch-file");
|
||||
FPS "%-15s Add an Email certificate to the database (create if needed)\n",
|
||||
"-E");
|
||||
FPS "%-20s Specify the nickname of the certificate to add\n",
|
||||
@ -2306,7 +2309,8 @@ enum {
|
||||
cmd_ListModules,
|
||||
cmd_CheckCertValidity,
|
||||
cmd_ChangePassword,
|
||||
cmd_Version
|
||||
cmd_Version,
|
||||
cmd_Batch
|
||||
};
|
||||
|
||||
/* Certutil options */
|
||||
@ -2348,8 +2352,7 @@ enum {
|
||||
opt_RW,
|
||||
opt_Exponent,
|
||||
opt_NoiseFile,
|
||||
opt_Hash,
|
||||
opt_Batch
|
||||
opt_Hash
|
||||
};
|
||||
|
||||
static int
|
||||
@ -2406,7 +2409,8 @@ secuCommandFlag certutil_commands[] =
|
||||
{ /* cmd_ListModules */ 'U', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_CheckCertValidity */ 'V', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_ChangePassword */ 'W', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Version */ 'Y', PR_FALSE, 0, PR_FALSE }
|
||||
{ /* cmd_Version */ 'Y', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* cmd_Batch */ 'B', PR_FALSE, 0, PR_FALSE }
|
||||
};
|
||||
|
||||
secuCommandFlag certutil_options[] =
|
||||
@ -2448,8 +2452,7 @@ secuCommandFlag certutil_options[] =
|
||||
{ /* opt_RW */ 'X', PR_FALSE, 0, PR_FALSE },
|
||||
{ /* opt_Exponent */ 'y', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_NoiseFile */ 'z', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Hash */ 'Z', PR_TRUE, 0, PR_FALSE },
|
||||
{ /* opt_Batch */ 'B', PR_TRUE, 0, PR_FALSE }
|
||||
{ /* opt_Hash */ 'Z', PR_TRUE, 0, PR_FALSE }
|
||||
};
|
||||
|
||||
|
||||
@ -3080,13 +3083,21 @@ shutdown:
|
||||
* - each line in the batch file is limited to 512 characters
|
||||
*/
|
||||
|
||||
if ((SECSuccess == rv) && certutil.options[opt_Batch].activated) {
|
||||
FILE* batchFile = fopen(certutil.options[opt_Batch].arg, "r");
|
||||
if ((SECSuccess == rv) && certutil.commands[cmd_Batch].activated) {
|
||||
FILE* batchFile = NULL;
|
||||
if (!certutil.options[opt_InputFile].activated ||
|
||||
!certutil.options[opt_InputFile].arg) {
|
||||
PR_fprintf(PR_STDERR,
|
||||
"%s: no batch input file specified.\n",
|
||||
progName);
|
||||
return 255;
|
||||
}
|
||||
batchFile = fopen(certutil.options[opt_InputFile].arg, "r");
|
||||
char nextcommand[512];
|
||||
if (!batchFile) {
|
||||
PR_fprintf(PR_STDERR,
|
||||
"%s: unable to open \"%s\" for reading (%ld, %ld).\n",
|
||||
progName, certutil.options[opt_Batch].arg,
|
||||
progName, certutil.options[opt_InputFile].arg,
|
||||
PR_GetError(), PR_GetOSError());
|
||||
return 255;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user