diff options
author | Kai Engert <kaie@kuix.de> | 2017-02-17 16:06:52 +0100 |
---|---|---|
committer | Kai Engert <kaie@kuix.de> | 2017-02-17 16:06:52 +0100 |
commit | 432026376cb4e7a2f0608cc87c18990594ffcd1f (patch) | |
tree | e11bc67da3fb4bd032efdcf5b48767a023db8090 /cmd/lib | |
parent | 96518a51e16baa4c2b560c69f7d4605c31c45e44 (diff) | |
download | nss-hg-432026376cb4e7a2f0608cc87c18990594ffcd1f.tar.gz |
Bug 1334976, improve certutil to be smarter about the Mozilla Policy CA flag, r=rrelyea
Diffstat (limited to 'cmd/lib')
-rw-r--r-- | cmd/lib/secutil.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/cmd/lib/secutil.c b/cmd/lib/secutil.c index 1d910a40b..cb4752df9 100644 --- a/cmd/lib/secutil.c +++ b/cmd/lib/secutil.c @@ -3230,6 +3230,8 @@ SEC_PrintCertificateAndTrust(CERTCertificate *cert, SECItem data; CERTCertTrust certTrust; PK11SlotList *slotList; + PRBool falseAttributeFound = PR_FALSE; + PRBool trueAttributeFound = PR_FALSE; const char *moz_policy_ca_info = NULL; data.data = cert->derCert.data; @@ -3250,23 +3252,24 @@ SEC_PrintCertificateAndTrust(CERTCertificate *cert, PORT_SetError(0); if (PK11_HasAttributeSet(se->slot, handle, CKA_NSS_MOZILLA_CA_POLICY, PR_FALSE)) { - moz_policy_ca_info = "true (attribute present)"; - } else { - if (PORT_GetError() != 0) { - moz_policy_ca_info = "false (attribute missing)"; - } else { - moz_policy_ca_info = "false (attribute present)"; - } + trueAttributeFound = PR_TRUE; + } else if (!PORT_GetError()) { + falseAttributeFound = PR_TRUE; } } } PK11_FreeSlotList(slotList); } - if (moz_policy_ca_info) { - SECU_Indent(stdout, 1); - printf("Mozilla-CA-Policy: %s\n", moz_policy_ca_info); + if (trueAttributeFound) { + moz_policy_ca_info = "true (attribute present)"; + } else if (falseAttributeFound) { + moz_policy_ca_info = "false (attribute present)"; + } else { + moz_policy_ca_info = "false (attribute missing)"; } + SECU_Indent(stdout, 1); + printf("Mozilla-CA-Policy: %s\n", moz_policy_ca_info); if (trust) { SECU_PrintTrustFlags(stdout, trust, |