summaryrefslogtreecommitdiffstats
path: root/base/server/cms/src/com
diff options
context:
space:
mode:
authorChristina Fu <cfu@redhat.com>2015-06-15 15:04:39 -0700
committerChristina Fu <cfu@redhat.com>2015-06-15 15:07:45 -0700
commit177cae5a7bca20ab82cc5b2f96d81b6ba57d7adc (patch)
treee9c94564a33b832946315aeacbd4039c0eef43f0 /base/server/cms/src/com
parent3ea331ef85c341a3769865304eb7ab256f9f5e6b (diff)
downloadpki-177cae5a7bca20ab82cc5b2f96d81b6ba57d7adc.tar.gz
pki-177cae5a7bca20ab82cc5b2f96d81b6ba57d7adc.tar.xz
pki-177cae5a7bca20ab82cc5b2f96d81b6ba57d7adc.zip
Ticket 1410 Issue with Generic Extension being critical
- patch ported from https://bugzilla.redhat.com/show_bug.cgi?id=1011984
Diffstat (limited to 'base/server/cms/src/com')
-rw-r--r--base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java11
-rw-r--r--base/server/cms/src/com/netscape/cms/profile/def/GenericExtDefault.java17
2 files changed, 26 insertions, 2 deletions
diff --git a/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java b/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java
index 5c2029a0f..8a6fa4cef 100644
--- a/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java
+++ b/base/server/cms/src/com/netscape/cms/profile/def/EnrollDefault.java
@@ -259,7 +259,11 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe
setValue(name, locale, info, value);
- request.setExtData(IEnrollProfile.REQUEST_CERTINFO, info);
+ boolean ret = request.setExtData(IEnrollProfile.REQUEST_CERTINFO, info);
+ if (ret == false) {
+ CMS.debug("EnrollDefault: setValue(): request.setExtData() returned false");
+ throw new EPropertyException("EnrollDefault: setValue(): request.setExtData() failed");
+ }
}
/**
@@ -328,6 +332,11 @@ public abstract class EnrollDefault implements IPolicyDefault, ICertInfoPolicyDe
protected Extension getExtension(String name, X509CertInfo info) {
CertificateExtensions exts = null;
+ if (info == null) {
+ CMS.debug("EnrollDefault: getExtension(), info == null");
+ return null;
+ }
+
try {
exts = (CertificateExtensions)
info.get(X509CertInfo.EXTENSIONS);
diff --git a/base/server/cms/src/com/netscape/cms/profile/def/GenericExtDefault.java b/base/server/cms/src/com/netscape/cms/profile/def/GenericExtDefault.java
index f344648ab..5c9fdd5c8 100644
--- a/base/server/cms/src/com/netscape/cms/profile/def/GenericExtDefault.java
+++ b/base/server/cms/src/com/netscape/cms/profile/def/GenericExtDefault.java
@@ -99,6 +99,11 @@ public class GenericExtDefault extends EnrollExtDefault {
public void setValue(String name, Locale locale,
X509CertInfo info, String value)
throws EPropertyException {
+ if (info == null) {
+ CMS.debug("GenericExtDefault: setValue() info == null");
+ throw new EPropertyException("GenericExtDefault: setValue() info == null");
+ }
+
try {
Extension ext = null;
@@ -136,7 +141,11 @@ public class GenericExtDefault extends EnrollExtDefault {
replaceExtension(ext.getExtensionId().toString(), ext, info);
} catch (EProfileException e) {
- CMS.debug("GenericExtDefault: setValue " + e.toString());
+ CMS.debug("GenericExtDefault: setValue() " + e.toString());
+ throw new EPropertyException("GenericExtDefault:"+ e.toString());
+ } catch (Exception e) {
+ // catch all other exceptions
+ CMS.debug("GenericExtDefault: setValue() " + e.toString());
}
}
@@ -150,6 +159,12 @@ public class GenericExtDefault extends EnrollExtDefault {
locale, "CMS_INVALID_PROPERTY", name));
}
+ if (info == null) {
+ CMS.debug("GenericExtDefault : getValue(): info == null");
+ throw new EPropertyException(CMS.getUserMessage(
+ locale, "GenericExtDefault : getValue(): info == null"));
+ }
+
ObjectIdentifier oid = new ObjectIdentifier(getConfig(CONFIG_OID));
ext = getExtension(oid.toString(), info);