Fix Windows build bustage from previous checkin for bug 324744.
authornelson%bolyard.com
Sun, 09 Sep 2007 17:01:10 +0000
changeset 8041 f0169781e0d962be9eb889012356205a306b882d
parent 8040 31ae7ae278deb6d8ba4b2df27ccb819218573e38
child 8042 7d1e08ff702a3d657627cc2de4c051314353a8b2
push idunknown
push userunknown
push dateunknown
bugs324744
Fix Windows build bustage from previous checkin for bug 324744. Also, Shorten a large number of too-long lines.
security/nss/cmd/certutil/certext.c
--- a/security/nss/cmd/certutil/certext.c
+++ b/security/nss/cmd/certutil/certext.c
@@ -119,22 +119,28 @@ GetGeneralName (PRArenaPool *arena)
     int intValue;
     char buffer[512];
     void *mark;
 
     PORT_Assert (arena);
     mark = PORT_ArenaMark (arena);
     do {
         if (PrintChoicesAndGetAnswer(
-                "\nSelect one of the following general name type: \n"
-                "\t1 - instance of other name\n\t2 - rfc822Name\n\t3 - dnsName\n"
-                "\t4 - x400Address\n\t5 - directoryName\n\t6 - ediPartyName\n"
-                "\t7 - uniformResourceidentifier\n\t8 - ipAddress\n\t9 - registerID\n"
-                "\tAny other number to finish\n\t\tChoice:",
-                buffer, sizeof(buffer)) == SECFailure) {
+		"\nSelect one of the following general name type: \n"
+		"\t1 - instance of other name\n"
+		"\t2 - rfc822Name\n"
+		"\t3 - dnsName\n"
+		"\t4 - x400Address\n"
+		"\t5 - directoryName\n"
+		"\t6 - ediPartyName\n"
+		"\t7 - uniformResourceidentifier\n"
+		"\t8 - ipAddress\n"
+		"\t9 - registerID\n"
+		"\tAny other number to finish\n"
+		"\t\tChoice:", buffer, sizeof(buffer)) == SECFailure) {
             GEN_BREAK (SECFailure);
         }
         intValue = PORT_Atoi (buffer);
         /*
          * Should use ZAlloc instead of Alloc to avoid problem with garbage
          * initialized pointers in CERT_CopyName
          */
         if (intValue >= certOtherName && intValue <= certRegisterID) {
@@ -385,21 +391,20 @@ AddOidToSequence(CERTOidSequence *os, SE
     os->oids = oids;
     os->oids[count] = &od->oid;
 
     return SECSuccess;
 }
 
 SEC_ASN1_MKSUB(SEC_ObjectIDTemplate)
 
-  const SEC_ASN1Template CERT_OidSeqTemplate[] = {
-      { SEC_ASN1_SEQUENCE_OF | SEC_ASN1_XTRN,
-        offsetof(CERTOidSequence, oids),
-        SEC_ASN1_SUB(SEC_ObjectIDTemplate) }
-  };
+const SEC_ASN1Template CERT_OidSeqTemplate[] = {
+    { SEC_ASN1_SEQUENCE_OF | SEC_ASN1_XTRN, offsetof(CERTOidSequence, oids),
+      SEC_ASN1_SUB(SEC_ObjectIDTemplate) }
+};
 
 
 static SECItem *
 EncodeOidSequence(CERTOidSequence *os)
 {
     SECItem *rv;
 
     rv = (SECItem *)PORT_ArenaZNew(os->arena, SECItem);
@@ -650,20 +655,18 @@ AddBasicConstraint(void *extHandle)
             GEN_BREAK(SECFailure);
         }
         if (PORT_Strlen (buffer) > 0)
             basicConstraint.pathLenConstraint = PORT_Atoi (buffer);
 
         yesNoAns = GetYesNo ("Is this a critical extension [y/N]?");
 
         rv = SECU_EncodeAndAddExtensionValue(NULL, extHandle,
-                                             &basicConstraint, yesNoAns,
-                                             SEC_OID_X509_BASIC_CONSTRAINTS,
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodeBasicConstraintValue);
+		 &basicConstraint, yesNoAns, SEC_OID_X509_BASIC_CONSTRAINTS,
+		 (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeBasicConstraintValue);
     } while (0);
 
     return (rv);
 }
 
 static SECStatus 
 AddAuthKeyID (void *extHandle)
 {
@@ -698,20 +701,18 @@ AddAuthKeyID (void *extHandle)
 
 
         rv = GetString (arena, "Enter value for the authCertSerial field, "
                         "enter to omit:", &authKeyID->authCertSerialNumber);
 
         yesNoAns = GetYesNo ("Is this a critical extension [y/N]?");
 
         rv = SECU_EncodeAndAddExtensionValue(arena, extHandle,
-                                             authKeyID, yesNoAns,
-                                             SEC_OID_X509_AUTH_KEY_ID, 
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodeAuthKeyID);
+		     authKeyID, yesNoAns, SEC_OID_X509_AUTH_KEY_ID, 
+		     (EXTEN_EXT_VALUE_ENCODER) CERT_EncodeAuthKeyID);
         if (rv)
             break;
 
     } while (0);
     if (arena)
         PORT_FreeArena (arena, PR_FALSE);
     return (rv);
 }   
@@ -828,33 +829,31 @@ AddCrlDistPoint(void *extHandle)
 
         crlDistPoints->distPoints[count] = current;
         ++count;
         if (GetYesNo ("Enter more value for the CRL distribution "
                       "point extension [y/N]") == 0) {
             /* Add null to the end to mark end of data */
             crlDistPoints->distPoints =
                 PORT_ArenaGrow(arena, crlDistPoints->distPoints,
-                               sizeof (*crlDistPoints->distPoints) * count,
-                               sizeof (*crlDistPoints->distPoints) *(count + 1));
+			   sizeof (*crlDistPoints->distPoints) * count,
+			   sizeof (*crlDistPoints->distPoints) *(count + 1));
             crlDistPoints->distPoints[count] = NULL;    
             break;
         }
 
 
     } while (1);
     
     if (rv == SECSuccess) {
         PRBool yesNoAns = GetYesNo ("Is this a critical extension [y/N]?");
 
         rv = SECU_EncodeAndAddExtensionValue(arena, extHandle,
-                                             crlDistPoints, yesNoAns, 
-                                             SEC_OID_X509_CRL_DIST_POINTS,
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodeCRLDistributionPoints);
+		 crlDistPoints, yesNoAns, SEC_OID_X509_CRL_DIST_POINTS,
+		 (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeCRLDistributionPoints);
     }
     if (arena)
         PORT_FreeArena (arena, PR_FALSE);
     return (rv);
 }
 
 
 
@@ -915,19 +914,18 @@ AddPolicyConstraints(void *extHandle)
     }
  
     
     if (!skipExt) {
 
         yesNoAns = GetYesNo("Is this a critical extension [y/N]?");
 
         rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, policyConstr,
-                                             yesNoAns, SEC_OID_X509_POLICY_CONSTRAINTS,
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodePolicyConstraintsExtension);
+	     yesNoAns, SEC_OID_X509_POLICY_CONSTRAINTS,
+	     (EXTEN_EXT_VALUE_ENCODER)CERT_EncodePolicyConstraintsExtension);
     }
     
 loser:
     if (arena) {
         PORT_FreeArena (arena, PR_FALSE);
     }
     return (rv);
 }
@@ -963,20 +961,18 @@ AddInhibitAnyPolicy(void *extHandle)
     dummy = SEC_ASN1EncodeInteger(arena, item, value);
     if (!dummy) {
         goto loser;
     }
     
     yesNoAns = GetYesNo("Is this a critical extension [y/N]?");
     
     rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, &certInhibitAny,
-                                         yesNoAns,
-                                         SEC_OID_X509_INHIBIT_ANY_POLICY,
-                                         (EXTEN_EXT_VALUE_ENCODER)
-                                         CERT_EncodeInhibitAnyExtension);
+		 yesNoAns, SEC_OID_X509_INHIBIT_ANY_POLICY,
+		 (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeInhibitAnyExtension);
 loser:
     if (arena) {
         PORT_FreeArena (arena, PR_FALSE);
     }
     return (rv);
 }
 
 
@@ -1057,19 +1053,18 @@ AddPolicyMappings(void *extHandle)
 
     if (rv == SECSuccess) {
         CERTCertificatePolicyMappings mappings;
         PRBool yesNoAns = GetYesNo("Is this a critical extension [y/N]?");
 
         mappings.arena = arena;
         mappings.policyMaps = policyMapArr;
         rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, &mappings,
-                                             yesNoAns, SEC_OID_X509_POLICY_MAPPINGS,
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodePolicyMappingExtension);
+		 yesNoAns, SEC_OID_X509_POLICY_MAPPINGS,
+		 (EXTEN_EXT_VALUE_ENCODER)CERT_EncodePolicyMappingExtension);
     }
     if (arena)
         PORT_FreeArena (arena, PR_FALSE);
     return (rv);
 }
 
 enum PoliciQualifierEnum {
     cpsPointer = 1,
@@ -1108,44 +1103,44 @@ RequestPolicyQualifiers(PRArenaPool *are
                 "\tAny other number to finish\n"
                 "\t\tChoice: ", buffer, sizeof(buffer)) == SECFailure) {
             GEN_BREAK (SECFailure);
         }
         intValue = PORT_Atoi(buffer);
         switch (intValue) {
         case cpsPointer: {
             SECItem input;
+
             oid = SECOID_FindOIDByTag(SEC_OID_PKIX_CPS_POINTER_QUALIFIER);
             if (PrintChoicesAndGetAnswer("Enter CPS Pointer uri: ",
-                                         buffer, sizeof(buffer)) == SECFailure) {
+				     buffer, sizeof(buffer)) == SECFailure) {
                 GEN_BREAK (SECFailure);
             }
             input.len = PORT_Strlen(buffer);
             input.data = (void*)PORT_ArenaStrdup(arena, buffer);
             if (input.data == NULL ||
 	        SEC_ASN1EncodeItem(arena, &current->qualifierValue, &input,
-                                   SEC_IA5StringTemplate) == NULL) {
+			       SEC_ASN1_GET(SEC_IA5StringTemplate)) == NULL) {
                 GEN_BREAK (SECFailure);
 	    }
             break;
         }
         case userNotice: {
-            SECItem input;
             SECItem **noticeNumArr;
             CERTUserNotice *notice = PORT_ArenaZNew(arena, CERTUserNotice);
             if (!notice) {
                 GEN_BREAK(SECFailure);
             }
             
             oid = SECOID_FindOIDByTag(SEC_OID_PKIX_USER_NOTICE_QUALIFIER);
 
             if (GetYesNo("\t Enter user notice reference? [y/N]")) {
 
                 if (PrintChoicesAndGetAnswer("Enter user organization: ",
-                                             buffer, sizeof(buffer)) == SECFailure) {
+				 buffer, sizeof(buffer)) == SECFailure) {
                     GEN_BREAK (SECFailure);
                 }
 
                 notice->noticeReference.organization.type = siAsciiString;
                 notice->noticeReference.organization.len =
                     PORT_Strlen(buffer);
                 notice->noticeReference.organization.data =
                     (void*)PORT_ArenaStrdup(arena, buffer);
@@ -1157,33 +1152,34 @@ RequestPolicyQualifiers(PRArenaPool *are
 		}
                 
                 do {
                     SECItem *noticeNum;
                     
                     noticeNum = PORT_ArenaZNew(arena, SECItem);
                     
                     if (noticeNum == NULL ||
-		        PrintChoicesAndGetAnswer("Enter notice number of any key"
-                                         " to continue:", buffer, sizeof(buffer))
-                                         == SECFailure) {
+		        PrintChoicesAndGetAnswer(
+				"Enter notice number of any key"
+				" to continue:", buffer, sizeof(buffer))
+			== SECFailure) {
                         GEN_BREAK (SECFailure);
                     }
                     
                     intValue = PORT_Atoi(buffer);
                     if (!SEC_ASN1EncodeInteger(arena, noticeNum, intValue)) {
                         GEN_BREAK (SECFailure);
 		    }
                     noticeNumArr[inCount++] = noticeNum;
                     noticeNumArr[inCount] = NULL;
                     
                     if (GetYesNo("Enter one more user notice number[y/N]")) {
                         noticeNumArr = PORT_ArenaGrow(arena, noticeNumArr,
-                                                      sizeof (current) * inCount,
-                                                   sizeof (current) *(inCount + 1));
+					      sizeof (current) * inCount,
+					      sizeof (current) *(inCount + 1));
                         if (noticeNumArr == NULL) {
                             GEN_BREAK (SECFailure);
                         }
                     } else {
 			break;
 		    }
                 } while (1);
                 if (rv == SECFailure) {
@@ -1199,32 +1195,34 @@ RequestPolicyQualifiers(PRArenaPool *are
             if (GetYesNo("\t Enter user notice text? [y/N]")) {
                 /* Getting only 200 bytes - RFC limitation */
                 if (PrintChoicesAndGetAnswer(
                         "\t", buffer, 200) == SECFailure) {
                         GEN_BREAK (SECFailure);
                 }
                 notice->displayText.type = siAsciiString;
                 notice->displayText.len = PORT_Strlen(buffer);
-                notice->displayText.data = (void*)PORT_ArenaStrdup(arena, buffer);
+                notice->displayText.data = 
+		                        (void*)PORT_ArenaStrdup(arena, buffer);
 		if (notice->displayText.data == NULL) {
 		    GEN_BREAK(SECFailure);
 		}
             }
 
             rv = CERT_EncodeUserNotice(arena, notice, &current->qualifierValue);
             if (rv == SECFailure) {
                 GEN_BREAK(SECFailure);
             }
 
             break;
         }
         }
         if (rv == SECFailure || oid == NULL ||
-            SECITEM_CopyItem(arena, &current->qualifierID, &oid->oid) == SECFailure) {
+            SECITEM_CopyItem(arena, &current->qualifierID, &oid->oid) 
+	    == SECFailure) {
             GEN_BREAK (SECFailure);
         }
 
         if (!policyQualifArr) {
             policyQualifArr = PORT_ArenaZNew(arena, CERTPolicyQualifier *);
         } else {
 	    policyQualifArr = PORT_ArenaGrow (arena, policyQualifArr,
                                          sizeof (current) * count,
@@ -1303,17 +1301,17 @@ AddCertPolices(void *extHandle)
         if (certPoliciesArr == NULL) {
             GEN_BREAK (SECFailure);
         }
     
         certPoliciesArr[count] = current;
         ++count;
         
         if (!GetYesNo ("Enter more policy information to the"
-                    " Cert Policy extension [y/N]")) {
+                       " Cert Policy extension [y/N]")) {
             /* Add null to the end to mark end of data */
             certPoliciesArr = PORT_ArenaGrow(arena, certPoliciesArr,
                                               sizeof (current) * count,
                                               sizeof (current) *(count + 1));
             if (certPoliciesArr == NULL) {
                 GEN_BREAK (SECFailure);
             }
             certPoliciesArr[count] = NULL;        
@@ -1325,22 +1323,21 @@ AddCertPolices(void *extHandle)
     if (rv == SECSuccess) {
         CERTCertificatePolicies policies;
         PRBool yesNoAns = GetYesNo("Is this a critical extension [y/N]?");
 
         policies.arena = arena;
         policies.policyInfos = certPoliciesArr;
         
         rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, &policies,
-                                             yesNoAns, SEC_OID_X509_CERTIFICATE_POLICIES,
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodeCertPoliciesExtension);
+		 yesNoAns, SEC_OID_X509_CERTIFICATE_POLICIES,
+		 (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeCertPoliciesExtension);
     }
     if (arena)
-    PORT_FreeArena(arena, PR_FALSE);
+	PORT_FreeArena(arena, PR_FALSE);
     return (rv);
 }
 
 enum AuthInfoAccessTypesEnum {
     caIssuers = 1,
     ocsp = 2
 };
 
@@ -1411,17 +1408,18 @@ AddInfoAccess(void *extHandle, PRBool ad
                   break;
                   
               case ocsp:
                   oid = SECOID_FindOIDByTag(SEC_OID_PKIX_OCSP);
                   break;
             } 
         }
         if (oid == NULL ||
-            SECITEM_CopyItem(arena, &current->method, &oid->oid) == SECFailure) {
+            SECITEM_CopyItem(arena, &current->method, &oid->oid) 
+	    == SECFailure) {
             GEN_BREAK (SECFailure);
         }
 
         current->location = GetGeneralName(arena);
         if (!current->location) {
             GEN_BREAK(SECFailure);
         }
        
@@ -1461,19 +1459,18 @@ AddInfoAccess(void *extHandle, PRBool ad
         int oidIdent = SEC_OID_X509_AUTH_INFO_ACCESS;
 
         PRBool yesNoAns = GetYesNo("Is this a critical extension [y/N]?");
         
         if (addSIAExt) {
             oidIdent = SEC_OID_X509_SUBJECT_INFO_ACCESS;
         }
         rv = SECU_EncodeAndAddExtensionValue(arena, extHandle, infoAccArr,
-                                             yesNoAns, oidIdent,
-                                             (EXTEN_EXT_VALUE_ENCODER)
-                                             CERT_EncodeInfoAccessExtension);
+		 yesNoAns, oidIdent,
+		 (EXTEN_EXT_VALUE_ENCODER)CERT_EncodeInfoAccessExtension);
     }
     if (arena)
         PORT_FreeArena(arena, PR_FALSE);
     return (rv);
 }
 
 SECStatus
 AddExtensions(void *extHandle, const char *emailAddrs, const char *dnsNames,