added clear text password to upload PDF files

This commit is contained in:
Roland Gruber 2012-02-05 13:04:57 +00:00
parent 4e33f7e5e3
commit 342cb63b7e
3 changed files with 18 additions and 4 deletions

View File

@ -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;

View File

@ -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('<block><key>' . _('Password') . '</key><value>' . $this->clearTextPassword . '</value></block>');
}
else if (isset($this->attributes['INFO.userPasswordClearText'])) {
$return['posixAccount_userPassword'] = array('<block><key>' . _('Password') . '</key><value>' . $this->attributes['INFO.userPasswordClearText'] . '</value></block>');
}
return $return;
}

View File

@ -180,11 +180,18 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
<?php
flush();
while (!isset($_SESSION['mass_pdf']['finished']) && (($startTime + $maxTime) > 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;