Skip to content

Commit

Permalink
Update CAPublisherProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
edewata committed Jan 21, 2024
1 parent 2576558 commit 720f2ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ private void testSetLDAPDest(HttpServletRequest req, HttpServletResponse resp)
//params.add("restarted", "Publishing is restarted.");

if (ldapcfg.isEnabled()) {
CertificateAuthority ca = mProcessor.getAuthority();
CertificateAuthority ca = engine.getCA();

// publish ca cert
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.mozilla.jss.netscape.security.x509.X500Name;
import org.mozilla.jss.netscape.security.x509.X509CRLImpl;

import com.netscape.ca.CertificateAuthority;
import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.MetaInfo;
import com.netscape.certsrv.dbs.Modification;
Expand Down Expand Up @@ -59,20 +58,14 @@ public class CAPublisherProcessor extends PublisherProcessor {
public final static String PROP_CERTS = "certs";
public final static String PROP_XCERT = "xcert";

protected CertificateAuthority ca;
private boolean createOwnDNEntry;

public CAPublisherProcessor(String id) {
super(id);
}

public CertificateAuthority getAuthority() {
return ca;
}

public void init(CertificateAuthority ca, PublishingConfig config) throws EBaseException {
public void init(PublishingConfig config) throws EBaseException {

this.ca = ca;
this.createOwnDNEntry = config.getBoolean("createOwnDNEntry", false);

super.init(config);
Expand Down Expand Up @@ -181,6 +174,8 @@ public void setPublishedFlag(BigInteger serialNo, boolean published) {
*/
public void publishCACert(X509Certificate cert) throws ELdapException {

CAEngine engine = CAEngine.getInstance();

boolean error = false;
StringBuffer errorRule = new StringBuffer();

Expand All @@ -194,7 +189,7 @@ public void publishCACert(X509Certificate cert) throws ELdapException {
Enumeration<LdapRule> rules = getRules(PROP_LOCAL_CA);

if (rules == null || !rules.hasMoreElements()) {
if (ca.isClone()) {
if (engine.getCA().isClone()) {
logger.warn("CAPublisherProcessor: No rule is found for publishing: " + PROP_LOCAL_CA + " in this clone.");
return;
}
Expand Down Expand Up @@ -249,6 +244,7 @@ public void publishCACert(X509Certificate cert) throws ELdapException {
*/
public void unpublishCACert(X509Certificate cert) throws ELdapException {

CAEngine engine = CAEngine.getInstance();
boolean error = false;
StringBuffer errorRule = new StringBuffer();

Expand All @@ -260,7 +256,7 @@ public void unpublishCACert(X509Certificate cert) throws ELdapException {
Enumeration<LdapRule> rules = getRules(PROP_LOCAL_CA);

if (rules == null || !rules.hasMoreElements()) {
if (ca.isClone()) {
if (engine.getCA().isClone()) {
logger.warn("CAPublisherProcessor: No rule is found for unpublishing: " + PROP_LOCAL_CA + " in this clone.");
return;
}
Expand Down Expand Up @@ -318,6 +314,7 @@ public void unpublishCACert(X509Certificate cert) throws ELdapException {
*/
public void publishXCertPair(byte[] pair) throws ELdapException {

CAEngine engine = CAEngine.getInstance();
String errorRule = "";

if (!isCertPublishingEnabled()) {
Expand All @@ -330,7 +327,7 @@ public void publishXCertPair(byte[] pair) throws ELdapException {
Enumeration<LdapRule> rules = getRules(PROP_XCERT);

if (rules == null || !rules.hasMoreElements()) {
if (ca.isClone()) {
if (engine.getCA().isClone()) {
logger.warn("CAPublisherProcessor: No rule is found for publishing: " + PROP_LOCAL_CA + " in this clone.");
return;
}
Expand Down Expand Up @@ -767,14 +764,16 @@ private void publishNow(Mapper mapper, Publisher publisher, Request r, Object ob
// for crosscerts
private void publishNow(Mapper mapper, Publisher publisher, Request r, byte[] bytes) throws EBaseException {

CAEngine engine = CAEngine.getInstance();

if (!isCertPublishingEnabled()) {
return;
}

logger.info("CAPublisherProcessor: in publishNow() for xcerts");

// use ca cert publishing map and rule
X509Certificate caCert = ca.getCACert();
X509Certificate caCert = engine.getCA().getCACert();

LDAPConnection conn = null;

Expand Down
4 changes: 1 addition & 3 deletions base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,6 @@ public void initPublisherProcessor() throws Exception {

logger.info("CAEngine: Initializing publisher processor");

CertificateAuthority hostCA = getCA();

publisherProcessor = new CAPublisherProcessor(CertificateAuthority.ID + "pp");

if (publishingConfig.isEnabled()) {
Expand All @@ -539,7 +537,7 @@ public void initPublisherProcessor() throws Exception {
publisherProcessor.setRequestListener(listener);
}

publisherProcessor.init(hostCA, publishingConfig);
publisherProcessor.init(publishingConfig);
}

public void initCRLIssuingPoints() throws Exception {
Expand Down

0 comments on commit 720f2ba

Please sign in to comment.