summaryrefslogtreecommitdiffstats
path: root/base/server/cmscore/src/com/netscape/cmscore
diff options
context:
space:
mode:
authorFraser Tweedale <frase@frase.id.au>2015-04-13 01:19:58 -0400
committerFraser Tweedale <ftweedal@redhat.com>2015-05-08 10:53:13 +1000
commit398aa8aca0505ce3d310c621661907693fd76e6d (patch)
tree46ee9c17e8a4204dcee340654005d5c9e510826a /base/server/cmscore/src/com/netscape/cmscore
parent00d7baffb31bdabc92c954b16050236a5ca29715 (diff)
downloadpki-398aa8aca0505ce3d310c621661907693fd76e6d.tar.gz
pki-398aa8aca0505ce3d310c621661907693fd76e6d.tar.xz
pki-398aa8aca0505ce3d310c621661907693fd76e6d.zip
Get profile ID from DN instead of CN attribute
Diffstat (limited to 'base/server/cmscore/src/com/netscape/cmscore')
-rw-r--r--base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java b/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java
index a7974430f..199a5576e 100644
--- a/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java
+++ b/base/server/cmscore/src/com/netscape/cmscore/profile/LDAPProfileSubsystem.java
@@ -29,6 +29,7 @@ import java.util.Vector;
import netscape.ldap.LDAPAttribute;
import netscape.ldap.LDAPConnection;
import netscape.ldap.LDAPControl;
+import netscape.ldap.LDAPDN;
import netscape.ldap.LDAPEntry;
import netscape.ldap.LDAPException;
import netscape.ldap.LDAPSearchConstraints;
@@ -107,8 +108,13 @@ public class LDAPProfileSubsystem
IPluginRegistry registry = (IPluginRegistry)
CMS.getSubsystem(CMS.SUBSYSTEM_REGISTRY);
- String profileId = (String)
- ldapProfile.getAttribute("cn").getStringValues().nextElement();
+ String profileId = null;
+ String dn = ldapProfile.getDN();
+ if (!dn.startsWith("cn=")) {
+ CMS.debug("Error reading profile entry: DN " + dn + " does not start with 'cn='");
+ return;
+ }
+ profileId = LDAPDN.explodeDN(dn, true)[0];
String classId = (String)
ldapProfile.getAttribute("classId").getStringValues().nextElement();
@@ -219,13 +225,14 @@ public class LDAPProfileSubsystem
}
private void forgetProfile(LDAPEntry entry) {
- String profileId = (String)
- entry.getAttribute("cn").getStringValues().nextElement();
- if (profileId == null) {
- CMS.debug("forgetProfile: error retrieving cn (profileId) from LDAPEntry");
- } else {
- forgetProfile(profileId);
+ String profileId = null;
+ String dn = entry.getDN();
+ if (!dn.startsWith("cn=")) {
+ CMS.debug("forgetProfile: DN " + dn + " does not start with 'cn='");
+ return;
}
+ profileId = LDAPDN.explodeDN(dn, true)[0];
+ forgetProfile(profileId);
}
/**