From 8751cd2c5cc0c41c5d85724fddfd5d872ad994ed Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 17 May 2017 16:30:52 +0200 Subject: Fixed CERT_REQUEST_PROCESSED events in ConnectorServlet. The code that generates CERT_REQUEST_PROCESSED events in ConnectorServlet.processRequest() has been moved into a finally- clause that wraps around IRequestQueue.processRequest() to ensure that the events are generated properly. If a cert was issued for the request that has just been processed the event outcome is a Success, otherwise it's a Failure. Any exception thrown by the IRequestQueue.processRequest() will be passed to the ConnectorServlet.processRequest()'s callers. https://pagure.io/dogtagpki/issue/2690 Change-Id: I07454afb75328fbee3e50e5852adb5085be0613e --- .../cms/servlet/connector/ConnectorServlet.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'base/server/cms') diff --git a/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java b/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java index eeb640ebc..82f3071cd 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java +++ b/base/server/cms/src/com/netscape/cms/servlet/connector/ConnectorServlet.java @@ -617,6 +617,8 @@ public class ConnectorServlet extends CMSServlet { try { queue.processRequest(thisreq); + } finally { + if (isProfileRequest(thisreq)) { X509CertImpl x509cert = thisreq.getExtDataInCert(IEnrollProfile.REQUEST_ISSUED_CERT); @@ -629,28 +631,17 @@ public class ConnectorServlet extends CMSServlet { auditRequesterID, ILogger.SIGNED_AUDIT_ACCEPTANCE, x509cert)); - } - } - } catch (EBaseException eAudit1) { - if (isProfileRequest(thisreq)) { - - X509CertImpl x509cert = thisreq.getExtDataInCert(IEnrollProfile.REQUEST_ISSUED_CERT); - - if (x509cert != null) { + } else { audit(new CertRequestProcessedEvent( auditSubjectID, ILogger.FAILURE, auditRequesterID, - ILogger.SIGNED_AUDIT_ACCEPTANCE, - x509cert)); + ILogger.SIGNED_AUDIT_REJECTION, + ILogger.SIGNED_AUDIT_EMPTY_VALUE)); } } - - // rethrow EBaseException to primary catch clause - // within this method - throw eAudit1; } replymsg = CMS.getHttpPKIMessage(); -- cgit