diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index eb581ac1..cd3df141 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -1400,9 +1400,11 @@ class accountContainer { * Loads an LDAP account with the given DN. * * @param string $dn the DN of the account + * @param array $infoAttributes list of additional informational attributes that are added to the LDAP attributes + * E.g. this is used to inject the clear text password in the file upload. Informational attribute names must start with "INFO.". * @return array error messages */ - function load_account($dn) { + function load_account($dn, $infoAttributes = array()) { logNewMessage(LOG_DEBUG, "Edit account " . $dn); $this->module = array(); $modules = $_SESSION['config']->get_AccountModules($this->type); @@ -1436,6 +1438,8 @@ class accountContainer { $attr[$binaryAttr[$i]] = $binData; } } + // add informational attributes + $attr = array_merge($attr, $infoAttributes); // save original attributes $this->attributes_orig = $attr; diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 931d7650..f44646e1 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -140,7 +140,7 @@ class posixAccount extends baseModule implements passwordService { $return['LDAPaliases'] = array('commonName' => 'cn', 'userid' => 'uid'); // managed attributes $return['attributes'] = array('cn', 'uid', 'uidNumber', 'gidNumber', 'homeDirectory', - 'userPassword', 'loginShell', 'gecos'); + 'userPassword', 'loginShell', 'gecos', 'INFO.userPasswordClearText'); if ($this->get_scope() == "user") { // self service search attributes $return['selfServiceSearchAttributes'] = array('uid'); @@ -1483,6 +1483,9 @@ class posixAccount extends baseModule implements passwordService { if (isset($this->clearTextPassword)) { $return['posixAccount_userPassword'] = array('' . _('Password') . '' . $this->clearTextPassword . ''); } + else if (isset($this->attributes['INFO.userPasswordClearText'])) { + $return['posixAccount_userPassword'] = array('' . _('Password') . '' . $this->attributes['INFO.userPasswordClearText'] . ''); + } return $return; } diff --git a/lam/templates/massDoUpload.php b/lam/templates/massDoUpload.php index faf434b3..04bc6c28 100644 --- a/lam/templates/massDoUpload.php +++ b/lam/templates/massDoUpload.php @@ -180,11 +180,18 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po time())) { - // load account $attrs = $accounts[$_SESSION['mass_pdf']['counter']]; $dn = $attrs['dn']; + // get informational attributes + $infoAttributes = array(); + foreach ($attrs as $key => $value) { + if (strpos($key, 'INFO.') === 0) { + $infoAttributes[$key] = $value; + } + } + // load account $_SESSION['pdfAccount'] = new accountContainer($_SESSION['mass_scope'], 'pdfAccount'); - $pdfErrors = $_SESSION['pdfAccount']->load_account($dn); + $pdfErrors = $_SESSION['pdfAccount']->load_account($dn, $infoAttributes); if (sizeof($pdfErrors) > 0) { $_SESSION['mass_errors'] = array_merge($_SESSION['mass_errors'], $pdfErrors); $_SESSION['mass_pdf']['finished'] = true;