fix some problem in Univention install

This commit is contained in:
Ralf Becker 2014-11-06 16:54:33 +00:00
parent a70600d964
commit afaf5a1ece
4 changed files with 29 additions and 7 deletions

View File

@ -0,0 +1,20 @@
<?php
/**
* Addressbook - Univention Backend
*
* @link http://www.egroupware.org
* @author Ralf Becker <rb@stylite.de>
* @package addressbook
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Univention backend for accounts
*
* There's currently no difference to LDAP backend
*/
class addressbook_univention extends addressbook_ldap
{
}

View File

@ -778,7 +778,7 @@ function set_univention_defaults()
if (!is_array($domains)) $domains = explode("\n", $domains); if (!is_array($domains)) $domains = explode("\n", $domains);
$domain = array_shift($domains); $domain = array_shift($domains);
$config['smtpserver'] = "$mailserver,465,,,yes,tls"; $config['smtpserver'] = "$mailserver,465,,,yes,tls";
$config['smtp'] = 'no,emailadmin_smtp_ldap_univention'; $config['smtp'] = ',emailadmin_smtp_ldap_univention';
$config['mailserver'] = "$mailserver,993,$domain,email,tls"; $config['mailserver'] = "$mailserver,993,$domain,email,tls";
$config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',emailadmin_imap_cyrus'; $config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',emailadmin_imap_cyrus';
$config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,INBOX/Spam'; $config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,INBOX/Spam';

View File

@ -37,11 +37,13 @@ class accounts_univention extends accounts_ldap
{ {
if (!$data['account_id'] && $data['account_type'] !== 'g' && self::available()) if (!$data['account_id'] && $data['account_type'] !== 'g' && self::available())
{ {
$config = $this->frontend->config && $this->frontend->config['ldap_context'] ?
$this->frontend->config : $GLOBALS['egw_info']['server'];
$params = array( $params = array(
'users/user','create', 'users/user','create',
'--binddn', $this->frontend->config['ldap_root_dn'], '--binddn', $config['ldap_root_dn'],
'--bindpwd', 5=>$this->frontend->config['ldap_root_pw'], '--bindpwd', 5=>$config['ldap_root_pw'],
'--position', $this->frontend->config['ldap_context'], '--position', $config['ldap_context'],
'--set', 'username='.$data['account_lid'], '--set', 'username='.$data['account_lid'],
'--set', 'firstname='.$data['account_firstname'], '--set', 'firstname='.$data['account_firstname'],
'--set', 'lastname='.$data['account_lastname'], '--set', 'lastname='.$data['account_lastname'],
@ -57,7 +59,7 @@ class accounts_univention extends accounts_ldap
$cmd = self::DIRECTORY_MANAGER_BIN.' '.implode(' ', array_map('escapeshellarg', $params)); $cmd = self::DIRECTORY_MANAGER_BIN.' '.implode(' ', array_map('escapeshellarg', $params));
$output_arr = $ret = $matches = null; $output_arr = $ret = $matches = null;
exec($cmd, $output_arr, $ret); exec($cmd, $output_arr, $ret);
$output = explode("\n", $output_arr); $output = implode("\n", $output_arr);
if ($ret || !preg_match('/^Object created: (uid=.*)$/mui', $output, $matches)) if ($ret || !preg_match('/^Object created: (uid=.*)$/mui', $output, $matches))
{ {
$params[5] = '********'; // mask out password! $params[5] = '********'; // mask out password!
@ -65,7 +67,7 @@ class accounts_univention extends accounts_ldap
throw new egw_exception_wrong_userinput($cmd."\nreturned\n".$output); throw new egw_exception_wrong_userinput($cmd."\nreturned\n".$output);
} }
$data['account_dn'] = $matches[1]; $data['account_dn'] = $matches[1];
$data['account_id'] = $this->name2id($matches[1], 'account_dn', 'u'); $data['account_id'] = $this->name2id($data['account_lid'], 'account_lid', 'u');
} }
return parent::save($data); return parent::save($data);
} }

View File

@ -969,7 +969,7 @@ class setup
function setup_account_object(array $config=array()) function setup_account_object(array $config=array())
{ {
if (!isset($this->accounts) || $config) if (!isset($this->accounts) || $this->accounts->config || $config)
{ {
if (!is_object($this->db)) if (!is_object($this->db))
{ {