From f5035cc2bbb2ff59db462ec0230c8c3dfcd01bf5 Mon Sep 17 00:00:00 2001
From: Roland Gruber <post@rolandgruber.de>
Date: Sun, 22 May 2005 09:05:33 +0000
Subject: [PATCH] set DN suffix and RDN on profile loading

---
 lam/lib/modules.inc | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index 01226b07..b668bccd 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -728,9 +728,6 @@ class accountContainer {
 	/** RDN attribute of this account */
 	var $rdn;
 	
-	/** RDN attribute of this account when it was loaded */
-	var $rdn_orig;
-
 	/** original LDAP attributes when account was loaded from LDAP */
 	var $attributes_orig;
 	
@@ -777,6 +774,12 @@ class accountContainer {
 						// pass profile to each module
 						$modules = array_keys($this->module);
 						foreach ($modules as $module) $this->module[$module]->load_profile($profile);
+						if (isset($profile['ldap_rdn'][0])) {
+							$this->rdn = $profile['ldap_rdn'][0];
+						}
+						if (isset($profile['ldap_suffix'][0])) {
+							$this->dn = $profile['ldap_suffix'][0];
+						}
 						$result = 0;
 						}
 					// save account
@@ -1333,7 +1336,6 @@ class accountContainer {
 		// extract RDN
 		$this->rdn = split("=", substr($dn, 0, strpos($dn, ',')));
 		$this->rdn = $this->rdn[0];
-		$this->rdn_orig = $this->rdn;
 		$attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
 		$attrNames = array_keys($attr);
 		// remove 'count' entries and numerical entries
@@ -1412,6 +1414,12 @@ class accountContainer {
 		// pass profile to each module
 		$modules = array_keys($this->module);
 		foreach ($modules as $module) $this->module[$module]->load_profile($profile);
+		if (isset($profile['ldap_rdn'][0])) {
+			$this->rdn = $profile['ldap_rdn'][0];
+		}
+		if (isset($profile['ldap_suffix'][0])) {
+			$this->dn = $profile['ldap_suffix'][0];
+		}
 		return 0;
 		}