Allow us to use file redirection to input new cert extentions (remove the input flushes) NSS_30_BRANCH
authorrelyea%netscape.com
Tue, 20 Jun 2000 17:44:42 +0000
branchNSS_30_BRANCH
changeset 388 ac3c20a1309f4e9b3889423f2de04ac1408cbf9c
parent 387 2408f3ada7be70592c70c4a1acdc15216676dacd
child 389 6bc84c76ed139db31a4211b311e29da2b3bc155d
push idunknown
push userunknown
push dateunknown
Allow us to use file redirection to input new cert extentions (remove the input flushes)
security/nss/cmd/certutil/certutil.c
--- a/security/nss/cmd/certutil/certutil.c
+++ b/security/nss/cmd/certutil/certutil.c
@@ -95,17 +95,17 @@ GetGeneralName (PRArenaPool *arena)
     SECStatus rv = SECSuccess;
     int intValue;
     char buffer[512];
     void *mark;
 
     PORT_Assert (arena);
     mark = PORT_ArenaMark (arena);
     do {
-	fflush (stdin);
+	/*fflush (stdin);*/
 	puts ("\nSelect one of the following general name type: \n");
 	puts ("\t1 - instance of other name\n\t2 - rfc822Name\n\t3 - dnsName\n");
 	puts ("\t4 - x400Address\n\t5 - directoryName\n\t6 - ediPartyName\n");
 	puts ("\t7 - uniformResourceidentifier\n\t8 - ipAddress\n\t9 - registerID\n");
 	puts ("\tOther - omit\n\t\tChoice:");
 	scanf ("%d", &intValue);
 	if (intValue >= certOtherName || intValue <= certRegisterID) {
 	    if (namesList == NULL) {
@@ -118,17 +118,17 @@ GetGeneralName (PRArenaPool *arena)
 	    if (current == NULL) {
 		GEN_BREAK (SECFailure);
 	    }	
 	} else {
 	    break;
 	}
 	current->type = intValue;
 	puts ("\nEnter data:");
-	fflush (stdin);
+	/*fflush (stdin); */
 	fflush (stdout);
 	gets (buffer);
 	switch (current->type) {
 	    case certURI:
 	    case certDNSName:
 	    case certRFC822Name:
 		current->name.other.data = PORT_ArenaAlloc (arena, strlen (buffer));
 		if (current->name.other.data == NULL) {
@@ -193,17 +193,17 @@ static SECStatus
 GetString(PRArenaPool *arena, char *prompt, SECItem *value)
 {
     char buffer[251];
 
     value->data = NULL;
     value->len = 0;
     
     puts (prompt);
-    fflush (stdin);
+    /*fflush (stdin);*/
     gets (buffer);
     if (strlen (buffer) > 0) {
 	value->data = PORT_ArenaAlloc (arena, strlen (buffer));
 	if (value->data == NULL) {
 	    PORT_SetError (SEC_ERROR_NO_MEMORY);
 	    return (SECFailure);
 	}
 	PORT_Memcpy (value->data, buffer, value->len = strlen(buffer));
@@ -1516,17 +1516,17 @@ AddBasicConstraint(void *extHandle)
     SECStatus rv;
     char buffer[10];
 
     encodedValue.data = NULL;
     encodedValue.len = 0;
     do {
 	basicConstraint.pathLenConstraint = CERT_UNLIMITED_PATH_CONSTRAINT;
 	puts ("Is this a CA certificate [y/n]?");
-	fflush (stdin);
+	/*fflush (stdin);*/
 	gets (buffer);
 	basicConstraint.isCA = (buffer[0] == 'Y' || buffer[0] == 'y') ?
                                 PR_TRUE : PR_FALSE;
 
 	puts ("Enter the path length constraint, enter to skip [<0 for unlimited path]:");
 	gets (buffer);
 	if (PORT_Strlen (buffer) > 0)
 	    basicConstraint.pathLenConstraint = atoi (buffer);
@@ -1649,17 +1649,17 @@ AddAuthKeyID (void *extHandle)
 	if (GetYesNo ("Enter value for the authKeyID extension [y/n]?\n") == 0)
 	    break;
 	
 	authKeyID = PORT_ArenaZAlloc (arena, sizeof (CERTAuthKeyID));
 	if (authKeyID == NULL) {
 	    GEN_BREAK (SECFailure);
 	}
 
-	fflush (stdin);
+	/*fflush (stdin);*/
 	rv = GetString (arena, "Enter value for the key identifier fields, enter to omit:",
 			&authKeyID->keyID);
 	if (rv != SECSuccess)
 	    break;
 	authKeyID->authCertIssuer = GetGeneralName (arena);
 	if (authKeyID->authCertIssuer == NULL && SECFailure == PORT_GetError ())
 		break;
 	
@@ -1701,17 +1701,17 @@ AddCrlDistPoint(void *extHandle)
 
     do {
 	current = NULL;
 	current = PORT_ArenaZAlloc (arena, sizeof (*current));
         if (current == NULL) {
 	    GEN_BREAK (SECFailure);
 	}   
 
-	fflush (stdin);
+	/*fflush (stdin);*/
 	/* Get the distributionPointName fields - this field is optional */
 	puts ("Enter the type of the distribution point name:\n");
 	puts ("\t1 - Full Name\n\t2 - Relative Name\n\tOther - omit\n\t\tChoice: ");
 	scanf ("%d", &intValue);
 	switch (intValue) {
 	    case generalName:
 		current->distPointType = intValue;
 		current->distPoint.fullName = GetGeneralName (arena);
@@ -1720,17 +1720,17 @@ AddCrlDistPoint(void *extHandle)
 		
 	    case relativeDistinguishedName: {
 		CERTName *name;
 		char buffer[512];
 
 		current->distPointType = intValue;
 		puts ("Enter the relative name: ");
 		fflush (stdout);
-		fflush (stdin);
+		/*fflush (stdin);*/
 		gets (buffer);
 		/* For simplicity, use CERT_AsciiToName to converse from a string
 		   to NAME, but we only interest in the first RDN */
 		name = CERT_AsciiToName (buffer);
 		if (!name) {
 		    GEN_BREAK (SECFailure);
 		}
 		rv = CERT_CopyRDN (arena, &current->distPoint.relativeName, name->rdns[0]);
@@ -1787,17 +1787,17 @@ AddCrlDistPoint(void *extHandle)
 	    crlDistPoints->distPoints[count] = NULL;	    
 	    break;
 	}
 	
 
     } while (1);
     
     if (rv == SECSuccess) {
-	fflush (stdin);
+	/*fflush (stdin);*/
 	buffer[0] = 'n';
 	puts ("Is this a critical extension [y/n]? ");
 	gets (buffer);	
 	
 	rv = EncodeAndAddExtensionValue(arena, extHandle, crlDistPoints,
 	      (buffer[0] == 'Y' || buffer[0] == 'y') ? PR_TRUE : PR_FALSE,
 	      SEC_OID_X509_CRL_DIST_POINTS,
 	      (EXTEN_VALUE_ENCODER)  CERT_EncodeCRLDistributionPoints);