From: hickert Date: Wed, 14 Sep 2011 14:06:04 +0000 (+0000) Subject: Some backport from trunk X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fdbc31bfa436327a9f2d01bd4a758069e8bff709;p=gosa.git Some backport from trunk r20963 | hickert | 2011-07-27 10:37:04 +0200 (Wed, 27 Jul 2011) | 2 lines Fixed error message when the class.cache is missing r20967 | cajus | 2011-08-16 11:30:16 +0200 (Tue, 16 Aug 2011) | 2 lines Fixed license address r20973 | hickert | 2011-08-24 09:59:42 +0200 (Wed, 24 Aug 2011) | 3 lines Updated class password to only generate proposals when they are needed. r20975 | hickert | 2011-09-01 08:58:28 +0200 (Thu, 01 Sep 2011) | 2 lines Fixed samba hash generation - error handling. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.7@20980 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/COPYING b/gosa-core/COPYING index ba4e0c63b..d8cf7d463 100644 --- a/gosa-core/COPYING +++ b/gosa-core/COPYING @@ -1,8 +1,8 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -56,7 +56,6 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -112,7 +111,6 @@ above, provided that you also meet all of these conditions: does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -171,7 +169,6 @@ access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -229,7 +226,6 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 22670325a..d14308bcb 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -73,7 +73,7 @@ define('DES3_CBC_MD5',5); define('DES3_CBC_SHA1',16); /* Include required files */ -require_once("class_location.inc"); +include_once("class_location.inc"); require_once ("functions_debug.inc"); require_once ("accept-to-gettext.inc"); @@ -2890,9 +2890,14 @@ function change_password ($dn, $password, $mode=FALSE, $hash= "", $old_password $attrs= array(); if (!$mode && !empty($tmp)){ $attrs= generate_smb_nt_hash($password); - $shadow = (isset($attrs["shadowLastChange"][0]))?(int)(date("U") / 86400):0; - if ($shadow != 0){ - $attrs['shadowLastChange']= $shadow; + if(!count($attrs) || !is_array($attrs)){ + msg_dialog::display(tr("Error"),tr("Cannot generate SAMBA hash!"),ERROR_DIALOG); + return(FALSE); + }else{ + $shadow = (isset($attrs["shadowLastChange"][0]))?(int)(date("U") / 86400):0; + if ($shadow != 0){ + $attrs['shadowLastChange']= $shadow; + } } } @@ -3046,7 +3051,7 @@ function generate_smb_nt_hash($password) $hash = $rpc->mksmbhash($password); if(!$rpc->success()){ msg_dialog::display(_("Error"),msgPool::rpcError($rpc->get_error()),ERROR_DIALOG); - return(""); + return(array()); } }elseif ($config->get_cfg_value("core","gosaSupportURI") != ""){ @@ -3076,7 +3081,7 @@ function generate_smb_nt_hash($password) if ($hash == "") { msg_dialog::display(_("Configuration error"), sprintf(_("Generating SAMBA hash by running %s failed: check %s!"), bold($config->get_cfg_value("core",'sambaHashHook'), bold("sambaHashHook"))), ERROR_DIALOG); - return (""); + return(array()); } } @@ -3533,6 +3538,9 @@ function image($path, $action= "", $title= "", $align= "middle") $label= null; // Bail out, if there's no style file + if(!class_exists('session')){ + return ""; + } if(!session::global_is_set("img-styles")){ // Get theme diff --git a/gosa-core/include/php_setup.inc b/gosa-core/include/php_setup.inc index 258c467c9..8dd1005e1 100644 --- a/gosa-core/include/php_setup.inc +++ b/gosa-core/include/php_setup.inc @@ -96,18 +96,25 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline) "\n\n". "*** PHP error information ***\n\n"); } - - if (session::is_set('js') && session::get('js')==FALSE){ + + + if (class_exists('session') && session::is_set('js') && session::get('js')==FALSE){ $error_collector= "
"; } else { + + $warning_image = (is_callable('image')) ? + image('images/toolbar-warning.png') : ""; + $mailto_image = (is_callable('image')) ? + image('images/mailto.png') : ""; + $error_collector= " - +
".image('images/toolbar-warning.png')."{$warning_image} "._("Generating this page caused the PHP interpreter to raise some errors!")." - ".image('images/mailto.png')." "._("Send bug report")." + {$mailto_image} "._("Send bug report")." diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc index 8bdf26fd6..df056069a 100644 --- a/gosa-core/plugins/personal/password/class_password.inc +++ b/gosa-core/plugins/personal/password/class_password.inc @@ -29,19 +29,13 @@ class password extends plugin var $proposal = ""; var $proposalEnabled = FALSE; var $proposalSelected = FALSE; + var $proposalInitialized = FALSE; var $forcedHash = NULL; function password(&$config, $dn= NULL, $parent= NULL) { plugin::plugin($config, $dn, $parent); - - // Try to generate a password proposal, if this is successfull - // then preselect the proposal usage. - $this->refreshProposal(); - if($this->proposal != ""){ - $this->proposalSelected = TRUE; - } } @@ -64,6 +58,17 @@ class password extends plugin $smarty = get_smarty(); $ui = get_userinfo(); + + // Try to generate a password proposal, if this is successfull + // then preselect the proposal usage. + if(!$this->proposalInitialized){ + $this->refreshProposal(); + if($this->proposal != ""){ + $this->proposalSelected = TRUE; + } + $this->proposalInitialized = TRUE; + } + /* Get acls */ $password_ACLS = $ui->get_permissions($ui->dn,"users/password"); $smarty->assign("ChangeACL" , $password_ACLS);