diff options
author | Ade Lee <alee@redhat.com> | 2016-04-15 14:36:00 -0400 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2016-04-15 15:06:13 -0400 |
commit | 0c5fb1e398510391187054a465c6460042bfc0b2 (patch) | |
tree | 4bd9e90039b0732d3f25f2760b59a7047a89baf9 /base/server | |
parent | 88e963d55bdf4cb9799ef665a72f8855fc00c4da (diff) | |
download | pki-0c5fb1e398510391187054a465c6460042bfc0b2.tar.gz pki-0c5fb1e398510391187054a465c6460042bfc0b2.tar.xz pki-0c5fb1e398510391187054a465c6460042bfc0b2.zip |
Add script to enable USN plugin
New authority monitor code requires the USN plugin to be
enabled in the database to ensure that the entryUSN attribute
is added to authority entries.
In the case where this plugin was disabled, accessing this
attribute resulted in a null pointer exception whch prevented server
startup.
The code has been changed so as not to throw a null pointer exception
on startup if the entryusn is not present, and also to call an LDIF
to enable the plugin when a subsystem is configured through pkispawn.
Diffstat (limited to 'base/server')
3 files changed, 22 insertions, 0 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java index e2b014f35..8c353f0c7 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java +++ b/base/server/cms/src/com/netscape/cms/servlet/csadmin/ConfigurationUtils.java @@ -1283,6 +1283,23 @@ public class ConfigurationUtils { } } + public static void enableUSNPlugin() throws IOException, EBaseException { + IConfigStore cs = CMS.getConfigStore(); + + IConfigStore dbCfg = cs.getSubStore("internaldb"); + ILdapConnFactory dbFactory = CMS.getLdapBoundConnFactory("ConfigurationUtils"); + dbFactory.init(dbCfg); + LDAPConnection conn = dbFactory.getConn(); + try { + importLDIFS("preop.internaldb.usn.ldif", conn); + } catch (Exception e) { + CMS.debug("Failed to enable USNPlugin: " + e); + throw new EBaseException("Failed to enable USN plugin: " + e, e); + } finally { + releaseConnection(conn); + } + } + public static void populateDB() throws IOException, EBaseException { IConfigStore cs = CMS.getConfigStore(); diff --git a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java index d3410bcb4..a96575d06 100644 --- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java +++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java @@ -753,6 +753,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou psStore.commit(false); if (!data.getStepTwo()) { + ConfigurationUtils.enableUSNPlugin(); ConfigurationUtils.populateDB(); cs.putString("preop.internaldb.replicationpwd", replicationPassword); diff --git a/base/server/share/conf/usn.ldif b/base/server/share/conf/usn.ldif new file mode 100644 index 000000000..b5a45e6bc --- /dev/null +++ b/base/server/share/conf/usn.ldif @@ -0,0 +1,4 @@ +dn: cn=USN,cn=plugins,cn=config +changetype: modify +replace: nsslapd-pluginEnabled +nsslapd-pluginEnabled: on |