fixed lamdaemon error handling
This commit is contained in:
parent
641af2270d
commit
ec79d170b0
|
@ -813,6 +813,7 @@ class accountContainer {
|
||||||
* It prints the HTML code of each account page.
|
* It prints the HTML code of each account page.
|
||||||
*/
|
*/
|
||||||
function continue_main() {
|
function continue_main() {
|
||||||
|
$result = array();
|
||||||
if ($this->subpage=='') $this->subpage='attributes';
|
if ($this->subpage=='') $this->subpage='attributes';
|
||||||
if (isset($_POST['form_main_reset'])) {
|
if (isset($_POST['form_main_reset'])) {
|
||||||
$this->load_account($this->dn_orig);
|
$this->load_account($this->dn_orig);
|
||||||
|
@ -820,7 +821,6 @@ class accountContainer {
|
||||||
else {
|
else {
|
||||||
if ($this->current_page==0) {
|
if ($this->current_page==0) {
|
||||||
if ($this->subpage=='attributes') {
|
if ($this->subpage=='attributes') {
|
||||||
$result = 0;
|
|
||||||
// change dn
|
// change dn
|
||||||
if (isset($_POST['suffix']) && ($_POST['suffix'] != '')) $this->dn = $_POST['suffix'];
|
if (isset($_POST['suffix']) && ($_POST['suffix'] != '')) $this->dn = $_POST['suffix'];
|
||||||
// change RDN
|
// change RDN
|
||||||
|
@ -840,13 +840,12 @@ class accountContainer {
|
||||||
if (isset($profile['ldap_suffix'][0])) {
|
if (isset($profile['ldap_suffix'][0])) {
|
||||||
$this->dn = $profile['ldap_suffix'][0];
|
$this->dn = $profile['ldap_suffix'][0];
|
||||||
}
|
}
|
||||||
$result = 0;
|
|
||||||
}
|
}
|
||||||
// save account
|
// save account
|
||||||
if (isset($_POST['create'])) {
|
if (isset($_POST['create'])) {
|
||||||
$errors = $this->save_account();
|
$errors = $this->save_account();
|
||||||
if (is_array($errors)) {
|
if (sizeof($errors) > 0) {
|
||||||
$result = array($errors);
|
$result = $errors;
|
||||||
$stopProcessing = true;
|
$stopProcessing = true;
|
||||||
}
|
}
|
||||||
else $this->subpage = 'finish';
|
else $this->subpage = 'finish';
|
||||||
|
@ -1322,6 +1321,7 @@ class accountContainer {
|
||||||
* @return array list of status messages if any errors occured
|
* @return array list of status messages if any errors occured
|
||||||
*/
|
*/
|
||||||
function save_account() {
|
function save_account() {
|
||||||
|
$errors = array();
|
||||||
$ldapUser = $_SESSION['ldap']->decrypt_login();
|
$ldapUser = $_SESSION['ldap']->decrypt_login();
|
||||||
$ldapUser = $ldapUser[0];
|
$ldapUser = $ldapUser[0];
|
||||||
$module = array_keys ($this->module);
|
$module = array_keys ($this->module);
|
||||||
|
@ -1439,12 +1439,15 @@ class accountContainer {
|
||||||
// lamdaemon commands for the new account
|
// lamdaemon commands for the new account
|
||||||
if (!$stopprocessing) {
|
if (!$stopprocessing) {
|
||||||
$DN = $attributes[$this->dn];
|
$DN = $attributes[$this->dn];
|
||||||
if (is_array($DN['lamdaemon']['command'])) $result = lamdaemon($DN['lamdaemon']['command']);
|
if (is_array($DN['lamdaemon']['command'])) {
|
||||||
|
$result = lamdaemon($DN['lamdaemon']['command']);
|
||||||
// Error somewhere in lamdaemon
|
// Error somewhere in lamdaemon
|
||||||
if (is_array($result)) {
|
if (is_array($result)) {
|
||||||
foreach ($result as $singleresult) {
|
foreach ($result as $singleresult) {
|
||||||
|
$singleresult = explode(",", $singleresult);
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if ($singleresult[0] == 'ERROR') $stopprocessing = true;
|
if ($singleresult[0] == 'ERROR') {
|
||||||
|
$stopprocessing = true;
|
||||||
$temparray[0] = $singleresult[0];
|
$temparray[0] = $singleresult[0];
|
||||||
$temparray[1] = _($singleresult[1]);
|
$temparray[1] = _($singleresult[1]);
|
||||||
$temparray[2] = _($singleresult[2]);
|
$temparray[2] = _($singleresult[2]);
|
||||||
|
@ -1454,6 +1457,8 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
unset($attributes[$this->dn]);
|
unset($attributes[$this->dn]);
|
||||||
}
|
}
|
||||||
$DNs = array_keys($attributes);
|
$DNs = array_keys($attributes);
|
||||||
|
@ -1505,8 +1510,10 @@ class accountContainer {
|
||||||
// Error somewhere in lamdaemon
|
// Error somewhere in lamdaemon
|
||||||
if (isset($result) && is_array($result)) {
|
if (isset($result) && is_array($result)) {
|
||||||
foreach ($result as $singleresult) {
|
foreach ($result as $singleresult) {
|
||||||
|
$singleresult = explode(",", $singleresult);
|
||||||
if (is_array($singleresult)) {
|
if (is_array($singleresult)) {
|
||||||
if ($singleresult[0] == 'ERROR') $stopprocessing = true;
|
if ($singleresult[0] == 'ERROR') {
|
||||||
|
$stopprocessing = true;
|
||||||
$temparray[0] = $singleresult[0];
|
$temparray[0] = $singleresult[0];
|
||||||
$temparray[1] = _($singleresult[1]);
|
$temparray[1] = _($singleresult[1]);
|
||||||
$temparray[2] = _($singleresult[2]);
|
$temparray[2] = _($singleresult[2]);
|
||||||
|
@ -1517,9 +1524,9 @@ class accountContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$_SESSION['cache']->refresh_cache(true);
|
$_SESSION['cache']->refresh_cache(true);
|
||||||
if (count($errors)!=0) return $errors;
|
return $errors;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue