summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5976dac)
raw | patch | inline | side by side (parent: 5976dac)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 16 Jun 2005 11:49:57 +0000 (11:49 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 16 Jun 2005 11:49:57 +0000 (11:49 +0000) |
diff --git a/Changelog b/Changelog
index 659be4f5dccf3d8f8b1aa0d42a439d4245569026..5791711528d7d7b4738268c71b2e4a73cd2b4f98 100644 (file)
--- a/Changelog
+++ b/Changelog
automatically if the revision changes
- Improved W3C compatibility
- Added checks that remove the contents of /var/spool/gosa/*
+ - Added postmodify for password change operations
* gosa 2.4beta1
- Override automatically detected user bases if they don't exist
index 52b862873f055ac079ad04b6119ab039eb50dbc4..cfa7b8aed8fdd830d42ab380c14e8bbac1d9dd91 100644 (file)
// change_password, changes the Password, of the given dn
function change_password ($dn, $password, $mode=0, $hash= "")
{
-
global $config;
$newpass= "";
$newpass = $test->generate_hash($password);
}
-
-
// Update shadow timestamp?
if (isset($attrs["shadowLastChange"][0])){
$shadow= (int)(date("U") / 86400);
}
// Create SMB Password
- $attrs = generate_smb_nt_hash($password);
+ $attrs= generate_smb_nt_hash($password);
}
$attrs['userPassword']= array();
$ldap->modify($attrs);
- if ($ldap->error != 'Success')
- {
+ if ($ldap->error != 'Success') {
print_red(sprintf(_("Setting the password failed. LDAP server says '%s'."),
$ldap->get_error()));
+ } else {
+
+ /* Find postmodify entries for this class */
+ $command= search_config($config->data['MENU'], "password", "POSTMODIFY");
+
+ if ($command != ""){
+ /* Walk through attribute list */
+ $command= preg_replace("/%userPassword/", $password, $command);
+ $command= preg_replace("/%dn/", $dn, $command);
+
+ if (check_command($command)){
+ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+ exec($command);
+ } else {
+ $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
+ print_red ($message);
+ }
+ }
}
}
index 2a50b4737782c01792e2158440346ecbfde2f531..e7c01c3aa12c827ffdf99a20c1e44280a7f813f6 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
function postcreate()
{
/* Find postcreate entries for this class */
- $command= $this->search($this->config->data['MENU'], get_class($this), "POSTCREATE");
+ $command= search_config($this->config->data['MENU'], get_class($this), "POSTCREATE");
if ($command == ""){
- $command= $this->search($this->config->data['SERVICE'], get_class($this), "POSTCREATE");
+ $command= search_config($this->config->data['SERVICE'], get_class($this), "POSTCREATE");
}
if ($command != ""){
function postmodify()
{
/* Find postcreate entries for this class */
- $command= $this->search($this->config->data['MENU'], get_class($this), "POSTMODIFY");
+ $command= search_config($this->config->data['MENU'], get_class($this), "POSTMODIFY");
if ($command == ""){
- $command= $this->search($this->config->data['SERVICE'], get_class($this), "POSTMODIFY");
+ $command= search_config($this->config->data['SERVICE'], get_class($this), "POSTMODIFY");
}
if ($command != ""){
function postremove()
{
/* Find postremove entries for this class */
- $command= $this->search($this->config->data['MENU'], get_class($this), "POSTREMOVE");
+ $command= search_config($this->config->data['MENU'], get_class($this), "POSTREMOVE");
if ($command == ""){
- $command= $this->search($this->config->data['SERVICE'], get_class($this), "POSTREMOVE");
+ $command= search_config($this->config->data['SERVICE'], get_class($this), "POSTREMOVE");
}
if ($command != ""){
}
}
- function search($arr, $name, $return)
- {
- if (is_array($arr)){
- foreach ($arr as $a){
- if (isset($a['CLASS']) &&
- strtolower($a['CLASS']) == strtolower($name)){
-
- if (isset($a[$return])){
- return ($a[$return]);
- } else {
- return ("");
- }
- } else {
- $res= $this->search ($a, $name, $return);
- if ($res != ""){
- return $res;
- }
- }
- }
- }
- return ("");
- }
-
/* Create unique DN */
function create_unique_dn($attribute, $base)
{
diff --git a/include/functions.inc b/include/functions.inc
index 54ecb36a4bab180017c64c866d8b30947bd5bfb7..30c6d0529213ac92b77f40032ef024742d47e7e2 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
}
function progressbar($percentage,$width=100,$height=15,$showvalue=false)
- {
+{
$str = ""; // Our return value will be saved in this var
$color = dechex($percentage+150);
/* If theres a better solution for this, use it... */
$str = "
- <div style=\" width:".($width)."px;
- height:".($height)."px;
- background-color:#000000;
- padding:1px;\">
+ <div style=\" width:".($width)."px;
+ height:".($height)."px;
+ background-color:#000000;
+padding:1px;\">
<div style=\" width:".($width)."px;
- background-color:#$bgcolor;
- height:".($height)."px;\">
+ background-color:#$bgcolor;
+height:".($height)."px;\">
+
+ <div style=\" width:".$progress."px;
+height:".$height."px;
+ background-color:#".$color2.$color2.$color."; \">";
- <div style=\" width:".$progress."px;
- height:".$height."px;
- background-color:#".$color2.$color2.$color."; \">";
+ if(($height >10)&&($showvalue)){
+ $str.= "<font style=\"font-size:".($height-2)."px;color:#FF0000;align:middle;padding-left:".((int)(($width*0.4)))."px;\">
+ <b>".$percentage."%</b>
+ </font>";
+ }
- if(($height >10)&&($showvalue)){
- $str.= "<font style=\"font-size:".($height-2)."px;color:#FF0000;align:middle;padding-left:".((int)(($width*0.4)))."px;\">
- <b>".$percentage."%</b>
- </font>";
- }
+ $str.= "</div></div></div>";
+
+ return($str);
+}
- $str.= "</div></div></div>";
- return($str);
+function search_config($arr, $name, $return)
+{
+ if (is_array($arr)){
+ foreach ($arr as $a){
+ if (isset($a['CLASS']) &&
+ strtolower($a['CLASS']) == strtolower($name)){
+
+ if (isset($a[$return])){
+ return ($a[$return]);
+ } else {
+ return ("");
+ }
+ } else {
+ $res= search_config ($a, $name, $return);
+ if ($res != ""){
+ return $res;
+ }
+ }
+ }
}
+ return ("");
+}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 01d0e0d975ec81cdbe234f87c430cede26a4c17f..76b54705a8f2c8a19d061719e5ae177be44759e1 100644 (file)
switch($_POST['saction']){
case 'wake':
- $cmd= $this->search($this->config->data['TABS'], "terminfo", "WAKECMD");
+ $cmd= search_config($this->config->data['TABS'], "terminfo", "WAKECMD");
if ($cmd == ""){
print_red(_("No WAKECMD definition found in your gosa.conf"));
} else {
break;
case 'reboot':
- $cmd= $this->search($this->config->data['TABS'], "terminfo", "REBOOTCMD");
+ $cmd= search_config($this->config->data['TABS'], "terminfo", "REBOOTCMD");
if ($cmd == ""){
print_red(_("No REBOOTCMD definition found in your gosa.conf"));
} else {
break;
case 'halt':
- $cmd= $this->search($this->config->data['TABS'], "terminfo", "HALTCMD");
+ $cmd= search_config($this->config->data['TABS'], "terminfo", "HALTCMD");
if ($cmd == ""){
print_red(_("No HALTCMD definition found in your gosa.conf"));
} else {
diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc
index 12c1c309dc3be2ddb7b9c2333fd92a30ec828883..ee9c214a051989bcca1e8667e8d0b15061402e6c 100644 (file)
if (isset($_POST['action'])){
switch($_POST['action']){
case 'wake':
- $cmd= $this->search($this->config->data['TABS'], "servgeneric", "WAKECMD");
+ $cmd= search_config($this->config->data['TABS'], "servgeneric", "WAKECMD");
if ($cmd == ""){
print_red(_("No WAKECMD definition found in your gosa.conf"));
} else {
break;
case 'reboot':
- $cmd= $this->search($this->config->data['TABS'], "servgeneric", "REBOOTCMD");
+ $cmd= search_config($this->config->data['TABS'], "servgeneric", "REBOOTCMD");
if ($cmd == ""){
print_red(_("No REBOOTCMD definition found in your gosa.conf"));
} else {
break;
case 'halt':
- $cmd= $this->search($this->config->data['TABS'], "servgeneric", "HALTCMD");
+ $cmd= search_config($this->config->data['TABS'], "servgeneric", "HALTCMD");
if ($cmd == ""){
print_red(_("No HALTCMD definition found in your gosa.conf"));
} else {
diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc
index e639e1636edd26b1e43af4aaeaaf694b8c976e2a..f95685e7ece1f1804c5ab224b1100556c7d06dc1 100644 (file)
if (isset($_POST['action'])){
switch($_POST['saction']){
case 'wake':
- $cmd= $this->search($this->config->data['TABS'], "termgeneric", "WAKECMD");
+ $cmd= search_config($this->config->data['TABS'], "termgeneric", "WAKECMD");
if ($cmd == ""){
print_red(_("No WAKECMD definition found in your gosa.conf"));
} else {
break;
case 'reboot':
- $cmd= $this->search($this->config->data['TABS'], "termgeneric", "REBOOTCMD");
+ $cmd= search_config($this->config->data['TABS'], "termgeneric", "REBOOTCMD");
if ($cmd == ""){
print_red(_("No REBOOTCMD definition found in your gosa.conf"));
} else {
break;
case 'halt':
- $cmd= $this->search($this->config->data['TABS'], "termgeneric", "HALTCMD");
+ $cmd= search_config($this->config->data['TABS'], "termgeneric", "HALTCMD");
if ($cmd == ""){
print_red(_("No HALTCMD definition found in your gosa.conf"));
} else {
diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc
index 1a82a1ae0eed1a97b969a3fbce78eb4ef2fdbc8b..1b8775eced24032bf4e6891375fead677ad28722 100644 (file)
if (isset($_POST['action'])){
switch($_POST['saction']){
case 'wake':
- $cmd= $this->search($this->config->data['TABS'], "terminfo", "WAKECMD");
+ $cmd= search_config($this->config->data['TABS'], "terminfo", "WAKECMD");
if ($cmd == ""){
print_red(_("No WAKECMD definition found in your gosa.conf"));
} else {
break;
case 'reboot':
- $cmd= $this->search($this->config->data['TABS'], "terminfo", "REBOOTCMD");
+ $cmd= search_config($this->config->data['TABS'], "terminfo", "REBOOTCMD");
if ($cmd == ""){
print_red(_("No REBOOTCMD definition found in your gosa.conf"));
} else {
break;
case 'halt':
- $cmd= $this->search($this->config->data['TABS'], "terminfo", "HALTCMD");
+ $cmd= search_config($this->config->data['TABS'], "terminfo", "HALTCMD");
if ($cmd == ""){
print_red(_("No HALTCMD definition found in your gosa.conf"));
} else {