summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java')
-rw-r--r--pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java377
1 files changed, 182 insertions, 195 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java
index e9839f595..325d2a0d3 100644
--- a/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java
+++ b/pki/base/common/src/com/netscape/cmscore/ldap/LdapPublishModule.java
@@ -17,7 +17,6 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.cmscore.ldap;
-
import java.io.IOException;
import java.math.BigInteger;
import java.security.cert.X509CRL;
@@ -56,7 +55,6 @@ import com.netscape.cmscore.dbs.CertRecord;
import com.netscape.cmscore.ldapconn.LdapBoundConnFactory;
import com.netscape.cmscore.util.Debug;
-
public class LdapPublishModule implements ILdapPublishModule {
protected IConfigStore mConfig = null;
protected LdapBoundConnFactory mLdapConnFactory = null;
@@ -64,28 +62,28 @@ public class LdapPublishModule implements ILdapPublishModule {
private boolean mInited = false;
protected ICertAuthority mAuthority = null;
- /**
- * hashtable of cert types to cert mappers and publishers.
- * cert types are client, server, ca, subca, ra, crl, etc.
+ /**
+ * hashtable of cert types to cert mappers and publishers.
+ * cert types are client, server, ca, subca, ra, crl, etc.
* XXX the cert types need to be consistently used.
* for each, the mapper may be null, in which case the full subject
- * name is used to map the cert.
+ * name is used to map the cert.
* for crl, if the mapper is null the ca mapper is used. if that
- * is null, the full issuer name is used.
+ * is null, the full issuer name is used.
* XXX if we support crl issuing points the issuing point should be used
* to publish the crl.
- * When publishers are null, the certs are not published.
+ * When publishers are null, the certs are not published.
*/
- protected Hashtable mMappers = new Hashtable();
+ protected Hashtable mMappers = new Hashtable();
/**
- * handlers for request types (events)
+ * handlers for request types (events)
* values implement IRequestListener
*/
protected Hashtable mEventHandlers = new Hashtable();
/**
- * instantiate connection factory.
+ * instantiate connection factory.
*/
public static final String ATTR_LDAPPUBLISH_STATUS = "LdapPublishStatus";
public static final String PROP_LDAP = "ldap";
@@ -100,12 +98,10 @@ public class LdapPublishModule implements ILdapPublishModule {
public LdapPublishModule() {
}
- public void init(ISubsystem sub, IConfigStore config) throws EBaseException
- {
- }
+ public void init(ISubsystem sub, IConfigStore config) throws EBaseException {
+ }
- public void set(String name, String val)
- {
+ public void set(String name, String val) {
}
public LdapPublishModule(LdapBoundConnFactory factory) {
@@ -116,8 +112,8 @@ public class LdapPublishModule implements ILdapPublishModule {
protected IPublisherProcessor mPubProcessor;
public void init(ICertAuthority authority, IPublisherProcessor p,
- IConfigStore config)
- throws EBaseException {
+ IConfigStore config)
+ throws EBaseException {
if (mInited)
return;
@@ -133,9 +129,9 @@ public class LdapPublishModule implements ILdapPublishModule {
mAuthority.registerRequestListener(this);
}
- public void init(ICertAuthority authority, IConfigStore config)
- throws EBaseException {
- if (mInited)
+ public void init(ICertAuthority authority, IConfigStore config)
+ throws EBaseException {
+ if (mInited)
return;
mAuthority = authority;
@@ -150,15 +146,15 @@ public class LdapPublishModule implements ILdapPublishModule {
}
/**
- * Returns the internal ldap connection factory.
- * This can be useful to get a ldap connection to the
- * ldap publishing directory without having to get it again from the
- * config file. Note that this means sharing a ldap connection pool
+ * Returns the internal ldap connection factory.
+ * This can be useful to get a ldap connection to the
+ * ldap publishing directory without having to get it again from the
+ * config file. Note that this means sharing a ldap connection pool
* with the ldap publishing module so be sure to return connections to pool.
- * Use ILdapConnFactory.getConn() to get a Ldap connection to the ldap
- * publishing directory.
- * Use ILdapConnFactory.returnConn() to return the connection.
- *
+ * Use ILdapConnFactory.getConn() to get a Ldap connection to the ldap
+ * publishing directory.
+ * Use ILdapConnFactory.returnConn() to return the connection.
+ *
* @see com.netscape.certsrv.ldap.ILdapBoundConnFactory
* @see com.netscape.certsrv.ldap.ILdapConnFactory
*/
@@ -167,7 +163,7 @@ public class LdapPublishModule implements ILdapPublishModule {
}
/**
- * Returns the connection factory to the publishing directory.
+ * Returns the connection factory to the publishing directory.
* Must return the connection once you return
*/
@@ -179,16 +175,16 @@ public class LdapPublishModule implements ILdapPublishModule {
} else {
mappers = (LdapMappers) mMappers.get(certType);
}
- return mappers;
+ return mappers;
}
protected void initMappers(IConfigStore config)
- throws EBaseException {
+ throws EBaseException {
IConfigStore types = mConfig.getSubStore(PROP_TYPE);
if (types == null || types.size() <= 0) {
// nothing configured.
- if (Debug.ON)
+ if (Debug.ON)
System.out.println("No ldap publishing configurations.");
return;
}
@@ -198,9 +194,9 @@ public class LdapPublishModule implements ILdapPublishModule {
String certType = (String) substores.nextElement();
IConfigStore current = types.getSubStore(certType);
- if (current == null || current.size() <= 0) {
+ if (current == null || current.size() <= 0) {
CMS.debug(
- "No ldap publish configuration for " + certType + " found.");
+ "No ldap publish configuration for " + certType + " found.");
continue;
}
ILdapPlugin mapper = null, publisher = null;
@@ -212,53 +208,53 @@ public class LdapPublishModule implements ILdapPublishModule {
mapperClassName = mapperConf.getString(PROP_CLASS, null);
if (mapperClassName != null && mapperClassName.length() > 0) {
CMS.debug(
- "mapper " + mapperClassName + " for " + certType);
+ "mapper " + mapperClassName + " for " + certType);
mapper = (ILdapPlugin)
Class.forName(mapperClassName).newInstance();
mapper.init(mapperConf);
}
publisherConf = current.getSubStore(PROP_PUBLISHER);
publisherClassName = publisherConf.getString(PROP_CLASS, null);
- if (publisherClassName != null &&
- publisherClassName.length() > 0) {
+ if (publisherClassName != null &&
+ publisherClassName.length() > 0) {
CMS.debug(
- "publisher " + publisherClassName + " for " + certType);
+ "publisher " + publisherClassName + " for " + certType);
publisher = (ILdapPlugin)
Class.forName(publisherClassName).newInstance();
publisher.init(publisherConf);
}
mMappers.put(certType, new LdapMappers(mapper, publisher));
} catch (ClassNotFoundException e) {
- String missingClass = mapperClassName +
- ((publisherClassName == null) ? "" :
- (" or " + publisherClassName));
+ String missingClass = mapperClassName +
+ ((publisherClassName == null) ? "" :
+ (" or " + publisherClassName));
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_FIND_CLASS", missingClass));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_FIND_CLASS", missingClass));
throw new ELdapException(
- CMS.getUserMessage("CMS_LDAP_CLASS_NOT_FOUND", missingClass));
+ CMS.getUserMessage("CMS_LDAP_CLASS_NOT_FOUND", missingClass));
} catch (InstantiationException e) {
- String badInstance = mapperClassName +
- ((publisherClassName == null) ? "" :
- (" or " + publisherClassName));
+ String badInstance = mapperClassName +
+ ((publisherClassName == null) ? "" :
+ (" or " + publisherClassName));
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_INST_CLASS",
- badInstance ,certType));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_INST_CLASS",
+ badInstance, certType));
throw new ELdapException(
- CMS.getUserMessage("CMS_LDAP_INSTANTIATING_CLASS_FAILED", badInstance));
+ CMS.getUserMessage("CMS_LDAP_INSTANTIATING_CLASS_FAILED", badInstance));
} catch (IllegalAccessException e) {
- String badInstance = mapperClassName +
- ((publisherClassName == null) ? "" :
- (" or " + publisherClassName));
+ String badInstance = mapperClassName +
+ ((publisherClassName == null) ? "" :
+ (" or " + publisherClassName));
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_INSUFFICIENT_CREDENTIALS", badInstance, certType));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_INSUFFICIENT_CREDENTIALS", badInstance, certType));
throw new ELdapException(
- CMS.getUserMessage("CMS_LDAP_INSUFFICIENT_CREDENTIALS", certType));
+ CMS.getUserMessage("CMS_LDAP_INSUFFICIENT_CREDENTIALS", certType));
} catch (EBaseException e) {
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_INIT_ERROR", certType, e.toString()));
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_INIT_ERROR", certType, e.toString()));
throw e;
}
}
@@ -266,14 +262,14 @@ public class LdapPublishModule implements ILdapPublishModule {
}
protected void initHandlers() {
- mEventHandlers.put(IRequest.ENROLLMENT_REQUEST,
- new HandleEnrollment(this));
+ mEventHandlers.put(IRequest.ENROLLMENT_REQUEST,
+ new HandleEnrollment(this));
mEventHandlers.put(IRequest.RENEWAL_REQUEST,
- new HandleRenewal(this));
- mEventHandlers.put(IRequest.REVOCATION_REQUEST,
- new HandleRevocation(this));
- mEventHandlers.put(IRequest.UNREVOCATION_REQUEST,
- new HandleUnrevocation(this));
+ new HandleRenewal(this));
+ mEventHandlers.put(IRequest.REVOCATION_REQUEST,
+ new HandleRevocation(this));
+ mEventHandlers.put(IRequest.UNREVOCATION_REQUEST,
+ new HandleUnrevocation(this));
}
public void accept(IRequest r) {
@@ -284,14 +280,14 @@ public class LdapPublishModule implements ILdapPublishModule {
if (handler == null) {
CMS.debug(
- "Nothing to publish for request type " + type);
+ "Nothing to publish for request type " + type);
return;
}
handler.accept(r);
}
public void publish(String certType, X509Certificate cert)
- throws ELdapException {
+ throws ELdapException {
// get mapper and publisher for cert type.
LdapMappers mappers = getMappers(certType);
@@ -299,15 +295,15 @@ public class LdapPublishModule implements ILdapPublishModule {
CMS.debug("publisher for " + certType + " is null");
return;
}
- publish((ILdapMapper) mappers.mapper,
- (ILdapPublisher) mappers.publisher, cert);
+ publish((ILdapMapper) mappers.mapper,
+ (ILdapPublisher) mappers.publisher, cert);
// set the ldap published flag.
setPublishedFlag(cert.getSerialNumber(), true);
}
public void unpublish(String certType, X509Certificate cert)
- throws ELdapException {
+ throws ELdapException {
// get mapper and publisher for cert type.
LdapMappers mappers = getMappers(certType);
@@ -315,19 +311,19 @@ public class LdapPublishModule implements ILdapPublishModule {
CMS.debug("publisher for " + certType + " is null");
return;
}
- unpublish((ILdapMapper) mappers.mapper,
- (ILdapPublisher) mappers.publisher, cert);
+ unpublish((ILdapMapper) mappers.mapper,
+ (ILdapPublisher) mappers.publisher, cert);
// set the ldap published flag.
setPublishedFlag(cert.getSerialNumber(), false);
}
/**
- * set published flag - true when published, false when unpublished.
- * not exist means not published.
+ * set published flag - true when published, false when unpublished.
+ * not exist means not published.
*/
public void setPublishedFlag(BigInteger serialNo, boolean published) {
- if (!(mAuthority instanceof ICertificateAuthority))
+ if (!(mAuthority instanceof ICertificateAuthority))
return;
ICertificateAuthority ca = (ICertificateAuthority) mAuthority;
@@ -340,18 +336,18 @@ public class LdapPublishModule implements ILdapPublishModule {
metaInfo = new MetaInfo();
}
metaInfo.set(
- CertRecord.META_LDAPPUBLISH, String.valueOf(published));
+ CertRecord.META_LDAPPUBLISH, String.valueOf(published));
ModificationSet modSet = new ModificationSet();
- modSet.add(ICertRecord.ATTR_META_INFO,
- Modification.MOD_REPLACE, metaInfo);
+ modSet.add(ICertRecord.ATTR_META_INFO,
+ Modification.MOD_REPLACE, metaInfo);
certdb.modifyCertificateRecord(serialNo, modSet);
} catch (EBaseException e) {
// not fatal. just log warning.
- log(ILogger.LL_WARN,
- "Cannot mark cert 0x" + serialNo.toString(16) + " published as " + published +
- " in the ldap directory. Cert Record not found. Error: " +
- e.getMessage());
+ log(ILogger.LL_WARN,
+ "Cannot mark cert 0x" + serialNo.toString(16) + " published as " + published +
+ " in the ldap directory. Cert Record not found. Error: " +
+ e.getMessage());
}
}
@@ -364,8 +360,8 @@ public class LdapPublishModule implements ILdapPublishModule {
}
public void publish(ILdapMapper mapper, ILdapPublisher publisher,
- X509Certificate cert)
- throws ELdapException {
+ X509Certificate cert)
+ throws ELdapException {
LDAPConnection conn = null;
try {
@@ -376,17 +372,17 @@ public class LdapPublishModule implements ILdapPublishModule {
if (mapper == null) { // use the cert's subject name exactly
dirdn = cert.getSubjectDN().toString();
CMS.debug(
- "no mapper found. Using subject name exactly." +
- cert.getSubjectDN());
+ "no mapper found. Using subject name exactly." +
+ cert.getSubjectDN());
} else {
result = mapper.map(conn, cert);
dirdn = result;
- if (dirdn == null) {
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_PUBLISH_NOT_MATCH",
- cert.getSerialNumber().toString(16),
- cert.getSubjectDN().toString()));
- throw new ELdapException(CMS.getUserMessage("CMS_LDAP_NO_MATCH",
+ if (dirdn == null) {
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_PUBLISH_NOT_MATCH",
+ cert.getSerialNumber().toString(16),
+ cert.getSubjectDN().toString()));
+ throw new ELdapException(CMS.getUserMessage("CMS_LDAP_NO_MATCH",
cert.getSubjectDN().toString()));
}
}
@@ -399,8 +395,8 @@ public class LdapPublishModule implements ILdapPublishModule {
}
public void unpublish(ILdapMapper mapper, ILdapPublisher publisher,
- X509Certificate cert)
- throws ELdapException {
+ X509Certificate cert)
+ throws ELdapException {
LDAPConnection conn = null;
try {
@@ -413,12 +409,12 @@ public class LdapPublishModule implements ILdapPublishModule {
} else {
result = mapper.map(conn, cert);
dirdn = result;
- if (dirdn == null) {
- log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_PUBLISH_NOT_MATCH",
- cert.getSerialNumber().toString(16),
- cert.getSubjectDN().toString()));
- throw new ELdapException(CMS.getUserMessage("CMS_LDAP_NO_MATCH",
+ if (dirdn == null) {
+ log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_PUBLISH_NOT_MATCH",
+ cert.getSerialNumber().toString(16),
+ cert.getSubjectDN().toString()));
+ throw new ELdapException(CMS.getUserMessage("CMS_LDAP_NO_MATCH",
cert.getSubjectDN().toString()));
}
}
@@ -434,8 +430,8 @@ public class LdapPublishModule implements ILdapPublishModule {
* publishes a crl by mapping the issuer name in the crl to an entry
* and publishing it there. entry must be a certificate authority.
*/
- public void publish(X509CRLImpl crl)
- throws ELdapException {
+ public void publish(X509CRLImpl crl)
+ throws ELdapException {
ILdapCrlMapper mapper = null;
ILdapPublisher publisher = null;
@@ -458,9 +454,9 @@ public class LdapPublishModule implements ILdapPublishModule {
} else {
result = ((ILdapMapper) mappers.mapper).map(conn, crl);
dn = result;
- if (dn == null) {
+ if (dn == null) {
log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_LDAP_CRL_NOT_MATCH"));
- throw new ELdapException(CMS.getUserMessage("CMS_LDAP_NO_MATCH",
+ throw new ELdapException(CMS.getUserMessage("CMS_LDAP_NO_MATCH",
crl.getIssuerDN().toString()));
}
}
@@ -468,7 +464,7 @@ public class LdapPublishModule implements ILdapPublishModule {
} catch (ELdapException e) {
//e.printStackTrace();
CMS.debug(
- "Error publishing CRL to " + dn + ": " + e);
+ "Error publishing CRL to " + dn + ": " + e);
throw e;
} catch (IOException e) {
CMS.debug("Error publishing CRL to " + dn + ": " + e);
@@ -484,8 +480,8 @@ public class LdapPublishModule implements ILdapPublishModule {
* publishes a crl by mapping the issuer name in the crl to an entry
* and publishing it there. entry must be a certificate authority.
*/
- public void publish(String dn, X509CRL crl)
- throws ELdapException {
+ public void publish(String dn, X509CRL crl)
+ throws ELdapException {
LdapMappers mappers = getMappers(PROP_TYPE_CRL);
if (mappers == null || mappers.publisher == null) {
@@ -500,7 +496,7 @@ public class LdapPublishModule implements ILdapPublishModule {
((ILdapPublisher) mappers.publisher).publish(conn, dn, crl);
} catch (ELdapException e) {
CMS.debug(
- "Error publishing CRL to " + dn + ": " + e.toString());
+ "Error publishing CRL to " + dn + ": " + e.toString());
throw e;
} finally {
if (conn != null) {
@@ -510,23 +506,22 @@ public class LdapPublishModule implements ILdapPublishModule {
}
public void log(int level, String msg) {
- mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_LDAP, level,
- "LdapPublishModule: " + msg);
+ mLogger.log(ILogger.EV_SYSTEM, null, ILogger.S_LDAP, level,
+ "LdapPublishModule: " + msg);
}
-
-}
+}
class LdapMappers {
public LdapMappers(ILdapPlugin aMapper, ILdapPlugin aPublisher) {
mapper = aMapper;
publisher = aPublisher;
}
+
public ILdapPlugin mapper = null;
public ILdapPlugin publisher = null;
}
-
class HandleEnrollment implements IRequestListener {
LdapPublishModule mModule = null;
@@ -534,49 +529,47 @@ class HandleEnrollment implements IRequestListener {
mModule = module;
}
- public void set(String name, String val)
- {
+ public void set(String name, String val) {
}
- public void init(ISubsystem sub, IConfigStore config) throws EBaseException
- {
+ public void init(ISubsystem sub, IConfigStore config) throws EBaseException {
}
public void accept(IRequest r) {
CMS.debug(
- "handling publishing for enrollment request id " +
- r.getRequestId());
+ "handling publishing for enrollment request id " +
+ r.getRequestId());
// in case it's not meant for us
if (r.getExtDataInInteger(IRequest.RESULT) == null)
return;
- // check if request failed.
+ // check if request failed.
if ((r.getExtDataInInteger(IRequest.RESULT)).equals(IRequest.RES_ERROR)) {
CMS.debug("Request errored. " +
- "Nothing to publish for enrollment request id " +
- r.getRequestId());
+ "Nothing to publish for enrollment request id " +
+ r.getRequestId());
return;
}
CMS.debug("Checking publishing for request " +
- r.getRequestId());
+ r.getRequestId());
// check if issued certs is set.
X509CertImpl[] certs = r.getExtDataInCertArray(IRequest.ISSUED_CERTS);
if (certs == null || certs.length == 0 || certs[0] == null) {
CMS.debug(
- "No certs to publish for request id " + r.getRequestId());
+ "No certs to publish for request id " + r.getRequestId());
return;
}
// get mapper and publisher for client certs.
- LdapMappers mappers =
- mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
+ LdapMappers mappers =
+ mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
if (mappers == null || mappers.publisher == null) {
CMS.debug(
- "In publishing: No publisher for type " +
- LdapPublishModule.PROP_TYPE_CLIENT);
+ "In publishing: No publisher for type " +
+ LdapPublishModule.PROP_TYPE_CLIENT);
return;
}
@@ -586,18 +579,18 @@ class HandleEnrollment implements IRequestListener {
for (int i = 0; i < certs.length; i++) {
try {
- if (certs[i] == null)
+ if (certs[i] == null)
continue;
- mModule.publish((ILdapMapper) mappers.mapper,
- (ILdapPublisher) mappers.publisher, certs[i]);
+ mModule.publish((ILdapMapper) mappers.mapper,
+ (ILdapPublisher) mappers.publisher, certs[i]);
results[i] = IRequest.RES_SUCCESS;
CMS.debug(
- "Published cert serial no 0x" + certs[i].getSerialNumber().toString(16));
+ "Published cert serial no 0x" + certs[i].getSerialNumber().toString(16));
mModule.setPublishedFlag(certs[i].getSerialNumber(), true);
} catch (ELdapException e) {
- mModule.log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_PUBLISH",
- certs[i].getSerialNumber().toString(16),e.toString()));
+ mModule.log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_PUBLISH",
+ certs[i].getSerialNumber().toString(16), e.toString()));
results[i] = IRequest.RES_ERROR;
}
r.setExtData("ldapPublishStatus", results);
@@ -605,19 +598,17 @@ class HandleEnrollment implements IRequestListener {
}
}
-
class HandleRenewal implements IRequestListener {
private LdapPublishModule mModule = null;
+
public HandleRenewal(LdapPublishModule module) {
mModule = module;
}
- public void init(ISubsystem sub, IConfigStore config) throws EBaseException
- {
- }
+ public void init(ISubsystem sub, IConfigStore config) throws EBaseException {
+ }
- public void set(String name, String val)
- {
+ public void set(String name, String val) {
}
public void accept(IRequest r) {
@@ -626,19 +617,19 @@ class HandleRenewal implements IRequestListener {
if (certs == null || certs.length == 0) {
CMS.debug("no certs to publish for renewal " +
- "request " + r.getRequestId());
+ "request " + r.getRequestId());
return;
}
Integer results[] = new Integer[certs.length];
X509CertImpl cert = null;
// get mapper and publisher for cert type.
- LdapMappers mappers =
- mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
+ LdapMappers mappers =
+ mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
if (mappers == null || mappers.publisher == null) {
CMS.debug(
- "publisher for " + LdapPublishModule.PROP_TYPE_CLIENT + " is null");
+ "publisher for " + LdapPublishModule.PROP_TYPE_CLIENT + " is null");
return;
}
@@ -646,46 +637,44 @@ class HandleRenewal implements IRequestListener {
for (int i = 0; i < certs.length; i++) {
cert = (X509CertImpl) certs[i];
- if (cert == null)
+ if (cert == null)
continue; // there was an error issuing this cert.
try {
- mModule.publish((ILdapMapper) mappers.mapper,
- (ILdapPublisher) mappers.publisher, cert);
+ mModule.publish((ILdapMapper) mappers.mapper,
+ (ILdapPublisher) mappers.publisher, cert);
results[i] = IRequest.RES_SUCCESS;
- mModule.log(ILogger.LL_INFO,
- "Published cert serial no 0x" + cert.getSerialNumber().toString(16));
+ mModule.log(ILogger.LL_INFO,
+ "Published cert serial no 0x" + cert.getSerialNumber().toString(16));
} catch (ELdapException e) {
error = true;
- mModule.log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_PUBLISH",
- cert.getSerialNumber().toString(16), e.getMessage()));
+ mModule.log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_PUBLISH",
+ cert.getSerialNumber().toString(16), e.getMessage()));
results[i] = IRequest.RES_ERROR;
}
}
r.setExtData("ldapPublishStatus", results);
r.setExtData("ldapPublishOverAllStatus",
- (error == true ? IRequest.RES_ERROR : IRequest.RES_SUCCESS));
+ (error == true ? IRequest.RES_ERROR : IRequest.RES_SUCCESS));
}
}
-
class HandleRevocation implements IRequestListener {
private LdapPublishModule mModule = null;
+
public HandleRevocation(LdapPublishModule module) {
mModule = module;
}
- public void init(ISubsystem sub, IConfigStore config) throws EBaseException
- {
- }
+ public void init(ISubsystem sub, IConfigStore config) throws EBaseException {
+ }
- public void set(String name, String val)
- {
+ public void set(String name, String val) {
}
public void accept(IRequest r) {
CMS.debug(
- "Handle publishing for revoke request id " + r.getRequestId());
+ "Handle publishing for revoke request id " + r.getRequestId());
// get fields in request.
X509CertImpl[] revcerts = r.getExtDataInCertArray(IRequest.OLD_CERTS);
@@ -693,18 +682,18 @@ class HandleRevocation implements IRequestListener {
if (revcerts == null || revcerts.length == 0 || revcerts[0] == null) {
// no certs in revoke.
CMS.debug(
- "Nothing to unpublish for revocation " +
- "request " + r.getRequestId());
+ "Nothing to unpublish for revocation " +
+ "request " + r.getRequestId());
return;
}
// get mapper and publisher for cert type.
- LdapMappers mappers =
- mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
+ LdapMappers mappers =
+ mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
if (mappers == null || mappers.publisher == null) {
CMS.debug(
- "publisher for " + LdapPublishModule.PROP_TYPE_CLIENT + " is null");
+ "publisher for " + LdapPublishModule.PROP_TYPE_CLIENT + " is null");
return;
}
@@ -716,41 +705,40 @@ class HandleRevocation implements IRequestListener {
results[i] = IRequest.RES_ERROR;
try {
- mModule.unpublish((ILdapMapper) mappers.mapper,
- (ILdapPublisher) mappers.publisher, cert);
+ mModule.unpublish((ILdapMapper) mappers.mapper,
+ (ILdapPublisher) mappers.publisher, cert);
results[i] = IRequest.RES_SUCCESS;
CMS.debug(
- "Unpublished cert serial no 0x" + cert.getSerialNumber().toString(16));
+ "Unpublished cert serial no 0x" + cert.getSerialNumber().toString(16));
} catch (ELdapException e) {
error = true;
- mModule.log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_UNPUBLISH",
- cert.getSerialNumber().toString(16), e.getMessage()));
+ mModule.log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_UNPUBLISH",
+ cert.getSerialNumber().toString(16), e.getMessage()));
}
}
r.setExtData("ldapPublishStatus", results);
r.setExtData("ldapPublishOverAllStatus",
- (error == true ? IRequest.RES_ERROR : IRequest.RES_SUCCESS));
+ (error == true ? IRequest.RES_ERROR : IRequest.RES_SUCCESS));
}
}
-
class HandleUnrevocation implements IRequestListener {
private LdapPublishModule mModule = null;
+
public HandleUnrevocation(LdapPublishModule module) {
mModule = module;
}
- public void set(String name, String val)
- {
+ public void set(String name, String val) {
+ }
+
+ public void init(ISubsystem sub, IConfigStore config) throws EBaseException {
}
- public void init(ISubsystem sub, IConfigStore config) throws EBaseException
- {
- }
public void accept(IRequest r) {
CMS.debug(
- "Handle publishing for unrevoke request id " + r.getRequestId());
+ "Handle publishing for unrevoke request id " + r.getRequestId());
// get fields in request.
X509CertImpl[] certs = r.getExtDataInCertArray(IRequest.OLD_CERTS);
@@ -758,18 +746,18 @@ class HandleUnrevocation implements IRequestListener {
if (certs == null || certs.length == 0 || certs[0] == null) {
// no certs in unrevoke.
CMS.debug(
- "Nothing to publish for unrevocation " +
- "request " + r.getRequestId());
+ "Nothing to publish for unrevocation " +
+ "request " + r.getRequestId());
return;
}
// get mapper and publisher for cert type.
- LdapMappers mappers =
- mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
+ LdapMappers mappers =
+ mModule.getMappers(LdapPublishModule.PROP_TYPE_CLIENT);
if (mappers == null || mappers.publisher == null) {
CMS.debug(
- "publisher for " + LdapPublishModule.PROP_TYPE_CLIENT + " is null");
+ "publisher for " + LdapPublishModule.PROP_TYPE_CLIENT + " is null");
return;
}
@@ -779,22 +767,21 @@ class HandleUnrevocation implements IRequestListener {
for (int i = 0; i < certs.length; i++) {
results[i] = IRequest.RES_ERROR;
try {
- mModule.publish((ILdapMapper) mappers.mapper,
- (ILdapPublisher) mappers.publisher, certs[i]);
+ mModule.publish((ILdapMapper) mappers.mapper,
+ (ILdapPublisher) mappers.publisher, certs[i]);
results[i] = IRequest.RES_SUCCESS;
CMS.debug(
- "Unpublished cert serial no 0x" + certs[i].getSerialNumber().toString(16));
+ "Unpublished cert serial no 0x" + certs[i].getSerialNumber().toString(16));
} catch (ELdapException e) {
error = true;
- mModule.log(ILogger.LL_FAILURE,
- CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_UNPUBLISH",
- certs[i].getSerialNumber().toString(16), e.getMessage()));
+ mModule.log(ILogger.LL_FAILURE,
+ CMS.getLogMessage("CMSCORE_LDAP_CERT_NOT_UNPUBLISH",
+ certs[i].getSerialNumber().toString(16), e.getMessage()));
}
}
r.setExtData("ldapPublishStatus", results);
r.setExtData("ldapPublishOverAllStatus",
- (error == true ? IRequest.RES_ERROR : IRequest.RES_SUCCESS));
+ (error == true ? IRequest.RES_ERROR : IRequest.RES_SUCCESS));
}
}
-