From 2566d4ddfb533d81fe6203d8457b52e7423b418e Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Mon, 7 May 2012 11:55:37 -0400 Subject: BZ 819111 non-existent container breaks replication Added code to add the required ou=cmsusers container to cn=config on the master if it does not exist, when replication users are set up. --- .../cms/servlet/csadmin/DatabasePanel.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'base') diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java b/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java index 6c8cbbb19..4a78e4054 100644 --- a/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java +++ b/base/common/src/com/netscape/cms/servlet/csadmin/DatabasePanel.java @@ -1238,7 +1238,27 @@ public class DatabasePanel extends WizardPanelBase { throws LDAPException { LDAPAttributeSet attrs = null; LDAPEntry entry = null; - String dn = "cn=" + bindUser + ",ou=csusers,cn=config"; + + // for older subsystems, the container ou=csusers, cn=config may not yet exist + String dn = "ou=csusers, cn=config"; + try { + attrs = new LDAPAttributeSet(); + attrs.add(new LDAPAttribute("objectclass", "top")); + attrs.add(new LDAPAttribute("objectclass", "organizationalUnit")); + attrs.add(new LDAPAttribute("ou", "csusers")); + entry = new LDAPEntry(dn, attrs); + conn.add(entry); + } catch (LDAPException e) { + if (e.getLDAPResultCode() == LDAPException.ENTRY_ALREADY_EXISTS) { + CMS.debug("createReplicationManager: containing ou already exists"); + } else { + CMS.debug("createReplicationManager: Failed to create containing ou. Exception: " + + e.toString()); + throw e; + } + } + + dn = "cn=" + bindUser + ",ou=csusers,cn=config"; try { attrs = new LDAPAttributeSet(); attrs.add(new LDAPAttribute("objectclass", "top")); -- cgit