From 2201198837519e1071a0407d37f8d0a0079e9215 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 28 Dec 2004 12:06:11 +0000 Subject: [PATCH] fixed schema parsing for single MUST/MAY attributes --- lam/lib/modules.inc | 48 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 166c8a3a..c208a736 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -1023,11 +1023,19 @@ class accountContainer { // Now we have a string with all must-attributes $string = substr($string_withtail, 0, strpos($string_withtail, ')')); $string = trim($string); - // Ad must + // Add must foreach (explode(" $ ", $string) as $attribute) { $return[$attribute] = array(''); - } } + } + elseif (strpos($_SESSION['ldap']->objectClasses[$line], 'MUST ')) { + $string_withtail = substr($_SESSION['ldap']->objectClasses[$line], strpos($_SESSION['ldap']->objectClasses[$line], 'MUST ')+5); + // Now we have a string with the must-attribute + $string = substr($string_withtail, 0, strpos($string_withtail, ' ')); + $string = trim($string); + // Add must + $return[$string] = array(''); + } // create array with may-attributes // Get startposition in string if (strpos($_SESSION['ldap']->objectClasses[$line], 'MAY (')) { @@ -1035,11 +1043,19 @@ class accountContainer { // Now we have a string with all must-attributes $string = substr($string_withtail, 0, strpos($string_withtail, ')')); $string = trim($string); - // Ad may + // Add may foreach (explode(" $ ", $string) as $attribute) { $return[$attribute] = array(''); - } } + } + elseif (strpos($_SESSION['ldap']->objectClasses[$line], 'MAY ')) { + $string_withtail = substr($_SESSION['ldap']->objectClasses[$line], strpos($_SESSION['ldap']->objectClasses[$line], 'MAY ')+4); + // Now we have a string with the may-attribute + $string = substr($string_withtail, 0, strpos($string_withtail, ' ')); + $string = trim($string); + // Add must + $return[$string] = array(''); + } // Get attributes of subclasses while (strpos($_SESSION['ldap']->objectClasses[$line], "SUP ")) { $string_withtail = substr($_SESSION['ldap']->objectClasses[$line], strpos($_SESSION['ldap']->objectClasses[$line], 'SUP ')+4); @@ -1057,11 +1073,19 @@ class accountContainer { // Now we have a string with all must-attributes $string = substr($string_withtail, 0, strpos($string_withtail, ')')); $string = trim($string); - // Ad must + // Add must foreach (explode(" $ ", $string) as $attribute) { $return[$attribute] = array(''); - } } + } + elseif (strpos($_SESSION['ldap']->objectClasses[$line], 'MUST ')) { + $string_withtail = substr($_SESSION['ldap']->objectClasses[$line], strpos($_SESSION['ldap']->objectClasses[$line], 'MUST ')+5); + // Now we have a string with the must-attribute + $string = substr($string_withtail, 0, strpos($string_withtail, ' ')); + $string = trim($string); + // Add must + $return[$string] = array(''); + } // create array with may-attributes // Get startposition in string if (strpos($_SESSION['ldap']->objectClasses[$line], 'MAY (')) { @@ -1069,12 +1093,20 @@ class accountContainer { // Now we have a string with all must-attributes $string = substr($string_withtail, 0, strpos($string_withtail, ')')); $string = trim($string); - // Ad may + // Add may foreach (explode(" $ ", $string) as $attribute) { $return[$attribute] = array(''); - } } } + elseif (strpos($_SESSION['ldap']->objectClasses[$line], 'MAY ')) { + $string_withtail = substr($_SESSION['ldap']->objectClasses[$line], strpos($_SESSION['ldap']->objectClasses[$line], 'MAY ')+4); + // Now we have a string with the may-attribute + $string = substr($string_withtail, 0, strpos($string_withtail, ' ')); + $string = trim($string); + // Add must + $return[$string] = array(''); + } + } // make references with attibutes which are used by more than one module $newattributes = array_keys($return);