From 6f6d9089d12e4dce250ab71e937c68707e01b4e3 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 16 Apr 2007 13:03:02 +0000
Subject: [PATCH] Add additional validation to the LDAP profile stylesheet: make sure that object classes, attribute types, and rdn sequences are present where required.

---
 opends/resource/admin/ldapMOProfile.xsl |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opends/resource/admin/ldapMOProfile.xsl b/opends/resource/admin/ldapMOProfile.xsl
index 7027ec1..3e8bcc4 100644
--- a/opends/resource/admin/ldapMOProfile.xsl
+++ b/opends/resource/admin/ldapMOProfile.xsl
@@ -36,12 +36,26 @@
     Document parsing.
   -->
   <xsl:template match="/">
+    <xsl:if
+      test="not($this/adm:profile[@name='ldap']/ldap:object-class/ldap:name) and not($this-is-root)">
+      <xsl:message terminate="yes">
+        <xsl:value-of
+          select="concat('No object class found for managed object definition ', $this-name)" />
+      </xsl:message>
+    </xsl:if>
     <xsl:value-of
       select="concat('objectclass=',
                      normalize-space($this/adm:profile[@name='ldap']/ldap:object-class/ldap:name),
                      '&#xa;')" />
     <xsl:for-each select="$this-all-properties">
       <xsl:sort select="@name" />
+      <xsl:if
+        test="not(adm:profile[@name='ldap']/ldap:attribute/ldap:name)">
+        <xsl:message terminate="yes">
+          <xsl:value-of
+            select="concat('No attribute type found for property ', @name, ' in managed object definition ', $this-name)" />
+        </xsl:message>
+      </xsl:if>
       <xsl:value-of
         select="concat('attribute.',
                        normalize-space(@name),
@@ -51,6 +65,12 @@
     </xsl:for-each>
     <xsl:for-each select="$this-all-relations">
       <xsl:sort select="@name" />
+      <xsl:if test="not(adm:profile[@name='ldap']/ldap:rdn-sequence)">
+        <xsl:message terminate="yes">
+          <xsl:value-of
+            select="concat('No RDN sequence found for relation ', @name, ' in managed object definition ', $this-name)" />
+        </xsl:message>
+      </xsl:if>
       <xsl:value-of
         select="concat('rdn.',
                        normalize-space(@name),

--
Gitblit v1.10.0